public void Handle(byte[] data, MasProtocol protocol, ushort startIndex, string point) { StationUpdateResponse restartResponse = new StationUpdateResponse(); restartResponse.DeviceCode = point; restartResponse.ResponseCode = (data[startIndex + 7] & 0x0F); protocol.ProtocolType = ProtocolType.StationUpdateResponse; protocol.Protocol = restartResponse; }
/// <summary> /// 生成默认应答实体对象 /// </summary> /// <returns></returns> public MasProtocol GenerateResponse() { MasProtocol response = new MasProtocol(); response.SeriesNumber = this.SeriesNumber; response.SystemType = this.SystemType; response.Version = this.Version; response.Protocol = this.Protocol; return(response); }
public void Handle(byte[] data, MasProtocol protocol, ushort startIndex, string point) { UpdateCancleResponse updateCancleResponse = new UpdateCancleResponse(); updateCancleResponse.DeviceCode = point; updateCancleResponse.ResponseCode = (data[startIndex + 7] & 0x0F); protocol.ProtocolType = ProtocolType.UpdateCancleResponse; protocol.Protocol = updateCancleResponse; }
public void Handle(byte[] data, MasProtocol protocol, ushort startIndex, string point) { InspectionResponse inspectionResponse = new InspectionResponse(); inspectionResponse.DeviceCode = point; inspectionResponse.ResponseCode = data[startIndex + 7] & 0x0F; //分站响应标记 inspectionResponse.LostFileNum = (data[startIndex + 8] << 8) + data[startIndex + 9]; //缺失文件编号 protocol.ProtocolType = ProtocolType.InspectionResponse; protocol.Protocol = inspectionResponse; }
public void Handle(byte[] data, MasProtocol protocol, ushort startIndex, string point) { GetStationUpdateStateResponse StateResponse = new GetStationUpdateStateResponse(); StateResponse.DeviceCode = point; startIndex += 8; int tempInt1 = data[startIndex]; //数据域标记字1 int tempInt2 = 0; //数据域标记字2 int tempInt3 = 0; //数据域标记字3 int tempInt4 = 0; //数据域标记字4 startIndex++; if (((tempInt1 >> 7) & 0x01) == 0x01) { startIndex++; tempInt2 = data[startIndex]; if (((tempInt2 >> 7) & 0x01) == 0x01) { startIndex++; tempInt3 = data[startIndex]; if (((tempInt3 >> 7) & 0x01) == 0x01) { tempInt4 = data[startIndex]; startIndex++; if (((tempInt4 >> 7) & 0x01) == 0x01) { } } } } if ((tempInt1 & 0x01) == 0x01) //后续有软件版本号字段 { startIndex++; StateResponse.GetSoftVersion = data[startIndex] * 0.1; startIndex++; } if (((tempInt1 >> 1) & 0x01) == 0x01) //后续有远程升级状态字段 { startIndex++; //字节数 无用 StateResponse.GetUpdateState = data[startIndex]; //升级状态 startIndex++; StateResponse.UpdateVersion = data[startIndex]; //升级版本号 startIndex++; } if (((tempInt1 >> 2) & 0x01) == 0x01) //后续有设备类型字段 { startIndex++; //字节数 无用 StateResponse.GetDevType = data[startIndex]; //设备类型 startIndex++; } if (((tempInt1 >> 3) & 0x01) == 0x01) //后续有设备硬件版本号 { startIndex++; //字节数 无用 StateResponse.GetHardVersion = data[startIndex] * 0.1; //设备硬件版本号 } protocol.ProtocolType = ProtocolType.GetStationUpdateStateResponse; protocol.Protocol = StateResponse; }