U8 meUtilWriteEirBLEServiceList(U8 *buf, U8 bufLen) { U8 offset = 0, recNum = 0, index; U8 uuid_list[MAX_EIR_SDP_SIZE * 2], len = 0; if (bufLen >= 4) { for (index = 0; index < MAX_EIR_SDP_SIZE; index++) { if (MEC(eirSdpCtx)[index].used != 0) { OS_Report("UUID=0x%x",MEC(eirSdpCtx)[index].service_class); if(SdpIsBLEService(MEC(eirSdpCtx)[index].service_class)) { recNum++; StoreLE16(&uuid_list[len], MEC(eirSdpCtx)[index].service_class); len += 2; } } } if (recNum) { if (len + 2 > bufLen) { /* EIR UUID is not completed */ len = bufLen - 2; recNum = len / 2; buf[1] = BT_EIR_SERVICE_CLASS_16UUID_MORE; } else { /* EIR UUID is completed */ buf[1] = BT_EIR_SERVICE_CLASS_16UUID_COMPLETE; } bt_trace(TRACE_GROUP_1, BTLOG_EIRRECORDNUMxD, recNum); buf[0] = len + 1; offset += 2; OS_MemCopy(buf + offset, uuid_list, len); offset += len; } } Assert (offset <= bufLen); return offset; }
/***************************************************************************** * FUNCTION * SM_SendMasterIdentity * DESCRIPTION * Send SMP pairing identity information * PARAMETERS * remDev [IN] * ediv [IN] * rand [IN] * RETURNS * BtStatus *****************************************************************************/ BtStatus SM_SendMasterIdentity(BtRemoteDevice *remDev, U16 ediv, U64 rand) { int i = 0; BtPacket *packet = SM_AllocCmdPkt(); Assert(remDev != NULL); bt_trace(TRACE_FUNC, BT_SMP_SM_SENMASTERIDENTITY, ediv, rand); packet->data[i++] = SMC_MASTER_IDEN; StoreLE16(packet->data + i, ediv); i += SM_EDIV_VALUE_LENGTH; Report(("UPF Debug ediv Send to Remote Side:%04x", ediv)); StoreLE64(packet->data + i, rand); Report(("UPF Debug rand Send to Remote Side LSB->MSB:%02x,%02x,%02x,02x,%02x,%02x,%02x,%02x", packet->data[i],packet->data[i+1], packet->data[i+2],packet->data[i+3],packet->data[i+4],packet->data[i+5],packet->data[i+6],packet->data[i+7])); i += SM_RAND_VALUE_LENGTH; packet->dataLen = i; SM_ResetTimer(remDev); return SM_SendL2capData(remDev, packet); }