Part Number: LAUNCHXL-CC2640R2
I am using simplelink sdk 1_40_00_45 simple central example on LAUNCHXL-CC2640R2.And want to read rssi as per user (my master) command.I have implemented all the related logic, as after scanning I have store the result & send it to user after that i have clear the result.whenever user again want rssi data new result should load.All this is working fine only if user demand data after 6sec of time interval.I want to workout it for even 1 sec of time period.when i am trying to read data after 1 sec it shows wrong result. Is there any setting for fast reading so that i can get updated result after every 1 sec.
I have done the following changes:
- After discovery completed again call StartGapDiscovery();
- result load in SimpleBLECentral_addDeviceInfo1().
static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent)
{
switch (pEvent->gap.opcode)
{
case GAP_DEVICE_INIT_DONE_EVENT:
{
//maxPduSize = pEvent->initDone.dataPktLen;
}
break;
case GAP_DEVICE_INFO_EVENT:
{
SimpleBLECentral_addDeviceInfo1(pEvent->deviceInfo.addr,pEvent->deviceInfo.addrType,pEvent->deviceInfo.rssi);
}
break;
case GAP_DEVICE_DISCOVERY_EVENT:
{
if (gapPendingCancelScan)
{
gapPendingCancelScan = false;
break;
}
// discovery complete
scanningStarted = FALSE;
SimpleBLECentral_startGapDiscovery();
scanRes = pEvent->discCmpl.numDevs;
}
break;
default:
break;
}
}
static void SimpleBLECentral_addDeviceInfo1(uint8_t *pAddr, uint8_t addrType, int8 rssi)
{
uint8_t i;
// If result count not at max
if (scanRes < DEFAULT_MAX_SCAN_RES)
{
Display_print1(dispHandle, 20, 0, "Devices Found %d", scanRes);
if(scanIdx >= scanRes)
scanIdx = 0;
else
scanIdx++;
// Check if device is already in scan results
for (i = 0; i < scanRes; i++)
{
if (memcmp(pAddr, devList[i].addr , B_ADDR_LEN) == 0)
{
return;
}
}
// Add addr to scan result list
memcpy(devList[scanIdx].addr, pAddr, B_ADDR_LEN);
devList[scanIdx].addrType = addrType;
rssiList[scanIdx].rssi = rssi;
// Increment scan result count
//scanRes++;
}
}
