Esempio n. 1
0
        public override void Dispose()
        {
            imageClient = null;

            logger.Dispose();
            logger = null;

            utility = null;
            helper  = null;

            hub.Unsubscribe <IInputMessage>(this.IInputMessageProcessor);
        }
Esempio n. 2
0
        public ICANSEE() : base("ICANSEEv1")
        {
            imageClient = new ImageClient();

            brokerHubHost = System.Configuration.ConfigurationSettings.AppSettings["ChatInterfaceHost"];
            brokerHubPort = System.Configuration.ConfigurationSettings.AppSettings["ChatInterfacePort"];

            logger  = new ICANSEELogger();
            utility = new ICANSEEUtility(logger, imageClient, brokerHubHost, brokerHubPort);
            helper  = new ICANSEEHelper(logger, utility, imageClient, brokerHubHost, brokerHubPort);

            hub.Subscribe <IInputMessage>(this.IInputMessageProcessor);
        }
Esempio n. 3
0
        public ICANSEEHelper(ICANSEELogger logger, ICANSEEUtility utility, ImageClient imageClient, string brokerHubHost, string brokerHubPort)
        {
            this.logger        = logger;
            this.utility       = utility;
            this.imageClient   = imageClient;
            this.brokerHubHost = brokerHubHost;
            this.brokerHubPort = brokerHubPort;

            computeDeviceList = utility.GetComputeDevicesList();

            if (computeDeviceList.Count <= 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("No compute devices available (Check ComputeDeviceConfig file for extensive list)");
                Console.ResetColor();
            }
            else
            {
                foreach (var computeDevice in computeDeviceList)
                {
                    computeDeviceStateMap[computeDevice] = new Dictionary <int, ComputeDeviceState>();
                }
            }
        }
        public ICANSEEUtility(ICANSEELogger logger, ImageClient imageClient, string brokerHubHost, string brokerHubPort, string algoDescriptionFileName = "ICANSEE.AlgorithmsDescriptionList.json", string computeDeviceListFileName = "ICANSEE.ComputeDeviceList.json", string cameraListFileName = "CameraConfigurationList.json", string presetDescriptionListFileName = "ICANSEE.PresetDescriptionList.json")
        {
            this.logger        = logger;
            this.imageClient   = imageClient;
            this.brokerHubHost = brokerHubHost;
            this.brokerHubPort = brokerHubPort;

            if (!File.Exists(algoDescriptionFileName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Algo descriptions file not found: " + algoDescriptionFileName);
                Console.ResetColor();
            }
            else
            {
                try
                {
                    LoadAlgorithmDescriptionsFromFile(algoDescriptionFileName);
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error while reading algoDescriptionFile : " + algoDescriptionFileName);
                    Console.WriteLine(ex.Message);
                    Console.ResetColor();
                }
            }



            if (!File.Exists(computeDeviceListFileName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Compute Device List file not found: " + computeDeviceListFileName);
                Console.ResetColor();
            }
            else
            {
                try
                {
                    LoadComputeDeviceListFromFile(computeDeviceListFileName);
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error while reading Compute Device List : " + computeDeviceListFileName);
                    Console.WriteLine(ex.Message);
                    Console.ResetColor();
                }
            }


            if (!File.Exists(cameraListFileName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Camera description list file not found: " + cameraListFileName);
                Console.ResetColor();
            }
            else
            {
                try
                {
                    LoadCameraDescriptionsFromFile(cameraListFileName);
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error while reading Camera description list : " + cameraListFileName);
                    Console.WriteLine(ex.Message);
                    Console.ResetColor();
                }
            }


            if (!File.Exists(presetDescriptionListFileName))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Preset description list file not found: " + presetDescriptionListFileName);
                Console.ResetColor();
            }
            else
            {
                try
                {
                    LoadPresetDescriptionsFromFile(presetDescriptionListFileName);
                }
                catch (Exception ex)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Error while reading Preset description list : " + presetDescriptionListFileName);
                    Console.WriteLine(ex.Message);
                    Console.ResetColor();
                }
            }
        }