public bool Execute() { try { DateTime time = ConverUtil.Time(_content, 0); //设备时间。 string DeviceTypeStr = ConverUtil.ByteToStr_2(_content, 7); //设备类型 string DeviceIdStr = ConverUtil.ByteToStr_4(_content, 9); //设备Id byte DeviceState = _content[14]; //设备状态 string[] BitStr = DataJM.GetBitStr(DeviceState); string OpenCloseState = BitStr[0]; string HLW8012State = BitStr[1]; string PowerNumStr = _content[15].ToString(); //功率因素 string timeStr = time.ToString("yyyy-M-d HH:mm:ss"); QiYeFangHuDal.Insert_XinTiao(DeviceTypeStr, DeviceIdStr, PowerNumStr, "", timeStr, HLW8012State); } catch (Exception ex) { MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode); } return(true); }
public bool Execute() { try { DateTime time = ConverUtil.Time(_content, 0); //设备时间。 string DeviceTypeStr = ConverUtil.ByteToStr_2(_content, 7); //设备类型 string DeviceIdStr = ConverUtil.ByteToStr_4(_content, 9); // 设备Id byte DeviceState = _content[14]; //设备状态 string[] BitStr = DataJM.GetBitStr(DeviceState); string SmokeFeelState = BitStr[0]; string TemperatureAndHumidityState = BitStr[1]; string temperatureStr = _content[16].ToString(); //设备温度 string HumidityStr = _content[17].ToString(); //设备湿度 string timeStr = time.ToString("yyyy-M-d HH:mm:ss"); QiYeFangHuDal.Insert_XinTiao(DeviceTypeStr, DeviceIdStr, temperatureStr, HumidityStr, timeStr, TemperatureAndHumidityState); } catch (Exception ex) { MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode); } return(true); }