Reworked BLE according to v0.11 of the KTag Beacon Specification (#2)
This was done to support the new KTag Konfigurator app, which Jack created for his Senior Design project. Co-authored-by: Joe Kearney <joe@clubk.club> Reviewed-on: #2
This commit is contained in:
parent
4fe072f2d3
commit
bfcdf4c354
26 changed files with 917 additions and 128 deletions
|
@ -60,6 +60,7 @@ static void Playing__Interacting_Entry(StateMachineContext_T * context)
|
|||
Playing_Entry(context);
|
||||
srand(xTaskGetTickCount());
|
||||
}
|
||||
BLE_UpdateStatusPacket(STATE_PLAYING__INTERACTING);
|
||||
LOG("Entering the Interacting substate of the Playing state.");
|
||||
}
|
||||
|
||||
|
@ -305,6 +306,10 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
xQueueSend(xQueueNeoPixels, &neopixels_action, 0);
|
||||
|
||||
Increment_Tags_Received();
|
||||
|
||||
#ifdef LOG_INTERACTING_SUBSTATE
|
||||
KLOG_INFO(KLOG_TAG, "%u of %u health remaining", KTAG_Game_Data.My_Health, KTAG_Game_Data.Max_Health);
|
||||
#endif // LOG_INTERACTING_SUBSTATE
|
||||
}
|
||||
}
|
||||
else if (player_ID != my_player_ID)
|
||||
|
@ -344,14 +349,7 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
|
||||
case KEVENT_BLE_PACKET_RECEIVED:
|
||||
#ifdef LOG_INTERACTING_SUBSTATE
|
||||
//KLOG_INFO(KLOG_TAG, "KEVENT_BLE_PACKET_RECEIVED from %02X:%02X:%02X:%02X:%02X:%02X",
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[5],
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[4],
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[3],
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[2],
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[1],
|
||||
// ((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR[0]
|
||||
//);
|
||||
//KLOG_INFO(KLOG_TAG, "KEVENT_BLE_PACKET_RECEIVED from %s", BLE_ADDR_To_Str(((BLE_Packet_T *)Event.Data)->Generic.BD_ADDR));
|
||||
#endif // LOG_INTERACTING_SUBSTATE
|
||||
if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_STATUS)
|
||||
{
|
||||
|
@ -361,8 +359,14 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
{
|
||||
HandleBLETagPacket((BLE_TagPacket_T *)Event.Data);
|
||||
}
|
||||
|
||||
BLE_FreePacketBuffer(Event.Data);
|
||||
else if (((BLE_Packet_T *)Event.Data)->Generic.type == BLE_PACKET_TYPE_EVENT)
|
||||
{
|
||||
HandleBLEEventPacket((BLE_EventPacket_T *)Event.Data, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
BLE_FreePacketBuffer(Event.Data);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEVENT_ACCESSORY_SWITCH_PRESSED:
|
||||
|
@ -398,7 +402,7 @@ static void Playing__Interacting_Do(StateMachineContext_T * context)
|
|||
|
||||
case KEVENT_GAME_OVER:
|
||||
{
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PLAY_GAME_OVER, .Data = (void *)0x00};
|
||||
AudioAction_T audio_action = {.ID = AUDIO_PLAY_GAME_OVER, .Play_To_Completion = true};
|
||||
Perform_Audio_Action(&audio_action);
|
||||
Transition_For_Event(context, STATE_WRAPPING_UP, &Event);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue