private bool ProcessQData(RxDataIn rxDataIn, ref bool dataFound) { bool flag = true; dataFound = false; try { stopWaitMutex.WaitOne(); rxDataInRspData.GetRspData(rxDataIn, stopWaitEvent); if (stopWaitMsg && FindStopWait(rxDataIn) && DeviceTxStopWaitCallback != null) { stopWaitMsg = false; stopWaitEvent = (HCIStopWait.StopWaitEvent)null; DeviceTxStopWaitCallback(true); } rxDataIn.Time = DateTime.Now.ToString("hh:mm:ss.fff"); if (DeviceRxDataCallback != null) { DeviceRxDataCallback(rxDataIn); } dataFound = true; stopWaitMutex.ReleaseMutex(); } catch (Exception ex) { string msg = "Process Queue Data Problem.\n" + ex.Message + "\nRxDataInThread\n"; msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } return(flag); }
private bool QueueDataReady() { object data = (object)new RxDataIn(); bool flag = DataQueue.RemoveQHead(ref data); if (flag) { RxDataIn rxDataIn = (RxDataIn)data; bool dataFound = false; flag = ProcessQData(rxDataIn, ref dataFound); if (flag) { int num = dataFound ? 1 : 0; } } Thread.Sleep(10); return(flag); }
private bool FindStopWait(RxDataIn rxDataIn) { bool flag = false; try { if (rxDataIn.RxType == 4) { int index = 0; bool dataErr = false; switch (rxDataIn.CmdOpcode) { case 0xff: byte eventStatus = dataUtils.Unload8Bits(rxDataIn.Data, ref index, ref dataErr); if (!dataErr) { ushort num1 = rxDataIn.EventOpcode; if (num1 <= 1171) { if (num1 <= 1153) { } else if (num1 != 1163) { if (num1 == 1171) { break; } else { break; } } else { break; } } else if (num1 <= 1408) { switch (num1) { case 1281: HCIReplies.ATT_MsgHeader attMsgHdr = new HCIReplies.ATT_MsgHeader(); int num2; if ((num2 = rxDataInRspData.UnloadAttMsgHeader(ref rxDataIn.Data, ref index, ref dataErr, ref attMsgHdr)) == 0) { if (num2 == 0) { break; } } byte num3 = dataUtils.Unload8Bits(rxDataIn.Data, ref index, ref dataErr); if (!dataErr) { if ((num3 & 0x80) != (int)(byte)(stopWaitEvent.TxOpcode & (HCICmds.HCICmdOpcode) 65408) && (num3 & 0x80) != (int)(byte)(stopWaitEvent.ReqEvt & (HCICmds.HCIEvtOpCode) 65408)) { if (stopWaitEvent.ReqEvt != HCICmds.HCIEvtOpCode.InvalidEventCode) { break; } } flag = true; break; } else { break; } case (ushort)1282: case (ushort)1283: case (ushort)1284: case (ushort)1285: case (ushort)1286: case (ushort)1287: case (ushort)1288: case (ushort)1289: case (ushort)1290: case (ushort)1291: case (ushort)1292: case (ushort)1293: case (ushort)1294: case (ushort)1295: case (ushort)1296: case (ushort)1297: case (ushort)1298: case (ushort)1299: case (ushort)1302: case (ushort)1303: case (ushort)1304: case (ushort)1305: case (ushort)1307: case (ushort)1309: case (ushort)1310: if ((int)rxDataIn.EventOpcode != (int)(ushort)stopWaitEvent.RspEvt1) { if ((int)rxDataIn.EventOpcode != (int)(ushort)stopWaitEvent.RspEvt2) { break; } } flag = CheckMsgComplete(stopWaitEvent.MsgComp, eventStatus); break; } } else { switch (num1) { case 1663: ushort num4 = dataUtils.Unload16Bits(rxDataIn.Data, ref index, ref dataErr, false); if (!dataErr) { if (num4 == (ushort)stopWaitEvent.TxOpcode) { flag = CheckMsgComplete(stopWaitEvent.ExtCmdStat.MsgComp, eventStatus); break; } else { break; } } else { break; } } } } break; } } } catch (Exception ex) { string msg = "Find Stop Wait Problem.\n" + ex.Message + "\nRxDataInThread\n"; msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } return(flag); }
public void GetRspData(RxDataIn rxDataIn, HCIStopWait.StopWaitEvent stopWaitEvent) { int index1 = 0; bool dataErr = false; int num1 = 0; try { HCIReplies hciReplies = new HCIReplies(); hciReplies.ObjTag = null; hciReplies.CmdType = TxDataOut.CmdTypes.General; if (stopWaitEvent != null) { hciReplies.ObjTag = stopWaitEvent.Tag; hciReplies.CmdType = stopWaitEvent.CmdType; } switch (rxDataIn.CmdOpcode) { case byte.MaxValue: byte num2 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { break; } hciReplies.HciLeExtEvent = new HCIReplies.HCI_LE_ExtEvent(); hciReplies.HciLeExtEvent.Header.EventCode = rxDataIn.EventOpcode; hciReplies.HciLeExtEvent.Header.EventStatus = num2; ushort num3 = rxDataIn.EventOpcode; if (num3 <= 1171U) { if (num3 <= 1153U) { return; } else if (num3 == 1163 || num3 == 1171) { break; } else { break; } } else if (num3 <= 1408U) { switch (num3) { case 1281: hciReplies.HciLeExtEvent.AttErrorRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ErrorRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttErrorRsp.AttMsgHdr)) == 0 || dataErr) { return; } byte num4 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttErrorRsp.ReqOpCode = num4; hciReplies.HciLeExtEvent.AttErrorRsp.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttErrorRsp.ErrorCode = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1282: return; case 1283: return; case 1284: return; case 1285: hciReplies.HciLeExtEvent.AttFindInfoRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_FindInfoRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttFindInfoRsp.AttMsgHdr)) == 0 || dataErr) { return; } hciReplies.HciLeExtEvent.AttFindInfoRsp.Format = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } int uuidLength = m_deviceUtils.GetUuidLength(hciReplies.HciLeExtEvent.AttFindInfoRsp.Format, ref dataErr); if (dataErr) { return; } int dataLength1 = uuidLength + 2; int totalLength1 = (int)rxDataIn.Length - index1; hciReplies.HciLeExtEvent.AttFindInfoRsp.HandleData = new List <HCIReplies.HandleData>(); m_deviceUtils.UnloadHandleValueData(rxDataIn.Data, ref index1, totalLength1, dataLength1, ref dataErr, "Uuid", ref hciReplies.HciLeExtEvent.AttFindInfoRsp.HandleData); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1286: return; case 1287: hciReplies.HciLeExtEvent.AttFindByTypeValueRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_FindByTypeValueRsp(); int num5; if ((num5 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.AttMsgHdr)) == 0 || dataErr) { return; } if (num5 >= 2) { int length = num5 / 2; hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.Handle = new ushort[length]; for (int index2 = 0; index2 < length && !dataErr; ++index2) { hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.Handle[index2] = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { break; } } } if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1288: return; case 1289: hciReplies.HciLeExtEvent.AttReadByTypeRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadByTypeRsp(); int num6; if ((num6 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByTypeRsp.AttMsgHdr)) == 0 || dataErr) { return; } int dataLength2 = (int)m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttReadByTypeRsp.Length = (byte)dataLength2; int totalLength2 = num6 - 1; if (dataLength2 == 0) { return; } string handleStr = string.Empty; string valueStr = string.Empty; hciReplies.HciLeExtEvent.AttReadByTypeRsp.HandleData = new List <HCIReplies.HandleData>(); m_deviceUtils.UnloadHandleValueData(rxDataIn.Data, ref index1, totalLength2, dataLength2, ref handleStr, ref valueStr, ref dataErr, "Data", ref hciReplies.HciLeExtEvent.AttReadByTypeRsp.HandleData); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1290: return; case 1291: hciReplies.HciLeExtEvent.AttReadRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadRsp(); int length1; if ((length1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadRsp.AttMsgHdr)) == 0 || dataErr) { return; } hciReplies.HciLeExtEvent.AttReadRsp.Data = new byte[length1]; for (int index2 = 0; index2 < length1 && !dataErr; ++index2) { hciReplies.HciLeExtEvent.AttReadRsp.Data[index2] = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); } if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1292: return; case 1293: hciReplies.HciLeExtEvent.AttReadBlobRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadBlobRsp(); int length2 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadBlobRsp.AttMsgHdr); if (dataErr) { return; } if (length2 > 0) { hciReplies.HciLeExtEvent.AttReadBlobRsp.Data = new byte[length2]; for (int index2 = 0; index2 < length2 && !dataErr; ++index2) { hciReplies.HciLeExtEvent.AttReadBlobRsp.Data[index2] = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); } } if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1294: return; case 1295: return; case 1296: return; case 1297: hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadByGrpTypeRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.AttMsgHdr)) == 0 || dataErr) { return; } byte num7 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.Length = num7; if ((int)num7 == 0) { return; } int dataLength3 = (int)num7; int totalLength3 = (int)rxDataIn.Length - 3 - index1 + 1; hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.HandleData = new List <HCIReplies.HandleHandleData>(); m_deviceUtils.UnloadHandleHandleValueData(rxDataIn.Data, ref index1, totalLength3, dataLength3, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.HandleData); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1298: return; case 1299: hciReplies.HciLeExtEvent.AttWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_WriteRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttWriteRsp.attMsgHdr)) == 0 || dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1300: return; case 1301: return; case 1302: return; case 1303: hciReplies.HciLeExtEvent.AttPrepareWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_PrepareWriteRsp(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttPrepareWriteRsp.AttMsgHdr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Offset = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1304: return; case 1305: hciReplies.HciLeExtEvent.AttExecuteWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ExecuteWriteRsp(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttExecuteWriteRsp.AttMsgHdr); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1306: return; case 1307: hciReplies.HciLeExtEvent.AttHandleValueNotification = new HCIReplies.HCI_LE_ExtEvent.ATT_HandleValueNotification(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttHandleValueNotification.AttMsgHdr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttHandleValueNotification.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttHandleValueNotification.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1308: return; case 1309: hciReplies.HciLeExtEvent.AttHandleValueIndication = new HCIReplies.HCI_LE_ExtEvent.ATT_HandleValueIndication(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttHandleValueIndication.AttMsgHdr); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttHandleValueIndication.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.AttHandleValueIndication.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1310: return; case 1408: return; default: return; } } else { switch (num3) { case 1536: case 1537: case 1538: case 1539: case 1540: case 1541: case 1542: case 1543: case 1544: case 1545: case 1546: case 1547: case 1548: case 1549: case 1550: case 1551: return; case 1663: hciReplies.HciLeExtEvent.GapHciCmdStat = new HCIReplies.HCI_LE_ExtEvent.GAP_HCI_ExtentionCommandStatus(); hciReplies.HciLeExtEvent.GapHciCmdStat.CmdOpCode = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) { return; } hciReplies.HciLeExtEvent.GapHciCmdStat.DataLength = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) { return; } ushort num8 = hciReplies.HciLeExtEvent.GapHciCmdStat.CmdOpCode; if ((uint)num8 <= 64918U) { if ((uint)num8 <= 64658U) { if ((int)num8 == 64650 || (int)num8 == 64658) { return; } else { return; } } else { switch (num8) { case 64778: case 64779: case 64780: case 64781: case 64786: case 64787: case 64790: case 64791: case 64792: case 64793: case 64902: case 64912: case 64908: case 64914: case 64918: m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 64900: case 64904: case 64906: break; default: return; } } } else if (num8 <= 64962U) { if (num8 != 64946U) { return; } } else { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; default: return; } } } } catch (Exception ex) { m_msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, "Get Response Data Problem.\n" + ex.Message + "\nRxDataInRspData\n"); } }
public void GetRspData(RxDataIn rxDataIn, HCIStopWait.StopWaitEvent stopWaitEvent) { int index1 = 0; bool dataErr = false; int num1 = 0; try { HCIReplies hciReplies = new HCIReplies(); hciReplies.ObjTag = null; hciReplies.CmdType = TxDataOut.CmdTypes.General; if (stopWaitEvent != null) { hciReplies.ObjTag = stopWaitEvent.Tag; hciReplies.CmdType = stopWaitEvent.CmdType; } switch (rxDataIn.CmdOpcode) { case byte.MaxValue: byte num2 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) break; hciReplies.HciLeExtEvent = new HCIReplies.HCI_LE_ExtEvent(); hciReplies.HciLeExtEvent.Header.EventCode = rxDataIn.EventOpcode; hciReplies.HciLeExtEvent.Header.EventStatus = num2; ushort num3 = rxDataIn.EventOpcode; if (num3 <= 1171U) { if (num3 <= 1153U) return; else if (num3 == 1163 || num3 == 1171) break; else break; } else if (num3 <= 1408U) { switch (num3) { case 1281: hciReplies.HciLeExtEvent.AttErrorRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ErrorRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttErrorRsp.AttMsgHdr)) == 0 || dataErr) return; byte num4 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; hciReplies.HciLeExtEvent.AttErrorRsp.ReqOpCode = num4; hciReplies.HciLeExtEvent.AttErrorRsp.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.AttErrorRsp.ErrorCode = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1282: return; case 1283: return; case 1284: return; case 1285: hciReplies.HciLeExtEvent.AttFindInfoRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_FindInfoRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttFindInfoRsp.AttMsgHdr)) == 0 || dataErr) return; hciReplies.HciLeExtEvent.AttFindInfoRsp.Format = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; int uuidLength = m_deviceUtils.GetUuidLength(hciReplies.HciLeExtEvent.AttFindInfoRsp.Format, ref dataErr); if (dataErr) return; int dataLength1 = uuidLength + 2; int totalLength1 = (int)rxDataIn.Length - index1; hciReplies.HciLeExtEvent.AttFindInfoRsp.HandleData = new List<HCIReplies.HandleData>(); m_deviceUtils.UnloadHandleValueData(rxDataIn.Data, ref index1, totalLength1, dataLength1, ref dataErr, "Uuid", ref hciReplies.HciLeExtEvent.AttFindInfoRsp.HandleData); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1286: return; case 1287: hciReplies.HciLeExtEvent.AttFindByTypeValueRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_FindByTypeValueRsp(); int num5; if ((num5 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.AttMsgHdr)) == 0 || dataErr) return; if (num5 >= 2) { int length = num5 / 2; hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.Handle = new ushort[length]; for (int index2 = 0; index2 < length && !dataErr; ++index2) { hciReplies.HciLeExtEvent.AttFindByTypeValueRsp.Handle[index2] = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) break; } } if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1288: return; case 1289: hciReplies.HciLeExtEvent.AttReadByTypeRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadByTypeRsp(); int num6; if ((num6 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByTypeRsp.AttMsgHdr)) == 0 || dataErr) return; int dataLength2 = (int)m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; hciReplies.HciLeExtEvent.AttReadByTypeRsp.Length = (byte)dataLength2; int totalLength2 = num6 - 1; if (dataLength2 == 0) return; string handleStr = string.Empty; string valueStr = string.Empty; hciReplies.HciLeExtEvent.AttReadByTypeRsp.HandleData = new List<HCIReplies.HandleData>(); m_deviceUtils.UnloadHandleValueData(rxDataIn.Data, ref index1, totalLength2, dataLength2, ref handleStr, ref valueStr, ref dataErr, "Data", ref hciReplies.HciLeExtEvent.AttReadByTypeRsp.HandleData); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1290: return; case 1291: hciReplies.HciLeExtEvent.AttReadRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadRsp(); int length1; if ((length1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadRsp.AttMsgHdr)) == 0 || dataErr) return; hciReplies.HciLeExtEvent.AttReadRsp.Data = new byte[length1]; for (int index2 = 0; index2 < length1 && !dataErr; ++index2) hciReplies.HciLeExtEvent.AttReadRsp.Data[index2] = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1292: return; case 1293: hciReplies.HciLeExtEvent.AttReadBlobRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadBlobRsp(); int length2 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadBlobRsp.AttMsgHdr); if (dataErr) return; if (length2 > 0) { hciReplies.HciLeExtEvent.AttReadBlobRsp.Data = new byte[length2]; for (int index2 = 0; index2 < length2 && !dataErr; ++index2) hciReplies.HciLeExtEvent.AttReadBlobRsp.Data[index2] = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); } if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1294: return; case 1295: return; case 1296: return; case 1297: hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ReadByGrpTypeRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.AttMsgHdr)) == 0 || dataErr) return; byte num7 = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.Length = num7; if ((int)num7 == 0) return; int dataLength3 = (int)num7; int totalLength3 = (int)rxDataIn.Length - 3 - index1 + 1; hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.HandleData = new List<HCIReplies.HandleHandleData>(); m_deviceUtils.UnloadHandleHandleValueData(rxDataIn.Data, ref index1, totalLength3, dataLength3, ref dataErr, ref hciReplies.HciLeExtEvent.AttReadByGrpTypeRsp.HandleData); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1298: return; case 1299: hciReplies.HciLeExtEvent.AttWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_WriteRsp(); if ((num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttWriteRsp.attMsgHdr)) == 0 || dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1300: return; case 1301: return; case 1302: return; case 1303: hciReplies.HciLeExtEvent.AttPrepareWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_PrepareWriteRsp(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttPrepareWriteRsp.AttMsgHdr); if (dataErr) return; hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Offset = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.AttPrepareWriteRsp.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1304: return; case 1305: hciReplies.HciLeExtEvent.AttExecuteWriteRsp = new HCIReplies.HCI_LE_ExtEvent.ATT_ExecuteWriteRsp(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttExecuteWriteRsp.AttMsgHdr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1306: return; case 1307: hciReplies.HciLeExtEvent.AttHandleValueNotification = new HCIReplies.HCI_LE_ExtEvent.ATT_HandleValueNotification(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttHandleValueNotification.AttMsgHdr); if (dataErr) return; hciReplies.HciLeExtEvent.AttHandleValueNotification.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.AttHandleValueNotification.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1308: return; case 1309: hciReplies.HciLeExtEvent.AttHandleValueIndication = new HCIReplies.HCI_LE_ExtEvent.ATT_HandleValueIndication(); num1 = (int)UnloadAttMsgHeader(ref rxDataIn.Data, ref index1, ref dataErr, ref hciReplies.HciLeExtEvent.AttHandleValueIndication.AttMsgHdr); if (dataErr) return; hciReplies.HciLeExtEvent.AttHandleValueIndication.Handle = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.AttHandleValueIndication.Value = m_deviceUtils.UnloadColonData(rxDataIn.Data, ref index1, rxDataIn.Data.Length - index1, ref dataErr); if (dataErr) return; m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 1310: return; case 1408: return; default: return; } } else { switch (num3) { case 1536: case 1537: case 1538: case 1539: case 1540: case 1541: case 1542: case 1543: case 1544: case 1545: case 1546: case 1547: case 1548: case 1549: case 1550: case 1551: return; case 1663: hciReplies.HciLeExtEvent.GapHciCmdStat = new HCIReplies.HCI_LE_ExtEvent.GAP_HCI_ExtentionCommandStatus(); hciReplies.HciLeExtEvent.GapHciCmdStat.CmdOpCode = m_dataUtils.Unload16Bits(rxDataIn.Data, ref index1, ref dataErr, false); if (dataErr) return; hciReplies.HciLeExtEvent.GapHciCmdStat.DataLength = m_dataUtils.Unload8Bits(rxDataIn.Data, ref index1, ref dataErr); if (dataErr) return; ushort num8 = hciReplies.HciLeExtEvent.GapHciCmdStat.CmdOpCode; if ((uint)num8 <= 64918U) { if ((uint)num8 <= 64658U) { if ((int)num8 == 64650 || (int)num8 == 64658) return; else return; } else { switch (num8) { case 64778: case 64779: case 64780: case 64781: case 64786: case 64787: case 64790: case 64791: case 64792: case 64793: case 64902: case 64912: case 64908: case 64914: case 64918: m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; case 64900: case 64904: case 64906: break; default: return; } } } else if (num8 <= 64962U) { if (num8 != 64946U) return; } else { return; } m_deviceForm.threadMgr.rspDataIn.DataQueue.AddQTail(hciReplies); return; default: return; } } } } catch (Exception ex) { m_msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, "Get Response Data Problem.\n" + ex.Message + "\nRxDataInRspData\n"); } }
private bool FindStopWait(RxDataIn rxDataIn) { bool flag = false; try { if (rxDataIn.RxType == 4) { int index = 0; bool dataErr = false; switch (rxDataIn.CmdOpcode) { case 0xff: byte eventStatus = dataUtils.Unload8Bits(rxDataIn.Data, ref index, ref dataErr); if (!dataErr) { ushort num1 = rxDataIn.EventOpcode; if (num1 <= 1171) { if (num1 <= 1153) { } else if (num1 != 1163) { if (num1 == 1171) break; else break; } else break; } else if (num1 <= 1408) { switch (num1) { case 1281: HCIReplies.ATT_MsgHeader attMsgHdr = new HCIReplies.ATT_MsgHeader(); int num2; if ((num2 = rxDataInRspData.UnloadAttMsgHeader(ref rxDataIn.Data, ref index, ref dataErr, ref attMsgHdr)) == 0) { if (num2 == 0) break; } byte num3 = dataUtils.Unload8Bits(rxDataIn.Data, ref index, ref dataErr); if (!dataErr) { if ((num3 & 0x80) != (int)(byte)(stopWaitEvent.TxOpcode & (HCICmds.HCICmdOpcode)65408) && (num3 & 0x80) != (int)(byte)(stopWaitEvent.ReqEvt & (HCICmds.HCIEvtOpCode)65408)) { if (stopWaitEvent.ReqEvt != HCICmds.HCIEvtOpCode.InvalidEventCode) break; } flag = true; break; } else break; case (ushort)1282: case (ushort)1283: case (ushort)1284: case (ushort)1285: case (ushort)1286: case (ushort)1287: case (ushort)1288: case (ushort)1289: case (ushort)1290: case (ushort)1291: case (ushort)1292: case (ushort)1293: case (ushort)1294: case (ushort)1295: case (ushort)1296: case (ushort)1297: case (ushort)1298: case (ushort)1299: case (ushort)1302: case (ushort)1303: case (ushort)1304: case (ushort)1305: case (ushort)1307: case (ushort)1309: case (ushort)1310: if ((int)rxDataIn.EventOpcode != (int)(ushort)stopWaitEvent.RspEvt1) { if ((int)rxDataIn.EventOpcode != (int)(ushort)stopWaitEvent.RspEvt2) break; } flag = CheckMsgComplete(stopWaitEvent.MsgComp, eventStatus); break; } } else { switch (num1) { case 1663: ushort num4 = dataUtils.Unload16Bits(rxDataIn.Data, ref index, ref dataErr, false); if (!dataErr) { if (num4 == (ushort)stopWaitEvent.TxOpcode) { flag = CheckMsgComplete(stopWaitEvent.ExtCmdStat.MsgComp, eventStatus); break; } else break; } else break; } } } break; } } } catch (Exception ex) { string msg = "Find Stop Wait Problem.\n" + ex.Message + "\nRxDataInThread\n"; msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } return flag; }
private bool ProcessQData(RxDataIn rxDataIn, ref bool dataFound) { bool flag = true; dataFound = false; try { stopWaitMutex.WaitOne(); rxDataInRspData.GetRspData(rxDataIn, stopWaitEvent); if (stopWaitMsg && FindStopWait(rxDataIn) && DeviceTxStopWaitCallback != null) { stopWaitMsg = false; stopWaitEvent = (HCIStopWait.StopWaitEvent)null; DeviceTxStopWaitCallback(true); } rxDataIn.Time = DateTime.Now.ToString("hh:mm:ss.fff"); if (DeviceRxDataCallback != null) DeviceRxDataCallback(rxDataIn); dataFound = true; stopWaitMutex.ReleaseMutex(); } catch (Exception ex) { string msg = "Process Queue Data Problem.\n" + ex.Message + "\nRxDataInThread\n"; msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } return flag; }
public void SendAllEvents(byte[] data, byte length) { bool dataErr = false; RxDataIn rxDataIn = new RxDataIn(); rxDataIn.RxType = 4; rxDataIn.CmdOpcode = byte.MaxValue; rxDataIn.Length = length; rxDataIn.Data = data; msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1024; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1025; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1026; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1027; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1028; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1029; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1030; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1031; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1032; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1033; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1034; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1035; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1036; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1037; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1038; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1039; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1040; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1041; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1042; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1043; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1044; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1153; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1163; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1171; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1281; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1282; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1283; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1284; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1285; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1286; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1287; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1288; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1289; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1290; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1291; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1292; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1293; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1294; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1295; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1295; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1296; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1297; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1298; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1299; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1302; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1303; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1304; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1305; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1307; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1309; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1310; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1536; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1537; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1538; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1539; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1540; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1541; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1542; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1543; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1544; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1545; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1546; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1547; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1548; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1549; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1550; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1551; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.EventOpcode = 1663; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); int index1 = 0; rxDataIn.CmdOpcode = 14; rxDataIn.EventOpcode = 0; dataUtils.Load8Bits(ref data, ref index1, 1, ref dataErr); dataUtils.Load16Bits(ref data, ref index1, 5125, ref dataErr, false); rxDataIn.Data = data; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); int index2 = 0; dataUtils.Load8Bits(ref data, ref index2, 1, ref dataErr); dataUtils.Load16Bits(ref data, ref index2, 8208, ref dataErr, false); rxDataIn.Data = data; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); int index3 = 0; dataUtils.Load8Bits(ref data, ref index3, 1, ref dataErr); dataUtils.Load16Bits(ref data, ref index3, 8209, ref dataErr, false); rxDataIn.Data = data; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); int index4 = 0; dataUtils.Load8Bits(ref data, ref index4, 1, ref dataErr); dataUtils.Load16Bits(ref data, ref index4, 8210, ref dataErr, false); rxDataIn.Data = data; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); int index5 = 0; dataUtils.Load8Bits(ref data, ref index5, 1, ref dataErr); dataUtils.Load16Bits(ref data, ref index5, 8211, ref dataErr, false); rxDataIn.Data = data; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); rxDataIn.CmdOpcode = 19; DisplayRxCmd(rxDataIn, true); msgLogForm.AppendLog(s_delimeter); }
private void DisplayRxCmd(RxDataIn rxDataIn, bool displayBytes) { if (InvokeRequired) { Invoke((Delegate)new DeviceForm.DisplayRxCmdDelegate(DisplayRxCmd), rxDataIn, displayBytes); } else { byte packetType = rxDataIn.RxType; ushort opCode1 = rxDataIn.CmdOpcode; ushort opCode2 = rxDataIn.EventOpcode; byte num1 = rxDataIn.Length; byte[] data1 = rxDataIn.Data; string msg1 = string.Empty; byte[] addr = new byte[6]; string msg2 = (packetType == 4) ? string.Format("-Type\t\t: 0x{0:X2} ({1:S})\n-EventCode\t: 0x{2:X2} ({3:S})\n-Data Length\t: 0x{4:X2} ({5:D}) bytes(s)\n", packetType, devUtils.GetPacketTypeStr(packetType), opCode1, devUtils.GetOpCodeName(opCode1), num1, num1) : string.Format("-Type\t\t: 0x{0:X2} ({1:S})\n-OpCode\t\t: 0x{2:X4} ({3:S})\n-Data Length\t: 0x{4:X2} ({5:D}) bytes(s)\n", packetType, devUtils.GetPacketTypeStr(packetType), opCode1, devUtils.GetOpCodeName(opCode1), num1, num1) ; int index1 = 0; byte bits1 = 0; ushort bits2 = 0; string str2 = string.Empty; bool dataErr = false; switch (opCode1) { case 14: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" Packets\t\t: 0x{0:X2} ({1:D})\n", bits1, bits1); ushort opCode3 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 += string.Format(" Opcode\t\t: 0x{0:X4} ({1:S})\n", opCode3, devUtils.GetOpCodeName(opCode3)); switch (opCode3) { case 5125: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" Status\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetStatusStr(bits1)); dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 += string.Format(" RSSI\t\t: 0x{0:X2} ({1:D})\n", bits1, bits1); } } break; case 8208: case 8209: case 8210: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 += string.Format(" Status\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetStatusStr(bits1)); break; case 64526: case 64527: case 64528: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" Status\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetHCIExtStatusStr(bits1)); } break; default: devUtils.BuildRawDataStr(data1, ref msg2, data1.Length); break; } } } break; case 19: if (num1 == 5) { dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" NumOfHandles\t: 0x{0:X2} ({1:D})\n", bits1, bits1); dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" PktsCompleted\t: 0x{0:X4} ({1:D})\n", bits2, bits2); else break; } else break; } else break; } devUtils.BuildRawDataStr(data1, ref msg2, data1.Length); break; case 0xff: ushort num8 = (ushort)((opCode2 & 0x380) >> 7); byte status = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { string str4 = (num8 != 0) ? devUtils.GetStatusStr(status) : devUtils.GetHCIExtStatusStr(status); msg2 = msg2 + string.Format(" Event\t\t: 0x{0:X4} ({1:S})\n Status\t\t: 0x{2:X2} ({3:S})\n", opCode2, devUtils.GetOpCodeName(opCode2), status, str4); ushort num3 = opCode2; byte num4; if (num3 <= 1171) { if (num3 <= 1153) { switch (num3) { case 1024: case 1025: case 1026: case 1027: case 1028: case 1029: case 1030: case 1031: case 1032: case 1033: case 1034: case 1035: case 1036: case 1037: case 1038: case 1039: case 1040: case 1041: case 1042: case 1043: case 1044: int num5 = (int)dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" Cmd Opcode\t: 0x{0:X4} ({1:S})\n", bits2, devUtils.GetOpCodeName(bits2)); goto label_319; } else goto label_319; case 1153: int num6 = (int)dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { int num7 = (int)dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" RejectReason\t: 0x{0:X4} ({1:S})\n", bits2, devUtils.GetL2CapRejectReasonsStr(bits2)); goto label_319; } else goto label_319; } else goto label_319; } } else if (num3 != 1163) { if (num3 == 1171) { int num7 = (int)dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { int num9 = (int)dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" Result\t\t: 0x{0:X4} ({1:S})\n", bits2, devUtils.GetL2CapConnParamUpdateResultStr(bits2)); break; } else break; } else break; } } else { int num7 = (int)dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" Cmd Opcode\t: 0x{0:X4} ({1:S})\n", bits2, devUtils.GetOpCodeName(bits2)); break; } else break; } } else if (num3 <= 1408) { switch (num3) { case 1281: num4 = 0; if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { byte data2 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" ReqOpcode\t: 0x{0:X2} ({1:S})\n", data2, devUtils.GetHciReqOpCodeStr(data2)); dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { byte errorStatus = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" ErrorCode\t: 0x{0:X2} ({1:S})\n", errorStatus, devUtils.GetShortErrorStatusStr(errorStatus)); msg2 = msg2 + string.Format(" \t\t: {0:S}\n", devUtils.GetErrorStatusStr(errorStatus)); if (devTabsForm.GetSelectedTab() == 1) { if (data2 == 10 || data2 == 8) devTabsForm.SetTbReadStatusText(string.Format("{0:S}", devUtils.GetShortErrorStatusStr(errorStatus))); if (data2 == 18) devTabsForm.SetTbWriteStatusText(string.Format("{0:S}", devUtils.GetShortErrorStatusStr(errorStatus))); } } } } } goto label_319; case 1282: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" ClientRxMTU\t: 0x{0:X4} ({1:D})\n", num7, num7); } goto label_319; case 1283: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" ServerRxMTU\t: 0x{0:X4} ({1:D})\n", num7, num7); } goto label_319; case 1284: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) dspCmdUtils.AddStartEndHandle(data1, ref index1, ref dataErr, ref msg2); goto label_319; case 1285: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Format\t\t: 0x{0:X2} ({1:S})\n", num7, devUtils.GetFindFormatStr(num7)); int uuidLength = devUtils.GetUuidLength(num7, ref dataErr); if (!dataErr) { int dataLength = uuidLength + 2; int totalLength = (int)num1 - index1; msg2 = msg2 + devUtils.UnloadHandleValueData(data1, ref index1, totalLength, dataLength, ref dataErr, "Uuid"); } } } goto label_319; case 1286: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddStartEndHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" Type\t\t: 0x{0:X4} ({1:D})\n", num7, num7); } } goto label_319; case 1287: byte num10 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); if (num10 != 0 && !dataErr) { if (num10 >= 2) { int num7 = num10 / 2; for (uint index2 = 0U; (long)index2 < (long)num7 && !dataErr; ++index2) { ushort num9 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" Handle\t\t: {0:X2}:{1:X2}\n", num9 & 0xFF, num9 >> 8); else break; } } } goto label_319; case 1288: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddStartEndHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" Type\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } goto label_319; case 1289: byte num11 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); if (num11 != 0 && !dataErr) { int dataLength = (int)dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Length\t\t: 0x{0:X2} ({1:D})\n", dataLength, dataLength); int num7 = num11 - 1; if (dataLength != 0) { string handleStr = string.Empty; string valueStr = string.Empty; msg2 = msg2 + devUtils.UnloadHandleValueData(data1, ref index1, num7, dataLength, ref handleStr, ref valueStr, ref dataErr, "Data"); if (!dataErr && devTabsForm.GetSelectedTab() == 1) { devTabsForm.SetTbReadValueTag(valueStr); if (devTabsForm.GetRbASCIIReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(valueStr, SharedAppObjs.StringType.ASCII)); else if (devTabsForm.GetRbDecimalReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(valueStr, SharedAppObjs.StringType.DEC)); else devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(valueStr, SharedAppObjs.StringType.HEX)); if (!string.IsNullOrEmpty(handleStr)) devTabsForm.SetTbReadAttrHandleText(handleStr); } } } } goto label_319; case 1290: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); goto label_319; case 1291: byte num12 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); if (num12 != 0 && !dataErr) { string msg3 = string.Empty; for (uint index2 = 0U; index2 < (uint)num12 && !dataErr; ++index2) { byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); msg3 = msg3 + string.Format("{0:X2} ", num7); } if (!dataErr) { msg3.Trim(); msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", msg3); if (devTabsForm.GetSelectedTab() == 1) { devTabsForm.SetTbReadValueTag(msg3); if (devTabsForm.GetRbASCIIReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg3, SharedAppObjs.StringType.ASCII)); else if (devTabsForm.GetRbDecimalReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg3, SharedAppObjs.StringType.DEC)); else devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg3, SharedAppObjs.StringType.HEX)); } } } goto label_319; case 1292: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) dspCmdUtils.AddHandleOffset(data1, ref index1, ref dataErr, ref msg2); goto label_319; case 1293: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); goto label_319; case 1294: byte num13 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); if (num13 != 0 && !dataErr) { for (byte index2 = 0; index2 < num13 && !dataErr; ++index2) msg1 = msg1 + string.Format("{0:X2} ", dataUtils.Unload8Bits(data1, ref index1, ref dataErr)); if (!dataErr) { msg1.Trim(); msg2 = msg2 + string.Format(" Handles\t\t: {0:S}\n", msg1); } } goto label_319; case 1295: byte num14 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); if (num14 != 0 && !dataErr) { for (byte index2 = 0; index2 < num14 && !dataErr; ++index2) msg1 = msg1 + string.Format("{0:X2} ", dataUtils.Unload8Bits(data1, ref index1, ref dataErr)); if (!dataErr) { msg1.Trim(); msg2 = msg2 + string.Format(" Values\t\t: {0:S}\n", msg1); if (devTabsForm.GetSelectedTab() == 1) { devTabsForm.SetTbReadValueTag(msg1); if (devTabsForm.GetRbASCIIReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg1, SharedAppObjs.StringType.ASCII)); else if (devTabsForm.GetRbDecimalReadChecked()) devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg1, SharedAppObjs.StringType.DEC)); else devTabsForm.SetTbReadValueText(devUtils.HexStr2UserDefinedStr(msg1, SharedAppObjs.StringType.HEX)); } } } goto label_319; case 1296: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddStartEndHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" GroupType\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } goto label_319; case 1297: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Length\t\t: 0x{0:X2} ({1:D})\n", num7, num7); if (num7 != 0) { int dataLength = (int)num7; int totalLength = (int)num1 - 3 - index1 + 1; msg2 = msg2 + string.Format(" DataList\t:\n{0:S}\n", devUtils.UnloadHandleHandleValueData(data1, ref index1, totalLength, dataLength, ref dataErr)); } } } goto label_319; case 1298: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { byte sigAuth = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Signature\t: 0x{0:X2} ({1:S})\n", sigAuth, devUtils.GetSigAuthStr(sigAuth)); byte gapYesNo = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Command\t: 0x{0:X2} ({1:S})\n", gapYesNo, devUtils.GetGapYesNoStr(gapYesNo)); int num7 = (int)dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { msg1.Trim(); msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } } } } goto label_319; case 1299: devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); goto label_319; case 1302: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddHandleOffset(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } goto label_319; case 1303: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddHandleOffset(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } goto label_319; case 1304: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) msg2 = msg2 + string.Format(" Flages\t\t: 0x{0:X2}\n", dataUtils.Unload8Bits(data1, ref index1, ref dataErr)); goto label_319; case 1305: devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); goto label_319; case 1307: if (devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr) != 0 && !dataErr) { dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } goto label_319; case 1309: try { if ((int)(num4 = devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr)) != 0) { if (!dataErr) { dspCmdUtils.AddHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) msg2 = msg2 + string.Format(" Value\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, (int)num1 - 3 - index1 + 1, ref dataErr)); } } } catch (Exception ex) { msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Message Data Conversion Issue.\n\n{0}\n", ex.Message)); DisplayMsg(SharedAppObjs.MsgType.Error, "Could Not Convert All The Data In The Following Message\n(Message Is Missing Data Bytes To Process)\n"); dataErr = true; } goto label_319; case 1310: devUtils.UnloadAttMsgHeader(ref data1, ref index1, ref msg2, ref dataErr); goto label_319; case 1408: dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" PduLen\t\t: 0x{0:X2} ({1:D})\n", bits1, bits1); ushort num9 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" AttrHandle\t: 0x{0:X4} ({1:D})\n", num9, num9); int num15 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" Value\t\t: 0x{0:X2} ({1:D})\n", bits1, bits1); } } } goto label_319; } } else { switch (num3) { case 1536: string deviceBDAddressStr = devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DevAddr\t\t: {0:S}\n", deviceBDAddressStr); OnBDAddressNotify(deviceBDAddressStr); ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" DataPktLen\t: 0x{0:X4} ({1:D})\n", num7, num7); byte num9 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" NumDataPkts\t: 0x{0:X2} ({1:D})\n", num9, num9) + string.Format(" IRK\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr)); if (!dataErr) { msg2 = msg2 + string.Format(" CSRK\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr)); if (!dataErr && !DeviceStarted) { StopTimer(DeviceForm.EventType.Init); devTabsForm.ShowProgress(false); devTabsForm.UserTabAccess(true); DeviceStarted = true; devTabsForm.GetConnectionParameters(); } } } } } goto label_319; case 1537: StopTimer(DeviceForm.EventType.Scan); devTabsForm.ShowProgress(false); if (status != 0 && status != 48) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_DeviceDiscoveryDone Failed.\n{0}\n", str4)); byte num16 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" NumDevs\t: 0x{0:X2} ({1:D})\n", num16, num16); if ((int)num16 > 0) { for (byte index2 = 0; index2 < num16 && !dataErr; ++index2) { string str5 = msg2 + string.Format(" Device #{0:D}\n", index2); byte eventType = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); string str6 = str5 + string.Format(" EventType\t: 0x{0:X2} ({1:S})\n", eventType, devUtils.GetGapEventTypeStr(eventType)); byte addrType = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); msg2 = str6 + string.Format(" AddrType\t: 0x{0:X2} ({1:S})\n", addrType, devUtils.GetGapAddrTypeStr(addrType)) + string.Format(" Addr\t\t: {0:S}\n", devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); DeviceTabsForm.LinkSlave linkSlave; linkSlave.slaveBDA = addr; linkSlave.addrBDA = ""; linkSlave.addrType = (HCICmds.GAP_AddrType)addrType; devTabsForm.AddSlaveDevice(linkSlave); } } } goto label_319; case 1538: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" AdType\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapAdventAdTypeStr(bits1)); goto label_319; case 1539: case 1540: goto label_319; case 1541: StopTimer(DeviceForm.EventType.Establish); devTabsForm.ShowProgress(false); byte addrType1 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DevAddrType\t: 0x{0:X2} ({1:S})\n", addrType1, devUtils.GetGapAddrTypeStr(addrType1)); string str5 = devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DevAddr\t\t: {0:S}\n", str5); ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnHandle\t: 0x{0:X4} ({1:D})\n", num7, num7); if ((int)status == 0) { ConnectInfo tmpConnectInfo = new ConnectInfo(); tmpConnectInfo.Handle = num7; tmpConnectInfo.AddrType = addrType1; tmpConnectInfo.BDA = str5; OnConnectionNotify(ref tmpConnectInfo); devTabsForm.SetConnHandles(tmpConnectInfo.Handle); } ushort num9 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnInterval\t: 0x{0:X4} ({1:D})\n", num9, num9); ushort num15 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnLatency\t: 0x{0:X4} ({1:D})\n", num15, num15); ushort num18 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnTimeout\t: 0x{0:X4} ({1:D})\n", num18, num18); byte num19 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" ClockAccuracy\t: 0x{0:X2} ({1:D})\n", num19, num19); } } } } } } goto label_319; case 1542: ushort num20 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnHandle\t: 0x{0:X4} ({1:D})\n", num20, num20); int num7 = dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" Reason\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapTerminationReasonStr(bits1)); if (status == 0) { ConnectInfo connectInfo = new ConnectInfo() { Handle = num20, BDA = "00:00:00:00:00:00", AddrType = 0 }; OnDisconnectionNotify(ref connectInfo); devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.NotConnected); } } } goto label_319; case 1543: dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { ushort num7 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnInterval\t: 0x{0:X4} ({1:D})\n", num7, num7); ushort num9 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ConnLatency\t: 0x{0:X4} ({1:D})\n", num9, num9); ushort num15 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" ConnTimeout\t: 0x{0:X4} ({1:D})\n", num15, num15); } } } goto label_319; case 1544: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" AddrType\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapAddrTypeStr(bits1)) + string.Format(" NewRandAddr\t: {0:S}\n", devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); goto label_319; case 1545: dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" AddrType\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapAddrTypeStr(bits1)) + string.Format(" DevAddr\t\t: {0:S}\n", devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); if (!dataErr) { uint num7 = dataUtils.Unload32Bits(data1, ref index1, ref dataErr, false); if (!dataErr) msg2 = msg2 + string.Format(" SignCounter\t: 0x{0:X8} ({1:D})\n", num7, num7); } } goto label_319; case 1546: HCICmds.GAPEvts.GAP_AuthenticationComplete authenticationComplete = new HCICmds.GAPEvts.GAP_AuthenticationComplete(); dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { authenticationComplete.connHandle = bits2; byte authReq = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" AuthState\t: 0x{0:X2} ({1:S})\n", authReq,devUtils.GetGapAuthReqStr(authReq)); authenticationComplete.authState = authReq; byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SecInf.Enable\t: 0x{0:X2} ({1:D})\n",num7,num7); authenticationComplete.secInfo_enable = (HCICmds.GAP_EnableDisable)num7; byte num9 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SecInf.LTKSize\t: 0x{0:X2} ({1:D})\n",num9,num9); authenticationComplete.secInfo_LTKsize = num9; string str5 = devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SecInf.LTK\t: {0:S}\n",str5); authenticationComplete.secInfo_LTK = str5; ushort num15 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" SecInf.DIV\t: 0x{0:X4} ({1:D})\n",num15,num15); authenticationComplete.secInfo_DIV = num15; string str6 = devUtils.UnloadColonData(data1, ref index1, 8, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SecInf.Rand\t: {0:S}\n",str6); authenticationComplete.secInfo_RAND = str6; byte num18 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DSInf.Enable\t: 0x{0:X2} ({1:D})\n",num18,num18); authenticationComplete.devSecInfo_enable = (HCICmds.GAP_EnableDisable)num18; byte num19 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DSInf.LTKSize\t: 0x{0:X2} ({1:D})\n",num19,num19); authenticationComplete.devSecInfo_LTKsize = num19; string str7 = devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DSInf.LTK\t: {0:S}\n",str7); authenticationComplete.devSecInfo_LTK = str7; ushort num23 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" DSInf.DIV\t: 0x{0:X4} ({1:D})\n",num23,num23); authenticationComplete.devSecInfo_DIV = num23; string str8 = devUtils.UnloadColonData(data1, ref index1, 8, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DSInf.Rand\t: {0:S}\n",str8); authenticationComplete.devSecInfo_RAND = str8; byte num24 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" IdInfo.Enable\t: 0x{0:X2} ({1:D})\n",num24,num24); authenticationComplete.idInfo_enable = (HCICmds.GAP_EnableDisable)num24; string str9 = devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" IdInfo.IRK\t: {0:S}\n",str9); authenticationComplete.idInfo_IRK = str9; string str10 = devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" IdInfo.BD_Addr\t: {0:S}\n",str10); authenticationComplete.idInfo_BdAddr = str10; byte num25 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SignInfo.Enable\t: 0x{0:X2} ({1:D})\n",num25,num25); authenticationComplete.signInfo_enable = (HCICmds.GAP_EnableDisable)num25; string str11 = devUtils.UnloadColonData(data1, ref index1, 16, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" SignInfo.CSRK\t: {0:S}\n",str11); authenticationComplete.signInfo_CSRK = str11; uint num26 = dataUtils.Unload32Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" SignCounter\t: 0x{0:X8} ({1:D})\n",num26,num26); authenticationComplete.signCounter = num26; if (devTabsForm.GetSelectedTab() == 2) { StopTimer(DeviceForm.EventType.PairBond); devTabsForm.ShowProgress(false); if (status == 23) { devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.NotPaired); goto label_319; } else if (status == 4) { devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.PasskeyIncorrect); goto label_319; } else if (status == 0) { byte num27 = 1; if (((int)authenticationComplete.authState & (int)num27) == (int)num27) devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.DevicesPairedBonded); else devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.DevicesPaired); byte num28 = 4; if (((int)authenticationComplete.authState & (int)num28) == (int)num28) devTabsForm.SetAuthenticatedBond(true); else devTabsForm.SetAuthenticatedBond(false); devTabsForm.SetGapAuthCompleteInfo(authenticationComplete); } } } } } } } } } } } } } } } } } } } } goto label_319; case 1547: msg2 = msg2 + string.Format(" DevAddr\t\t: {0:S}\n",devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); if (!dataErr) { dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { int num7 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" UiInput\t\t: 0x{0:X2} ({1:S})\n",bits1,devUtils.GetGapUiInputStr(bits1)); if (devTabsForm.GetSelectedTab() == 2 && (int)bits1 == 1) devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.PasskeyNeeded); int num9 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" UiOutput\t\t: 0x{0:X2} ({1:S})\n",bits1,devUtils.GetGapUiOutputStr(bits1)); if (devTabsForm.GetSelectedTab() == 2) { StopTimer(DeviceForm.EventType.PairBond); devTabsForm.ShowProgress(false); devTabsForm.UsePasskeySecurity((HCICmds.GAP_UiOutput)bits1); } } } } } goto label_319; case 1548: dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { msg2 += string.Format(" DevAddr\t\t: {0:S}\n", devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); if (!dataErr) { int num7 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" AuthReq\t\t: 0x{0:X2} ({1:D})\n", bits1, bits1); } } goto label_319; case 1549: byte eventType1 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 += string.Format(" EventType\t: 0x{0:X2} ({1:S})\n", eventType1, devUtils.GetGapEventTypeStr(eventType1)); byte addrType2 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" AddrType\t: 0x{0:X2} ({1:S})\n", addrType2, devUtils.GetGapAddrTypeStr(addrType2)) + string.Format(" Addr\t\t: {0:S}\n",devUtils.UnloadDeviceAddr(data1, ref addr, ref index1, false, ref dataErr)); if (!dataErr) { byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 += string.Format(" Rssi\t\t: 0x{0:X2} ({1:D})\n", num7, num7); byte num9 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" DataLength\t: 0x{0:X2} ({1:D})\n", num9, num9); if (num9 != 0) { msg2 = msg2 + string.Format(" Data\t\t: {0:S}\n", devUtils.UnloadColonData(data1, ref index1, num9, ref dataErr)); if (!dataErr && (eventType1 == 0 || eventType1 == 4)) { DeviceTabsForm.LinkSlave linkSlave; linkSlave.slaveBDA = addr; linkSlave.addrBDA = ""; linkSlave.addrType = (HCICmds.GAP_AddrType)addrType2; devTabsForm.AddSlaveDevice(linkSlave); } } } } } } } goto label_319; case 1550: dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr && devTabsForm.GetSelectedTab() == 2) { StopTimer(DeviceForm.EventType.PairBond); devTabsForm.ShowProgress(false); if (status == 0) { devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.DevicesPairedBonded); } else { devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.NotPaired); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_BondComplete: Failed.\n{0}\n", str4)); } devTabsForm.PairBondUserInputControl(); } goto label_319; case 1551: dspCmdUtils.AddConnectHandle(data1, ref index1, ref dataErr, ref msg2); if (!dataErr) { dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" IOCap\t\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapIOCapsStr(bits1)); int num9 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" OobDataFlag\t: 0x{0:X2} ({1:S})\n", bits1, devUtils.GetGapOobDataFlagStr(bits1)); int num15 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) { msg2 += string.Format(" AuthReq\t\t: 0x{0:X2} ({1:S})\n",bits1,devUtils.GetGapAuthReqStr(bits1)); bits1 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 = msg2 + string.Format(" MaxEncKeySiz\t: 0x{0:X4} ({1:D})\n",bits1,bits1); int num18 = (int)dataUtils.Unload8Bits(data1, ref index1, ref bits1, ref dataErr); if (!dataErr) msg2 = msg2 + string.Format(" KeyDist\t\t: 0x{0:X2} ({1:S})\n",bits1,devUtils.GetGapKeyDiskStr(bits1)); } } } } } goto label_319; case 1663: ushort opCode3 = dataUtils.Unload16Bits(data1, ref index1, ref dataErr, false); if (!dataErr) { msg2 += string.Format(" OpCode\t\t: 0x{0:X4} ({1:S})\n", opCode3, devUtils.GetOpCodeName(opCode3)); byte num7 = dataUtils.Unload8Bits(data1, ref index1, ref dataErr); if (!dataErr) { msg2 += string.Format(" DataLength\t: 0x{0:X2} ({1:D})\n", num7, num7); ushort num9 = opCode3; if (num9 <= 64918U) { if (num9 <= 64658U) { if (num9 == 64650 || num9 == 64658) goto label_319; } else { switch (num9) { case 64769: case 64770: case 64771: case 64772: case 64773: case 64774: case 64775: case 64776: case 64777: case 64778: case 64779: case 64780: case 64781: case 64782: case 64783: case 64784: case 64785: case 64786: case 64787: case 64790: case 64791: case 64792: case 64793: case 64795: case 64797: case 64798: case 64898: case 64900: case 64902: case 64908: case 64912: case 64918: goto label_319; case 64904: if (devTabsForm.GetTbReadStatusText() == "Reading...") devTabsForm.SetTbReadStatusText(string.Format("{0:S}",devUtils.GetStatusStr(status))); goto label_319; case 64906: if (devTabsForm.GetTbReadStatusText() == "Reading...") devTabsForm.SetTbReadStatusText(string.Format("{0:S}",devUtils.GetStatusStr(status))); goto label_319; case 64910: if (devTabsForm.GetTbReadStatusText() == "Reading...") devTabsForm.SetTbReadStatusText(string.Format("{0:S}",devUtils.GetStatusStr(status))); goto label_319; case 64914: if (devTabsForm.GetTbWriteStatusText() == "Writing...") devTabsForm.SetTbWriteStatusText(string.Format("{0:S}",devUtils.GetStatusStr(status))); goto label_319; } } } else if ((uint)num9 <= 64962U) { switch (num9) { case 64923: case 64925: case 64944: case 64946: case 64950: case 64952: case 64954: case 64956: case 64958: case 64960: case 64962: goto label_319; case 64948: if (devTabsForm.GetTbReadStatusText() == "Reading...") devTabsForm.SetTbReadStatusText(string.Format("{0:S}",devUtils.GetStatusStr(status))); goto label_319; } } else { switch (num9) { case 65020: case 65021: case 65022: case 65024: case 65027: case 65030: case 65031: case 65032: case 65036: case 65037: case 65038: case 65040: case 65041: case 65074: case 65075: case 65076: case 65077: case 65078: case 65079: case 65152: case 65154: case 65155: goto label_319; case 65028: if ((int)status != 0) { msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_DeviceDiscoveryRequest Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); } goto label_319; case 65029: if (status != 0) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_DeviceDiscoveryCancel Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); goto label_319; case 65033: StopTimer(DeviceForm.EventType.Establish); devTabsForm.ShowProgress(false); if (status != 0) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_EstablishLinkRequest Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); goto label_319; case 65034: if (status != 0) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_TerminateLinkRequest Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); goto label_319; case 65035: if (status != 0) { StopTimer(DeviceForm.EventType.PairBond); devTabsForm.ShowProgress(false); Cursor = Cursors.Default; devTabsForm.TabPairBondInitValues(); devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.NotPaired); devTabsForm.PairBondUserInputControl(); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP Authenticate Failed.\n{0}\n",str4)); } goto label_319; case 65039: if (devTabsForm.GetSelectedTab() == 2 && (int)status != 0) { StopTimer(DeviceForm.EventType.PairBond); devTabsForm.ShowProgress(false); devTabsForm.SetPairingStatus(DeviceTabsForm.PairingStatus.NotPaired); devTabsForm.PairBondUserInputControl(); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_Bond: Failed.\n{0}\n",str4)); } goto label_319; case 65072: if (status != 0) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_SetParam: Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); goto label_319; case 65073: if (status != 0) msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("GAP_GetParam: Failed.\n{0}\n", str4)); devTabsForm.discoverConnectStatus = DeviceTabsForm.DiscoverConnectStatus.Idle; devTabsForm.DiscoverConnectUserInputControl(); if (num7 != 0) { int num15 = (int)dataUtils.Unload16Bits(data1, ref index1, ref bits2, ref dataErr, false); if (!dataErr) { msg2 = msg2 + string.Format(" ParamValue\t: 0x{0:X4} ({1:D})\n",bits2,bits2); switch (ConnParamState) { case DeviceForm.GAPGetConnectionParams.MinConnIntSeq: devTabsForm.SetMinConnectionInterval((uint)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.MaxConnIntSeq; break; case DeviceForm.GAPGetConnectionParams.MaxConnIntSeq: devTabsForm.SetMaxConnectionInterval((uint)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.SlaveLatencySeq; break; case DeviceForm.GAPGetConnectionParams.SlaveLatencySeq: devTabsForm.SetSlaveLatency((uint)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.SupervisionTimeoutSeq; break; case DeviceForm.GAPGetConnectionParams.SupervisionTimeoutSeq: devTabsForm.SetSupervisionTimeout((uint)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.None; break; case DeviceForm.GAPGetConnectionParams.MinConnIntSingle: devTabsForm.SetNudMinConnIntValue((int)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.None; break; case DeviceForm.GAPGetConnectionParams.MaxConnIntSingle: devTabsForm.SetNudMaxConnIntValue((int)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.None; break; case DeviceForm.GAPGetConnectionParams.SlaveLatencySingle: devTabsForm.SetNudSlaveLatencyValue((int)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.None; break; case DeviceForm.GAPGetConnectionParams.SupervisionTimeoutSingle: devTabsForm.SetNudSprVisionTimeoutValue((int)bits2); ConnParamState = DeviceForm.GAPGetConnectionParams.None; break; default: break; } } } goto label_319; case 65153: if (num7 != 0) msg2 = msg2 + string.Format(" nvData\t\t: {0:S}\n",devUtils.UnloadColonData(data1, ref index1, (int)num7, ref dataErr)); goto label_319; } } devUtils.BuildRawDataStr(data1, ref msg2, data1.Length); } } goto label_319; } } devUtils.BuildRawDataStr(data1, ref msg2, data1.Length); } break; default: devUtils.BuildRawDataStr(data1, ref msg2, data1.Length); break; } label_319: if (dataErr) DisplayMsg(SharedAppObjs.MsgType.Error, "Could Not Convert All The Data In The Following Message\n(Message Is Missing Data Bytes To Process)\n"); DisplayMsgTime(SharedAppObjs.MsgType.Incoming, msg2, rxDataIn.Time); if (displayBytes) { string msg4 = string.Format("{0:X2} {1:X2} {2:X2} ", packetType, (opCode1 & 0xFF), num1); if (opCode1 == 19 || opCode1 == 0xFF) msg4 = string.Format("{0:X2} {1:X2} {2:X2} {3:X2} {4:X2} ", packetType, (opCode1 & 0xFF), num1, (opCode2 & 0xFF), ((opCode2 >> 8) & 0xFF)); byte num29 = 5; foreach (byte num3 in data1) { msg4 = msg4 + string.Format("{0:X2} ", num3); devUtils.CheckLineLength(ref msg4, num29++, false); } DisplayMsg(SharedAppObjs.MsgType.RxDump, msg4); } } }
private void DeviceRxData(RxDataIn rxDataIn) { if (InvokeRequired) { try { BeginInvoke((Delegate)new DeviceForm.DeviceRxDataDelegate(DeviceRxData), rxDataIn); } catch { } } else { if (formClosing) return; threadMgr.rxTxMgr.dataQ.AddQTail((object)new RxTxMgrData() { rxDataIn = rxDataIn, txDataOut = null }); } }