BTool.ExtCmdStatus.GetExtensionCommandStatus C# (CSharp) Method

GetExtensionCommandStatus() public method

public GetExtensionCommandStatus ( HCIReplies hciReplies, bool &dataFound ) : bool
hciReplies HCIReplies
dataFound bool
return bool
        public bool GetExtensionCommandStatus(HCIReplies hciReplies, ref bool dataFound)
        {
            dataFound = false;
            bool flag = rspHdlrsUtils.CheckValidResponse(hciReplies);
            if (flag)
            {
                HCIReplies.HCI_LE_ExtEvent hciLeExtEvent = hciReplies.HciLeExtEvent;
                HCIReplies.HCI_LE_ExtEvent.GAP_HCI_ExtentionCommandStatus extentionCommandStatus = hciLeExtEvent.GapHciCmdStat;
                HCIReplies.LE_ExtEventHeader leExtEventHeader = hciLeExtEvent.Header;
                if (extentionCommandStatus != null)
                {
                    dataFound = true;
                    if (leExtEventHeader.EventStatus == 0)
                    {
                        dataFound = true;
                        flag = true;
                    }
                    else
                    {
                        ushort opCode = extentionCommandStatus.CmdOpCode;
                        if (opCode <= 64908U)
                        {
                            #region
                            switch (opCode)
                            {
                                case 64769:
                                case 64772:
                                case 64773:
                                case 64774:
                                case 64775:
                                case 64776:
                                case 64777:
                                case 64778:
                                case 64779:
                                case 64780:
                                case 64781:
                                case 64784:
                                case 64785:
                                case 64786:
                                case 64787:
                                case 64790:
                                case 64791:
                                case 64792:
                                case 64793:
                                case 64900:
                                case 64902:
                                case 64904:
                                case 64906:
                                case 64908:
                                    break;
                                default:
                                    goto label_8;
                            }
                            #endregion
                        }
                        else
                        {
                            #region
                            switch (opCode)
                            {
                                case 64912:
                                case 64914:
                                case 64918:
                                case 64946:
                                    break;
                                default:
                                    goto label_8;
                            }
                            #endregion
                        }
                        SendRspCallback(hciReplies, true);
                        goto label_9;

                    label_8:
                        flag = rspHdlrsUtils.UnexpectedRspEventStatus(hciReplies, "ExtCmdStatus");
                    }
                }
            }

            label_9:
            if (!flag && dataFound)
                SendRspCallback(hciReplies, false);
            return flag;
        }

Usage Example

Esempio n. 1
0
        private bool ProcessQData(HCIReplies hciReplies, ref bool dataFound)
        {
            bool success = true;

            dataFound = false;
            if (hciReplies == null || hciReplies.HciLeExtEvent == null)
            {
                return(false);
            }
            switch (hciReplies.HciLeExtEvent.Header.EventCode)
            {
            case 1281:
                success = AttErrorRsp.GetATT_ErrorRsp(hciReplies, ref dataFound);
                break;

            case 1285:
                success = m_attFindInfoRsp.GetATT_FindInfoRsp(hciReplies, ref dataFound);
                break;

            case 1287:
                success = m_attFindByTypeValueRsp.GetATT_FindByTypeValueRsp(hciReplies, ref dataFound);
                break;

            case 1289:
                success = m_attReadByTypeRsp.GetATT_ReadByTypeRsp(hciReplies, ref dataFound);
                break;

            case 1291:
                success = AttReadRsp.GetATT_ReadRsp(hciReplies, ref dataFound);
                break;

            case 1293:
                success = AttReadBlobRsp.GetATT_ReadBlobRsp(hciReplies, ref dataFound);
                break;

            case 1297:
                success = m_attReadByGrpTypeRsp.GetATT_ReadByGrpTypeRsp(hciReplies, ref dataFound);
                break;

            case 1299:
                success = AttWriteRsp.GetATT_WriteRsp(hciReplies, ref dataFound);
                break;

            case 1303:
                success = AttPrepareWriteRsp.GetATT_PrepareWriteRsp(hciReplies, ref dataFound);
                break;

            case 1305:
                success = AttExecuteWriteRsp.GetATT_ExecuteWriteRsp(hciReplies, ref dataFound);
                break;

            case 1307:
                success = AttHandleValueNotification.GetATT_HandleValueNotification(hciReplies, ref dataFound);
                break;

            case 1309:
                success = AttHandleValueIndication.GetATT_HandleValueIndication(hciReplies, ref dataFound);
                break;

            case 1663:
                success = ExtCmdStatus.GetExtensionCommandStatus(hciReplies, ref dataFound);
                break;
            }
            return(success);
        }