GetDirectory exception PC-SDK
mrogerf
✭
Hello.
I develop this small program to create a backup and copy it to PC, but I get the following exception when calling GetDirectory : Operation is not valid due the current state of the object.
The code is bellow:
Thanks for any help
=======================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ABB.Robotics;
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.Discovery;
using ABB.Robotics.Controllers.RapidDomain;
using ABB.Robotics.Controllers.FileSystemDomain;
namespace abbirc5
{
class Program
{
static void Main(string[] args)
{ if (args.Length > 0) {
bool bControllerFound = false;
System.Console.WriteLine("IP requested: " + args[0]);
NetworkScanner netscanner = new NetworkScanner();
NetworkScanner.AddRemoteController(args[0]);
netscanner.Scan();
System.Threading.Thread.Sleep(4000);
netscanner.Scan();
ControllerInfoCollection controllers = netscanner.Controllers;
foreach (ControllerInfo controllerInfo in controllers) {
if (controllerInfo.IPAddress.ToString() == args[0]) {
bControllerFound = true;
System.Console.WriteLine("System found: " + controllerInfo.Id + " :: " + controllerInfo.IPAddress.ToString());
if (controllerInfo.Availability == Availability.Available) {
Controller controller = ControllerFactory.CreateFrom(controllerInfo);
controller.Logon(UserInfo.DefaultUser);
System.Console.WriteLine("Controller logged");
//do backup
controller.BackupCompleted += new EventHandler<BackupEventArgs>(controller_BackupCompleted);
controller.Backup("/hd0a/temp/backup");
do {
System.Console.Write(".");
System.Threading.Thread.Sleep(1000);
} while (controller.BackupInProgress);
controller.FileSystem.RemoteDirectory = "/hd0a/temp";
controller.FileSystem.LocalDirectory = ".";
controller.FileSystem.GetDirectory("backup");
System.Console.WriteLine("1:Transfer succeced:"+controllerInfo.Id);
//finish connection
controller.Logoff();
controller.Dispose();
}
else
System.Console.WriteLine("0:Controller found but it is not avaiable");
}
}
if (!bControllerFound)
System.Console.WriteLine("0:Controller not found");
}
else
System.Console.WriteLine("0:Lacks argument");
}
static void controller_BackupCompleted(object sender, BackupEventArgs e)
{ if (e.Succeeded)
System.Console.WriteLine("1:Backup done");
else
System.Console.WriteLine("0:Backup error");
}
}
}
Tagged:
0
Comments
-
controller.FileSystem.GetDirectory("backup");Are you sure it's backup folder ?0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings