All BLE Quiet tests pass!
This commit is contained in:
parent
871001f60b
commit
34e53acbf6
4 changed files with 33 additions and 4 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 6a3f12819c7b26f73cbf471e28c93ba610040ed4
|
||||
Subproject commit e0e7fdf1aef151390c1e82d95e89e39038206bca
|
|
@ -30,6 +30,7 @@ static bool State_Changed = false;
|
|||
static TickType_t Time_At_State_Entry_In_Ticks;
|
||||
static bool Is_Quiet = false;
|
||||
static bool Was_Advertising = false;
|
||||
static BLE_AdvertisingData_T Cached_Advertising_Data;
|
||||
|
||||
static TimerHandle_t BLEUnquietTimer = NULL;
|
||||
static StaticTimer_t xBLEUnquietTimerBuffer;
|
||||
|
@ -610,7 +611,7 @@ SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T * data)
|
|||
memcpy(Advertising_Data.advData, data, BLE_KTAG_PACKET_TOTAL_SIZE);
|
||||
|
||||
#ifdef TRACE_BLE
|
||||
KLOG_TRACE(TAG, "Setting advertising data for packet type %u", data->data[8]);
|
||||
KLOG_TRACE(TAG, "Setting advertising data for packet type %u.", data->data[8]);
|
||||
#endif // TRACE_BLE
|
||||
|
||||
cy_en_ble_api_result_t result = Cy_BLE_GAPP_UpdateAdvScanData(&Advertising_Info);
|
||||
|
@ -625,6 +626,10 @@ SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T * data)
|
|||
vTaskDelay(100);
|
||||
#endif // TRACE_BLE
|
||||
}
|
||||
|
||||
// Save a copy for later.
|
||||
Cached_Advertising_Data.length = BLE_KTAG_PACKET_TOTAL_SIZE;
|
||||
memcpy(&Cached_Advertising_Data, data, BLE_KTAG_PACKET_TOTAL_SIZE);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -983,6 +988,30 @@ static void BLE_EventHandler(uint32_t event, void * eventParam)
|
|||
COMM_Console_Print_String("\n");
|
||||
#endif // TRACE_BLE
|
||||
|
||||
// Restore the previous;y set advertising packet.
|
||||
if (Cy_BLE_GetAdvertisementState() == CY_BLE_ADV_STATE_ADVERTISING)
|
||||
{
|
||||
Advertising_Data.advDataLen = BLE_KTAG_PACKET_TOTAL_SIZE;
|
||||
memcpy(Advertising_Data.advData, &Cached_Advertising_Data, BLE_KTAG_PACKET_TOTAL_SIZE);
|
||||
|
||||
#ifdef TRACE_BLE
|
||||
KLOG_TRACE(TAG, "Setting advertising data from cached copy for packet type %u.", Cached_Advertising_Data.data[8]);
|
||||
#endif // TRACE_BLE
|
||||
|
||||
cy_en_ble_api_result_t result = Cy_BLE_GAPP_UpdateAdvScanData(&Advertising_Info);
|
||||
|
||||
if (result != CY_BLE_SUCCESS)
|
||||
{
|
||||
#ifdef TRACE_BLE
|
||||
COMM_Console_Print_String("[BLE] Cy_BLE_GAPP_UpdateAdvScanData Error: 0x");
|
||||
COMM_Console_Print_UInt32AsHex(result);
|
||||
COMM_Console_Print_String("\n");
|
||||
|
||||
vTaskDelay(100);
|
||||
#endif // TRACE_BLE
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (Cy_BLE_GetAdvertisementState() == CY_BLE_ADV_STATE_STOPPED)
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6a3f12819c7b26f73cbf471e28c93ba610040ed4
|
||||
Subproject commit e0e7fdf1aef151390c1e82d95e89e39038206bca
|
Loading…
Add table
Add a link
Reference in a new issue