public GetATT_ReadRsp ( |
||
hciReplies | ||
dataFound | bool | |
return | bool |
public bool GetATT_ReadRsp(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.ATT_ReadRsp attReadRsp = hciLeExtEvent.AttReadRsp;
HCIReplies.LE_ExtEventHeader leExtEventHeader = hciLeExtEvent.Header;
if (attReadRsp != null)
{
dataFound = true;
switch (leExtEventHeader.EventStatus)
{
case 0:
if (attReadRsp.Data != null && hciReplies.ObjTag != null)
{
ushort handle = (ushort)hciReplies.ObjTag;
Dictionary<string, DataAttr> tmpAttrDict = new Dictionary<string, DataAttr>();
string attrKey = attrUuidUtils.GetAttrKey(attReadRsp.AttMsgHdr.ConnHandle, handle);
DataAttr dataAttr = new DataAttr();
bool dataChanged = false;
if (!attrDataUtils.GetDataAttr(ref dataAttr, ref dataChanged, attrKey, "AttReadRsp"))
{
flag = false;
break;
}
dataAttr.Key = attrKey;
dataAttr.ConnHandle = attReadRsp.AttMsgHdr.ConnHandle;
dataAttr.Handle = handle;
dataAttr.Value = devUtils.UnloadColonData(attReadRsp.Data, false);
if (!attrDataUtils.UpdateTmpAttrDict(ref tmpAttrDict, dataAttr, dataChanged, attrKey))
flag = false;
else if (!attrDataUtils.UpdateAttrDict(tmpAttrDict))
flag = false;
else
SendRspCallback(hciReplies, true);
}
break;
case 23:
case 26:
SendRspCallback(hciReplies, true);
break;
default:
flag = rspHdlrsUtils.UnexpectedRspEventStatus(hciReplies, "AttReadRsp");
break;
}
}
}
if (!flag && dataFound)
SendRspCallback(hciReplies, false);
return flag;
}
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); }