mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-26 22:40:25 +00:00
60a9d7e6cf
* ble: profile rework, initial * apps: hid: fix for pairing cleanup * app: hid: select transport based on #define * fixing PVS warnings * ble: serial service: fixed uid naming * bt service: on-demand dialog init; ble profiles: docs; battery svc: proper update * Added shci_cmd_resp_wait/shci_cmd_resp_release impl with semaphore * app: hid: separated transport code * ble: fixed service init order for serial svc; moved hardfault check to ble_glue * cli: ps: added thread prio to output, fixed heap display * ble_glue: naming changes; separate thread for event processing; * furi: added runtime stats; cli: added cpu% to `ps` * cli: fixed thread time calculation * furi: added getter for thread priority * fixing pvs warnings * hid profile: fixed naming * more naming fixes * hal: ble init small cleanup * cleanup & draft beacon api * f18: api sync * apps: moved example_custom_font from debug to examples * BLE extra beacon demo app * naming fix * UI fixes for demo app (wip) * desktop, ble svc: added statusbar icon for beacon * minor cleanup * Minor cleanup & naming fixes * api sync * Removed stale header * hal: added FURI_BLE_EXTRA_LOG for extra logging; comments & code cleanup * naming & macro fixes * quick fixes from review * Eliminated stock svc_ctl * cli: ps: removed runtime stats * minor include fixes * (void) * naming fixes * More naming fixes * fbt: always build all libs * fbt: explicitly globbing libs; dist: logging SDK path * scripts: fixed lib path precedence * hal: bt: profiles: naming changes, support for passing params to a profile; include cleanup * ble: hid: added parameter processing for profile template * api sync * BLE HID: long name trim * Removed unused check * desktop: updated beacon status icon; ble: hid: cleaner device name management * desktop: updated status icon Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: nminaylov <nm29719@gmail.com>
56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
#include "../ble_beacon_app.h"
|
|
|
|
enum SubmenuIndex {
|
|
SubmenuIndexSetMac,
|
|
SubmenuIndexSetData,
|
|
};
|
|
|
|
static void ble_beacon_app_scene_menu_submenu_callback(void* context, uint32_t index) {
|
|
BleBeaconApp* ble_beacon = context;
|
|
view_dispatcher_send_custom_event(ble_beacon->view_dispatcher, index);
|
|
}
|
|
|
|
void ble_beacon_app_scene_menu_on_enter(void* context) {
|
|
BleBeaconApp* ble_beacon = context;
|
|
Submenu* submenu = ble_beacon->submenu;
|
|
|
|
submenu_add_item(
|
|
submenu,
|
|
"Set MAC",
|
|
SubmenuIndexSetMac,
|
|
ble_beacon_app_scene_menu_submenu_callback,
|
|
ble_beacon);
|
|
submenu_add_item(
|
|
submenu,
|
|
"Set Data",
|
|
SubmenuIndexSetData,
|
|
ble_beacon_app_scene_menu_submenu_callback,
|
|
ble_beacon);
|
|
|
|
view_dispatcher_switch_to_view(ble_beacon->view_dispatcher, BleBeaconAppViewSubmenu);
|
|
}
|
|
|
|
bool ble_beacon_app_scene_menu_on_event(void* context, SceneManagerEvent event) {
|
|
BleBeaconApp* ble_beacon = context;
|
|
SceneManager* scene_manager = ble_beacon->scene_manager;
|
|
|
|
bool consumed = false;
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
const uint32_t submenu_index = event.event;
|
|
if(submenu_index == SubmenuIndexSetMac) {
|
|
scene_manager_next_scene(scene_manager, BleBeaconAppSceneInputMacAddress);
|
|
consumed = true;
|
|
} else if(submenu_index == SubmenuIndexSetData) {
|
|
scene_manager_next_scene(scene_manager, BleBeaconAppSceneInputBeaconData);
|
|
consumed = true;
|
|
}
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void ble_beacon_app_scene_menu_on_exit(void* context) {
|
|
BleBeaconApp* ble_beacon = context;
|
|
submenu_reset(ble_beacon->submenu);
|
|
}
|