Fixed the Hello packet hack needed for PSoC6.
This commit is contained in:
parent
e81336cec8
commit
871001f60b
3 changed files with 32 additions and 3 deletions
|
@ -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 88c81dc405ef5d10fcf67d80d349bc1a7924e6f9
|
||||
Subproject commit 6a3f12819c7b26f73cbf471e28c93ba610040ed4
|
|
@ -1 +1 @@
|
|||
Subproject commit 88c81dc405ef5d10fcf67d80d349bc1a7924e6f9
|
||||
Subproject commit 6a3f12819c7b26f73cbf471e28c93ba610040ed4
|
Loading…
Add table
Add a link
Reference in a new issue