public DataPacket GetFlowDataPacket(string deviceKey, Dictionary <string, object> data, bool realTime = false)
        {
            if (data.Count == 0)
            {
                return(null);
            }
            DataPacket dp = new DataPacket(deviceKey, realTime, true);

            // Adjust 'CN' !!
            if (realTime)
            {
                dp.Cn = string.Format("{0}", (int)SentCommand.FlowData);
            }
            else
            {
                dp.Cn = string.Format("{0}", (int)ReceivedCommand.GetFlowData);
            }

            dp.Settings = Settings.Instance;
            dp.St       = Value.SysSend;
            string sno      = Settings.Instance.Sno;
            string eno      = Settings.Instance.GetEquipNumber(deviceKey);
            string timeStr  = (string)data["time"];
            string dataTime = DeviceTime.Convert(DateTime.Parse(timeStr));

            dp.SetContent(sno, eno, dataTime, data);
            dp.Build();
            return(dp);
        }
Exemple #2
0
        public DataPacket GetFlowDataPacket(string deviceKey, Dictionary<string, object> data, bool realTime = false)
        {
            if (data.Count == 0)
            {
                return null;
            }
            DataPacket dp = new DataPacket(deviceKey, realTime, true);
            // Adjust 'CN' !!
            if (realTime)
            {
                dp.Cn = string.Format("{0}", (int)SentCommand.FlowData);
            }
            else
            {
                dp.Cn = string.Format("{0}", (int)ReceivedCommand.GetFlowData);
            }

            dp.Settings = Settings.Instance;
            dp.St = Value.SysSend;
            string sno = Settings.Instance.Sno;
            string eno = Settings.Instance.GetEquipNumber(deviceKey);
            string timeStr = (string)data["time"];
            string dataTime = DeviceTime.Convert(DateTime.Parse(timeStr));
            dp.SetContent(sno, eno, dataTime, data);
            dp.Build();
            return dp;
        }
        public DataPacket GetShelterPacket(string deviceKey, Dictionary <string, object> data, bool realTime = false)
        {
            if (data.Count == 0)
            {
                return(null);
            }
            DataPacket dp = new DataPacket(deviceKey, realTime);

            dp.Cn       = string.Format("{0}", (int)SentCommand.DoorState);
            dp.Settings = Settings.Instance;
            dp.St       = Value.SysSend;
            string sno     = Settings.Instance.Sno;
            string eno     = Settings.Instance.GetEquipNumber(deviceKey);
            string timeStr = string.Empty;

            if (data.ContainsKey("time"))
            {
                timeStr = (string)data["time"];
            }
            string dataTime = DeviceTime.Convert(DateTime.Parse(timeStr));

            dp.SetContent(sno, eno, dataTime, data);
            dp.Build();
            return(dp);
        }
 public DataPacket GetKeepAlivePacket()
 {
     DataPacket dp = new DataPacket(SentCommand.KeepAlive);
     dp.Settings = Settings.Instance;
     dp.St = Value.SysSend;
     dp.Build();
     return dp;
 }
        public DataPacket GetKeepAlivePacket()
        {
            DataPacket dp = new DataPacket(SentCommand.KeepAlive);

            dp.Settings = Settings.Instance;
            dp.St       = Value.SysSend;
            dp.Build();
            return(dp);
        }
        public DataPacket GetRunStatusPacket(string qn, string[] devices, string[] status)
        {
            DataPacket dp = new DataPacket(SentCommand.RunStatus);

            dp.QN       = qn;
            dp.Settings = Settings.Instance;
            dp.St       = Value.SysSend;
            string sno      = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);

            dp.SetRunStatusContent(sno, dateTime, devices, status);
            dp.Build();
            return(dp);
        }
        internal DataPacket GetDoorStatePacket(string state)
        {
            DataPacket dp = new DataPacket(SentCommand.DoorState);

            dp.Settings = Settings.Instance;

            string sno      = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);

            dp.St = Value.SysSend;
            dp.SetDoorStateContent(sno, dateTime, state);
            dp.Build();
            return(dp);
        }
        internal DataPacket GetThresholdPacket(string polId, string eno, string v1, string v2)
        {
            DataPacket dp = new DataPacket(SentCommand.GetAlertThreshold);

            dp.Settings = Settings.Instance;

            string sno      = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);

            dp.St = Value.SysSend;
            dp.SetThresholdContent(sno, eno, polId, v1, v2);
            dp.Build();
            return(dp);
        }
        internal DataPacket GetExceptionNotifyPacket(string deviceKey, bool p)
        {
            DataPacket dp = new DataPacket(p ? SentCommand.WentException : SentCommand.AfterException);

            dp.Settings = Settings.Instance;

            string sno      = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);

            dp.St   = Value.SysSend;
            dp.Flag = "1";
            dp.SetExceptionNotifyContent(sno, dateTime, deviceKey, (p ? "0" : "1"));
            dp.Build();
            return(dp);
        }
 public DataPacket GetFlowDataPacket(string deviceKey, Dictionary<string, object> data, bool realTime = false)
 {
     if (data.Count == 0)
     {
         return null;
     }
     DataPacket dp = new DataPacket(deviceKey, realTime, true);
     dp.Settings = Settings.Instance;
     dp.St = Value.SysSend;
     string sno = Settings.Instance.Sno;
     string eno = Settings.Instance.GetEquipNumber(deviceKey);
     string timeStr = (string)data["time"];
     string dataTime = DeviceTime.Convert(DateTime.Parse(timeStr));
     dp.SetContent(sno, eno, dataTime, data);
     dp.Build();
     return dp;
 }
