Beispiel #1
0
        public ControllerBase(ControllerConfigBase config,PropertyBag property)
        {
            this.PropertyBag = property;
            this.DeviceType = config.device_type;
            this.ListenPort = config.listen_port;
            this.ControllerID = config.controller_id;
            this.BuildDate = config.build_date;
            this.VersionNo = config.version_no;
            tmrPeriodDataReport = new System.Threading.Timer(new System.Threading.TimerCallback(PeroidDataReportTask));
            this.config = config;
            CreateDevices(config);
            tmrHwStatus = new System.Threading.Timer(new System.Threading.TimerCallback(TmrHwStausTask));
               // tmrHwStatus.Change(0, 1000);
            SetHWStatusTmr();

              //  tmrPeriodDataReport.Change(GetNextTransmitSeconds()*1000,this.PropertyBag.TransmitCycle*60* 1000);
            SetTransmitCycleTmr();
            StartListening(ListenPort);
            OneMinTmr = new System.Threading.Timer(OneMinTask);
            OneMinTmr.Change(GetNextMinDifferentSec()*1000, 60 * 1000);
            this.protocol.Parse(System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "protocol.txt"), false);
            this.PropertyBag.OnHWStatus_Changed += new EventHandler(PropertyBag_OnHWStatus_Changed);
        }
Beispiel #2
0
 public SSHDataController(ControllerConfigBase config, PropertyBag propertybag)
     : base(config, propertybag)
 {
 }
Beispiel #3
0
        void SetConfig(Comm.TextPackage text)
        {
            MemoryStream ms = new MemoryStream(text.Text, 3, text.Text[1] * 256 + text.Text[2]);
            this.config = ControllerConfigBase.Deserialize(ms);

            config.Serialize(AppDomain.CurrentDomain.BaseDirectory + "config.xml");
        }
Beispiel #4
0
 void CreateDevices(ControllerConfigBase config)
 {
     if (config.sensors == null)
     {
         devices = new SensorBase[0];
         return;
     }
     devices = new SensorBase[config.sensors.Length];
     for (int i = 0; i < config.sensors.Length; i++)
     {
         devices[i] = CreateDevice(config.sensors[i]);
         devices[i].OnConnectionChanged += new OnConnectedChangedHandler(Device_OnConnectionChanged);
     }
 }