예제 #1
0
        /// <summary>
        /// initObj是一个AllAndAutoArmAIThings
        /// </summary>
        /// <param name="path"></param>
        public override void TryInit(object path)
        {
            config = new AIManagementConfig((string)path);

            //判断autoArmAIThings是否是allAIThings的子集
            if (!config.AIThings.AutoArmAIThingPaths.All(autoArm => config.AIThings.AllAIThingPaths.Any(every => every == autoArm)))
            {
                throw new Exception("需要自动arm的所有AIThing必须包含在所有AIThing中");
            }
            logger = Cfet2LogManager.GetLogger("AIManagement");
        }
예제 #2
0
        public override void TryInit(object initObj)
        {
            base.TryInit(initObj);

            //get a logger
            logger = Cfet2LogManager.GetLogger("Event");

            if (initObj != null)
            {
                config = (ListenerConfig)initObj.TryConvertTo(typeof(ListenerConfig));
            }
            token = MyHub.EventHub.Subscribe(new EventFilter(config.Source, config.EventType), handler);
        }
예제 #3
0
 public override void TryInit(object configFilePath)
 {
     myConfig = new UploadConfig((string[])configFilePath);
     if (myConfig != null)
     {
         State = Status.Idle;
     }
     else
     {
         throw new Exception("上传配置文件错误!");
     }
     logger = Cfet2LogManager.GetLogger("UploadLog");
 }
예제 #4
0
        public override void TryInit(object initObj)
        {
            var dataAndConfigPath = (DataAndConfigPath)initObj.TryConvertTo(typeof(DataAndConfigPath));

            DataFileParentDirectory = dataAndConfigPath.DataFileParentDirectory;

            //get a logger
            logger = Cfet2LogManager.GetLogger("Event-" + DataFileParentDirectory);

            basicAI.InitAI(dataAndConfigPath.ConfigFilePath);

            //订阅AI的event
            subscribeEvent();
        }
예제 #5
0
        public override void TryInit(object configFilePath)
        {
            myConfig = new MdsUploadConfig((string[])configFilePath);
            if (myConfig != null)
            {
                State = Status.Idle;
            }
            else
            {
                State = Status.Error;
            }
            logger = Cfet2LogManager.GetLogger("MdsUploadLog");

            // 当为 Master 时,订阅上传触发事件
            if (myConfig.MasterOrSlave == 1)
            {
                for (int i = 0; i < myConfig.EventPaths.Count(); i++)
                {
                    token = MyHub.EventHub.Subscribe(new EventFilter(myConfig.EventPaths[i], myConfig.EventKinds[i]), handler);
                }
            }
        }