Exemplo n.º 1
0
 public byte UnloadAttMsgHeader(ref byte[] data, ref int index, ref bool dataErr, ref HCIReplies.ATT_MsgHeader attMsgHdr)
 {
     attMsgHdr.ConnHandle = 0;
     attMsgHdr.PduLength  = 0;
     try
     {
         attMsgHdr.ConnHandle = m_dataUtils.Unload16Bits(data, ref index, ref dataErr, false);
         attMsgHdr.PduLength  = m_dataUtils.Unload8Bits(data, ref index, ref dataErr);
     }
     catch (Exception ex)
     {
         m_msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("UnloadAttMsgHeader Failed\nMessage Data Transfer Issue.\n\n{0}\n", ex.Message));
         dataErr = true;
     }
     return(attMsgHdr.PduLength);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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;
 }