Added BLE_StopAdvertising().
This commit is contained in:
parent
cb72042691
commit
6382526391
4 changed files with 15 additions and 3 deletions
|
@ -25,5 +25,6 @@
|
||||||
SystemKResult_T BLE_GetMyAddress(uint8_t * BD_ADDR);
|
SystemKResult_T BLE_GetMyAddress(uint8_t * BD_ADDR);
|
||||||
SystemKResult_T BLE_ScanAndAdvertise(void);
|
SystemKResult_T BLE_ScanAndAdvertise(void);
|
||||||
SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T * data);
|
SystemKResult_T BLE_SetAdvertisingData(BLE_AdvertisingData_T * data);
|
||||||
|
SystemKResult_T BLE_StopAdvertising(void);
|
||||||
|
|
||||||
#endif // BLE_HW_INTERFACE_H
|
#endif // BLE_HW_INTERFACE_H
|
||||||
|
|
|
@ -304,6 +304,11 @@ void BLE_RespondToConfigurationPacket(const BLE_ParametersPacket_T *const packet
|
||||||
{
|
{
|
||||||
KLOG_ERROR(KLOG_TAG, "Error responding to configuration packet!");
|
KLOG_ERROR(KLOG_TAG, "Error responding to configuration packet!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BLE_ScanAndAdvertise() != SYSTEMK_RESULT_SUCCESS)
|
||||||
|
{
|
||||||
|
KLOG_ERROR(KLOG_TAG, "Couldn't scan and advertise!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLE_UpdateHelloPacket()
|
void BLE_UpdateHelloPacket()
|
||||||
|
|
|
@ -158,7 +158,7 @@ Weapon_t WeaponsByID[NUMBER_OF_WEAPONS] =
|
||||||
|
|
||||||
// The Dubuque Protocol
|
// The Dubuque Protocol
|
||||||
{
|
{
|
||||||
.ID = LASER_X_ID,
|
.ID = DUBUQUE_PROTOCOL_ID,
|
||||||
.Type = ENERGY,
|
.Type = ENERGY,
|
||||||
.Protocol = DUBUQUE_PROTOCOL,
|
.Protocol = DUBUQUE_PROTOCOL,
|
||||||
.Damage_Per_Shot = 1,
|
.Damage_Per_Shot = 1,
|
||||||
|
|
|
@ -34,7 +34,8 @@ static TickType_t xBLEConfigurationResponseTimerPeriod = 3000 / portTICK_PERIOD_
|
||||||
|
|
||||||
static void BLEConfigurationResponseTimerCallback(TimerHandle_t xTimer)
|
static void BLEConfigurationResponseTimerCallback(TimerHandle_t xTimer)
|
||||||
{
|
{
|
||||||
BLE_UpdateHelloPacket();
|
// Don't send HELLO packets once configuration has started.
|
||||||
|
BLE_StopAdvertising();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_MENU_DEPTH 10
|
#define MAX_MENU_DEPTH 10
|
||||||
|
@ -106,7 +107,7 @@ static void Configuring_Do(StateMachineContext_T *context)
|
||||||
portBASE_TYPE xStatus;
|
portBASE_TYPE xStatus;
|
||||||
static KEvent_T Event;
|
static KEvent_T Event;
|
||||||
|
|
||||||
// For the first hunderd milliseconds, keep updating the Hello packet, since on some platforms (PSoC6), one call is not enough.
|
// For the first hundred milliseconds, keep updating the Hello packet, since on some platforms (PSoC6), one call is not enough.
|
||||||
// TODO: Fix the Hello packet hack on PSoC6.
|
// TODO: Fix the Hello packet hack on PSoC6.
|
||||||
if ((xTaskGetTickCount() - context->Time_At_State_Entry_In_Ticks) < (100 / portTICK_PERIOD_MS))
|
if ((xTaskGetTickCount() - context->Time_At_State_Entry_In_Ticks) < (100 / portTICK_PERIOD_MS))
|
||||||
{
|
{
|
||||||
|
@ -413,6 +414,11 @@ void HandleBLEConfigurationPacket(const BLE_ParametersPacket_T *const packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Once configuration has begun, stop advertising the HELLO packet to free up bandwidth.
|
||||||
|
BLE_StopAdvertising();
|
||||||
|
}
|
||||||
|
|
||||||
BLE_FreePacketBuffer((BLE_GenericPacketType_T *)packet);
|
BLE_FreePacketBuffer((BLE_GenericPacketType_T *)packet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue