void ProTurnoutAction(TurnoutFlipItem item) { //检测到道岔动作变化 if (item == null) return; if (item.SW_ACTION == 0) { //道岔扳动结束,发送读取数据的命令 } }
//CollectorVibrationItem curVibrationItem; /// <summary> /// 接收: 道岔扳动状态变化(未测试) /// </summary> /// <param name="pkgData"></param> void ReceiveTurnoutFlip(DataPackage pkgData) { var item = new TurnoutFlipItem(); using (MemoryStream ms = new MemoryStream(pkgData.PureData)) { using (BinaryReader br = new BinaryReader(ms)) { br.ReadByte(); item.SW_ACTION = br.ReadByte(); item.SW_DIR = br.ReadByte(); item.Time.Buffer = br.ReadBytes(7); item.SW_TIME = br.ReadUInt16(); } } if (item.SW_ACTION < 2) { ACK_TurnoutFlip(item.SW_ACTION); //如果不是超时状态,则应答 OnDataChangeAction(pkgData, item); } }