Hi, i write a server-client component.
This component do the export video task for a stand alone application.
My problem is that if the service starts and the cameras are enabled all is well, as soon as the camera is disabled, as it is right that happens, the camera is null. If the camera is enabled by the Management, the camera is still null until the service is restarted with the consequent login to the server.
/// Login to the server code
VideoOS.Platform.SDK.Environment.Initialize();
VideoOS.Platform.SDK.Export.Environment.Initialize();
String server = (string)appSettings[“MilestoneEventReciver.Url”], username = (string)appSettings[“MilestoneEventReciver.User”], password = (string)appSettings[“MilestoneEventReciver.Password”];
String authorization = (string)appSettings\["MilestoneEventReciver.AutType"\];
Uri uri = new Uri(server);
CredentialCache \_credentialCache = VideoOS.Platform.Login.Util.BuildCredentialCache(uri, username, password, authorization);
Item siteItem = VideoOS.Platform.SDK.Environment.LoadSiteItem(uri, \_credentialCache);
VideoOS.Platform.SDK.Environment.AddServer(uri, \_credentialCache);
try
{
Logger.log("Attempt to LOGIN ...");
VideoOS.Platform.SDK.Environment.Login(uri);
Logger.log("LOGIN OK.");
}
catch (ServerNotFoundMIPException snfe)
{
Logger.log("Server non trovato: " + snfe.Message);
VideoOS.Platform.SDK.Environment.RemoveServer(uri);
return;
}
catch (InvalidCredentialsMIPException ice)
{
Logger.log("Credenziali non valide: " + ice.Message);
VideoOS.Platform.SDK.Environment.RemoveServer(uri);
return;
}
catch (Exception)
{
Logger.log("Internal error connecting to: " + uri.DnsSafeHost);
VideoOS.Platform.SDK.Environment.RemoveServer(uri);
return;
}
//// Code to get the camera
Item camera = Configuration.Instance.GetItem(new Guid(Uuid), Kind.Camera);
This line of code returns null, if the camera is disabled or has been re-enabled after being disabled.
Any suggestions?
thanks