Exemple #11
0
 public DataPacket GetShelterPacket(string deviceKey, Dictionary<string, object> data, bool realTime = false)
 {
     if (data.Count == 0)
     {
         return null;
     }
     DataPacket dp = new DataPacket(deviceKey, realTime);
     dp.Cn = string.Format("{0}", (int)SentCommand.DoorState);
     dp.Settings = Settings.Instance;
     dp.St = Value.SysSend;
     string sno = Settings.Instance.Sno;
     string eno = Settings.Instance.GetEquipNumber(deviceKey);
     string timeStr = string.Empty;
     if (data.ContainsKey("time"))
     {
         timeStr = (string)data["time"];
     }
     string dataTime = DeviceTime.Convert(DateTime.Parse(timeStr));
     dp.SetContent(sno, eno, dataTime, data);
     dp.Build();
     return dp;
 }
Exemple #12
0
 public DataPacket GetRunStatusPacket(string qn, string[] devices, string[] status)
 {
     DataPacket dp = new DataPacket(SentCommand.RunStatus);
     dp.QN = qn;
     dp.Settings = Settings.Instance;
     dp.St = Value.SysSend;
     string sno = Settings.Instance.Sno;
     string dateTime = DeviceTime.Convert(DateTime.Now);
     dp.SetRunStatusContent(sno, dateTime, devices, status);
     dp.Build();
     return dp;
 }
Exemple #13
0
        internal DataPacket GetDoorStatePacket(string state)
        {
            DataPacket dp = new DataPacket(SentCommand.DoorState);
            dp.Settings = Settings.Instance;

            string sno = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);
            dp.St = Value.SysSend;
            dp.SetDoorStateContent(sno, dateTime, state);
            dp.Build();
            return dp;
        }
Exemple #14
0
        internal DataPacket GetThresholdPacket(string polId, string eno, string v1, string v2)
        {
            DataPacket dp = new DataPacket(SentCommand.GetAlertThreshold);
            dp.Settings = Settings.Instance;

            string sno = Settings.Instance.Sno;
            string dateTime = DeviceTime.Convert(DateTime.Now);
            dp.St = Value.SysSend;
            dp.SetThresholdContent(sno, eno, polId, v1, v2);
            dp.Build();
            return dp;
        }
Exemple #15
0
 internal DataPacket GetExceptionNotifyPacket(string deviceKey, bool p)
 {
     DataPacket dp = new DataPacket(p ? SentCommand.WentException : SentCommand.AfterException);
     dp.Settings = Settings.Instance;
     
     string sno = Settings.Instance.Sno;
     string dateTime = DeviceTime.Convert(DateTime.Now);
     dp.St = Value.SysSend;
     dp.Flag = "1";
     dp.SetExceptionNotifyContent(sno, dateTime, deviceKey, (p ? "0" : "1"));
     dp.Build();
     return dp;
 }