public void ReceiveAction(DataPackage pkgData) { //收到 文件读写请求 的应答【采集器→主机】 Struct_FileHead fileHead = new Struct_FileHead(); Struct_Clock clock = new Struct_Clock(); byte[] dataBuffer = pkgData.PureData; using (MemoryStream ms = new MemoryStream(dataBuffer)) { using (BinaryReader br = new BinaryReader(ms)) { fileHead.Buffer = br.ReadBytes(4); //要读取文件的参数 curDataLen = br.ReadInt32(); //文件长度。为 0 表示文件不存在,后续的内容均应为 0。 clock.Buffer = br.ReadBytes(7); //文件起始时间 byte duration = br.ReadByte(); //文件持续时间长度,秒为单位。对于图片,此值为 0 br.ReadInt32(); //保留字节 macState = 1; } } if (curDataLen > 0) { //读取文件数据, 发送读取数据的命令 //创建数据存储文件 curFileName = string.Format("File_{0}.dat", DateTime.Now.ToString("yyyyMMddHHmmss")); curStream = new FileStream(curFileName, FileMode.Create, FileAccess.Write); curBinaryWriter = new BinaryWriter(curStream); SendDataRead(curRecNo, 0); } }
//--------------------------------------------------------------------- /// <summary> /// 设置时钟 /// </summary> /// <param name="time">时钟</param> /// <param name="systemReset">是否进行系统软件重启</param> public void Set(DateTime time, bool systemReset) { //设置时钟,【主机→采集器】 DataPackage pkgData = new DataPackage(); pkgData.CtrlHead.CMD_ID = HCCommand.TIME_CLOCK; pkgData.CtrlHead.CE_ID = (int)E_ADDR.Broadcast; Struct_Clock clock = new Struct_Clock(); clock.Time = time; byte[] clockBuffer = clock.Buffer; byte[] buffer = new byte[11]; Array.Copy(clockBuffer, 0, buffer, 0, clockBuffer.Length); buffer[7] = (systemReset ? (byte)0x01 : (byte)0x00); //SysRST: 0x01-系统软件重启,通知采集器上报当前数据 pkgData.PureData = buffer; pkgData.Pack(); SendData(pkgData); }
public DeviceStatusItem() { Time = new Struct_Clock(); TH = new Struct_TempHumi(); detailList = null; detailInfoDict = null; }
public Struct_Clock Time; //道岔扳动启动或结束时间 #endregion Fields #region Constructors public TurnoutFlipItem() { Time = new Struct_Clock(); }
public Struct_Clock Time; //数据采集时间 #endregion Fields #region Constructors public VehicleSignalItem() { Time = new Struct_Clock(); }
public Struct_Clock Time; //数据记录起始时间 指单条记录起始时间,不是分包起始时间 #endregion Fields #region Constructors public ReadRecordInfoItem() { Time = new Struct_Clock(); }
public Struct_Clock Time; //数据采集时间 #endregion Fields #region Constructors public OilPressureItem() { Time = new Struct_Clock(); }
public Struct_Clock Time; //数据采集时间 #endregion Fields #region Constructors public OilDataItem() { Time = new Struct_Clock(); }
public byte TimeErr; //0-时钟正常 1-时钟无效,时钟未同步 #endregion Fields #region Constructors public CollectorWorkStatusItem() { Time = new Struct_Clock(); TimeErr = 0; Data_S = 0; }
public byte TL_TYPE; //振动采集类型: 1-过车振动采集; 2-扳动振动采集 #endregion Fields #region Constructors public CollectorVibrationItem() { Time = new Struct_Clock(); }