BTool.AttFindByTypeValueRsp.GetATT_FindByTypeValueRsp C# (CSharp) Method

GetATT_FindByTypeValueRsp() public method

public GetATT_FindByTypeValueRsp ( HCIReplies hciReplies, bool &dataFound ) : bool
hciReplies HCIReplies
dataFound bool
return bool
        public bool GetATT_FindByTypeValueRsp(HCIReplies hciReplies, ref bool dataFound)
        {
            dataFound = false;
            bool flag;
            if (flag = rspHdlrsUtils.CheckValidResponse(hciReplies))
            {
                HCIReplies.HCI_LE_ExtEvent hciLeExtEvent = hciReplies.HciLeExtEvent;
                HCIReplies.HCI_LE_ExtEvent.ATT_FindByTypeValueRsp findByTypeValueRsp = hciLeExtEvent.AttFindByTypeValueRsp;
                HCIReplies.LE_ExtEventHeader leExtEventHeader = hciLeExtEvent.Header;
                if (findByTypeValueRsp != null)
                {
                    dataFound = true;
                    switch (leExtEventHeader.EventStatus)
                    {
                        case (byte)0:
                            if (findByTypeValueRsp.Handle != null)
                            {
                                Dictionary<string, DataAttr> tmpAttrDict = new Dictionary<string, DataAttr>();
                                foreach (ushort handle in findByTypeValueRsp.Handle)
                                {
                                    string attrKey = attrUuidUtils.GetAttrKey(findByTypeValueRsp.AttMsgHdr.ConnHandle, handle);
                                    DataAttr dataAttr = new DataAttr();
                                    bool dataChanged = false;
                                    if (!attrDataUtils.GetDataAttr(ref dataAttr, ref dataChanged, attrKey, "AttFindByTypeValueRsp"))
                                    {
                                        flag = false;
                                        break;
                                    }
                                    else
                                    {
                                        dataAttr.Key = attrKey;
                                        dataAttr.ConnHandle = findByTypeValueRsp.AttMsgHdr.ConnHandle;
                                        dataAttr.Handle = handle;
                                        if (!attrDataUtils.UpdateTmpAttrDict(ref tmpAttrDict, dataAttr, dataChanged, attrKey))
                                        {
                                            flag = false;
                                            break;
                                        }
                                    }
                                }
                                if (!attrDataUtils.UpdateAttrDict(tmpAttrDict))
                                {
                                    flag = false;
                                    break;
                                }
                                else
                                    break;
                            }
                            else
                                break;
                        case (byte)23:
                        case (byte)26:
                            SendRspCallback(hciReplies, true);
                            break;
                        default:
                            flag = rspHdlrsUtils.UnexpectedRspEventStatus(hciReplies, "AttFindByTypeValueRsp");
                            break;
                    }
                }
            }
            if (!flag && dataFound)
                SendRspCallback(hciReplies, false);
            return flag;
        }

Usage Example

Exemplo 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);
        }