Added BLE_StopScanning() to support testing.
This commit is contained in:
parent
25e4cff3ac
commit
3ce181656f
6 changed files with 52 additions and 2 deletions
|
@ -192,6 +192,22 @@ void COMM_BLE_Task(void * pvParameters)
|
|||
|
||||
switch (command.ID)
|
||||
{
|
||||
case COMM_BLE_STOP_SCANNING:
|
||||
{
|
||||
cy_en_ble_api_result_t apiResult = Cy_BLE_GAPC_StopScan();
|
||||
|
||||
if (apiResult != CY_BLE_SUCCESS)
|
||||
{
|
||||
#ifdef TRACE_BLE
|
||||
COMM_Console_Print_String("[BLE] Cy_BLE_GAPC_StopScan API Error: 0x");
|
||||
COMM_Console_Print_UInt32AsHex(apiResult);
|
||||
COMM_Console_Print_String("\n");
|
||||
#endif // TRACE_BLE
|
||||
}
|
||||
COMM_BLE_RequestState(COMM_BLE_IDLE);
|
||||
}
|
||||
break;
|
||||
|
||||
case COMM_BLE_STOP_ADVERTISING:
|
||||
{
|
||||
cy_en_ble_api_result_t apiResult = Cy_BLE_GAPP_StopAdvertisement();
|
||||
|
@ -340,6 +356,14 @@ SystemKResult_T BLE_StopAdvertising(void)
|
|||
return SYSTEMK_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
SystemKResult_T BLE_StopScanning(void)
|
||||
{
|
||||
COMM_BLE_Command_T command = { .ID = COMM_BLE_STOP_SCANNING, .Data = (void *)0x00 };
|
||||
xQueueSend(COMM_BLE_CommandQueue, &command, 0);
|
||||
|
||||
return SYSTEMK_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void COMM_BLE_RequestState(COMM_BLE_StateID_T state)
|
||||
{
|
||||
Next_State = state;
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef enum
|
|||
COMM_BLE_SCAN_FOR_KTAG_PACKETS,
|
||||
COMM_BLE_ADVERTISE_AS_BROADCASTER,
|
||||
COMM_BLE_ADVERTISE_AS_PERIPHERAL,
|
||||
COMM_BLE_STOP_SCANNING,
|
||||
COMM_BLE_STOP_ADVERTISING,
|
||||
COMM_BLE_SCAN_AND_ADVERTISE,
|
||||
// COMM_BLE_COMMAND_IS_OUT_OF_RANGE is one more than the last valid command.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7aa827563a00b9bfa74e89be60f8529259ddac99
|
||||
Subproject commit fb1a4ab07b990fef8f957ef7c5f806649e126d0f
|
|
@ -192,6 +192,22 @@ void COMM_BLE_Task(void * pvParameters)
|
|||
|
||||
switch (command.ID)
|
||||
{
|
||||
case COMM_BLE_STOP_SCANNING:
|
||||
{
|
||||
cy_en_ble_api_result_t apiResult = Cy_BLE_GAPC_StopScan();
|
||||
|
||||
if (apiResult != CY_BLE_SUCCESS)
|
||||
{
|
||||
#ifdef TRACE_BLE
|
||||
COMM_Console_Print_String("[BLE] Cy_BLE_GAPC_StopScan API Error: 0x");
|
||||
COMM_Console_Print_UInt32AsHex(apiResult);
|
||||
COMM_Console_Print_String("\n");
|
||||
#endif // TRACE_BLE
|
||||
}
|
||||
COMM_BLE_RequestState(COMM_BLE_IDLE);
|
||||
}
|
||||
break;
|
||||
|
||||
case COMM_BLE_STOP_ADVERTISING:
|
||||
{
|
||||
cy_en_ble_api_result_t apiResult = Cy_BLE_GAPP_StopAdvertisement();
|
||||
|
@ -340,6 +356,14 @@ SystemKResult_T BLE_StopAdvertising(void)
|
|||
return SYSTEMK_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
SystemKResult_T BLE_StopScanning(void)
|
||||
{
|
||||
COMM_BLE_Command_T command = { .ID = COMM_BLE_STOP_SCANNING, .Data = (void *)0x00 };
|
||||
xQueueSend(COMM_BLE_CommandQueue, &command, 0);
|
||||
|
||||
return SYSTEMK_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void COMM_BLE_RequestState(COMM_BLE_StateID_T state)
|
||||
{
|
||||
Next_State = state;
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef enum
|
|||
COMM_BLE_SCAN_FOR_KTAG_PACKETS,
|
||||
COMM_BLE_ADVERTISE_AS_BROADCASTER,
|
||||
COMM_BLE_ADVERTISE_AS_PERIPHERAL,
|
||||
COMM_BLE_STOP_SCANNING,
|
||||
COMM_BLE_STOP_ADVERTISING,
|
||||
COMM_BLE_SCAN_AND_ADVERTISE,
|
||||
// COMM_BLE_COMMAND_IS_OUT_OF_RANGE is one more than the last valid command.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7aa827563a00b9bfa74e89be60f8529259ddac99
|
||||
Subproject commit fb1a4ab07b990fef8f957ef7c5f806649e126d0f
|
Loading…
Add table
Add a link
Reference in a new issue