Implemented BLE_EVENT_FORCE_STATE.

This commit is contained in:
Joe Kearney 2025-08-16 17:49:37 -05:00
parent e0e7fdf1ae
commit 620fefd355
2 changed files with 22 additions and 0 deletions

View file

@ -102,6 +102,22 @@ SystemKResult_T BLE_HandleCommonEvents(KEvent_T *event)
}
result = SYSTEMK_RESULT_SUCCESS;
}
else if (event_packet->event_ID == BLE_EVENT_FORCE_STATE)
{
uint32_t requested_state = event_packet->event_data;
if (requested_state < STATE_IS_OUT_OF_RANGE)
{
Transition_For_Event(GetContext(), (StateID_T)requested_state, event);
KLOG_INFO("BLE", "State %lu forced.", requested_state);
result = SYSTEMK_RESULT_SUCCESS;
}
else
{
KLOG_ERROR("BLE", "Attempted to force unknown state %lu.", requested_state);
result = SYSTEMK_RESULT_OVERFLOW;
}
}
}
}
}

View file

@ -400,6 +400,12 @@ void HandleBLEConfigurationPacket(const BLE_ParametersPacket_T *const packet)
BLE_RespondToConfigurationPacket(packet, BLE_ERROR_CHANGING_PARAMETERS);
}
// A parameters request addressed to this device or broadcast will end a BLE Quiet.
if (BLE_Unquiet() != SYSTEMK_RESULT_SUCCESS)
{
KLOG_ERROR(KLOG_TAG, "Couldn't Unquiet to respond to a Parameters request!");
}
if (xTimerStart(BLEConfigurationResponseTimer, 0) != pdPASS)
{
KLOG_ERROR(KLOG_TAG, "Couldn't start the BLEConfigurationResponseTimer!");