Esempio n. 1
0
 // SensorBase[] devices;
 public GenericController(ControllerConfigBase config,PropertyBag propertybag)
     : base(config, propertybag)
 {
     //initialProperty();
     this.PropertyBag.TransmitCycle = 10;
     this.PropertyBag.TransmitMode = 1;
     SetTransmitCycleTmr();
       //  this.config = config;
 }
Esempio n. 2
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);
        }
Esempio n. 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");
        }
Esempio n. 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);
     }
 }
Esempio n. 5
0
 public SSHDataController(ControllerConfigBase config, PropertyBag propertybag)
     : base(config, propertybag)
 {
 }