mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge branch 'fz-dev' into dev
This commit is contained in:
@@ -84,7 +84,7 @@ static void test_rpc_setup(void) {
|
|||||||
|
|
||||||
rpc = furi_record_open(RECORD_RPC);
|
rpc = furi_record_open(RECORD_RPC);
|
||||||
for(int i = 0; !(rpc_session[0].session) && (i < 10000); ++i) {
|
for(int i = 0; !(rpc_session[0].session) && (i < 10000); ++i) {
|
||||||
rpc_session[0].session = rpc_session_open(rpc);
|
rpc_session[0].session = rpc_session_open(rpc, RpcOwnerUnknown);
|
||||||
furi_delay_tick(1);
|
furi_delay_tick(1);
|
||||||
}
|
}
|
||||||
furi_check(rpc_session[0].session);
|
furi_check(rpc_session[0].session);
|
||||||
@@ -104,7 +104,7 @@ static void test_rpc_setup_second_session(void) {
|
|||||||
furi_check(!(rpc_session[1].session));
|
furi_check(!(rpc_session[1].session));
|
||||||
|
|
||||||
for(int i = 0; !(rpc_session[1].session) && (i < 10000); ++i) {
|
for(int i = 0; !(rpc_session[1].session) && (i < 10000); ++i) {
|
||||||
rpc_session[1].session = rpc_session_open(rpc);
|
rpc_session[1].session = rpc_session_open(rpc, RpcOwnerUnknown);
|
||||||
furi_delay_tick(1);
|
furi_delay_tick(1);
|
||||||
}
|
}
|
||||||
furi_check(rpc_session[1].session);
|
furi_check(rpc_session[1].session);
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
|
|||||||
furi_event_flag_clear(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
|
furi_event_flag_clear(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
|
||||||
if(bt->profile == BtProfileSerial) {
|
if(bt->profile == BtProfileSerial) {
|
||||||
// Open RPC session
|
// Open RPC session
|
||||||
bt->rpc_session = rpc_session_open(bt->rpc);
|
bt->rpc_session = rpc_session_open(bt->rpc, RpcOwnerBle);
|
||||||
if(bt->rpc_session) {
|
if(bt->rpc_session) {
|
||||||
FURI_LOG_I(TAG, "Open RPC connection");
|
FURI_LOG_I(TAG, "Open RPC connection");
|
||||||
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
|
rpc_session_set_send_bytes_callback(bt->rpc_session, bt_rpc_send_bytes_callback);
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ static void desktop_dummy_mode_icon_draw_callback(Canvas* canvas, void* context)
|
|||||||
canvas_draw_icon(canvas, 0, 0, &I_GameMode_11x8);
|
canvas_draw_icon(canvas, 0, 0, &I_GameMode_11x8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void desktop_stealth_mode_icon_draw_callback(Canvas* canvas, void* context) {
|
||||||
|
UNUSED(context);
|
||||||
|
furi_assert(canvas);
|
||||||
|
canvas_draw_icon(canvas, 0, 0, &I_Muted_8x8);
|
||||||
|
}
|
||||||
|
|
||||||
static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
static bool desktop_custom_event_callback(void* context, uint32_t event) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
Desktop* desktop = (Desktop*)context;
|
Desktop* desktop = (Desktop*)context;
|
||||||
@@ -156,6 +162,17 @@ void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) {
|
|||||||
desktop->in_transition = false;
|
desktop->in_transition = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled) {
|
||||||
|
desktop->in_transition = true;
|
||||||
|
if(enabled) {
|
||||||
|
furi_hal_rtc_set_flag(FuriHalRtcFlagStealthMode);
|
||||||
|
} else {
|
||||||
|
furi_hal_rtc_reset_flag(FuriHalRtcFlagStealthMode);
|
||||||
|
}
|
||||||
|
view_port_enabled_set(desktop->stealth_mode_icon_viewport, enabled);
|
||||||
|
desktop->in_transition = false;
|
||||||
|
}
|
||||||
|
|
||||||
Desktop* desktop_alloc() {
|
Desktop* desktop_alloc() {
|
||||||
Desktop* desktop = malloc(sizeof(Desktop));
|
Desktop* desktop = malloc(sizeof(Desktop));
|
||||||
|
|
||||||
@@ -247,6 +264,18 @@ Desktop* desktop_alloc() {
|
|||||||
view_port_enabled_set(desktop->dummy_mode_icon_viewport, false);
|
view_port_enabled_set(desktop->dummy_mode_icon_viewport, false);
|
||||||
gui_add_view_port(desktop->gui, desktop->dummy_mode_icon_viewport, GuiLayerStatusBarLeft);
|
gui_add_view_port(desktop->gui, desktop->dummy_mode_icon_viewport, GuiLayerStatusBarLeft);
|
||||||
|
|
||||||
|
// Stealth mode icon
|
||||||
|
desktop->stealth_mode_icon_viewport = view_port_alloc();
|
||||||
|
view_port_set_width(desktop->stealth_mode_icon_viewport, icon_get_width(&I_Muted_8x8));
|
||||||
|
view_port_draw_callback_set(
|
||||||
|
desktop->stealth_mode_icon_viewport, desktop_stealth_mode_icon_draw_callback, desktop);
|
||||||
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode)) {
|
||||||
|
view_port_enabled_set(desktop->stealth_mode_icon_viewport, true);
|
||||||
|
} else {
|
||||||
|
view_port_enabled_set(desktop->stealth_mode_icon_viewport, false);
|
||||||
|
}
|
||||||
|
gui_add_view_port(desktop->gui, desktop->stealth_mode_icon_viewport, GuiLayerStatusBarLeft);
|
||||||
|
|
||||||
// Special case: autostart application is already running
|
// Special case: autostart application is already running
|
||||||
desktop->loader = furi_record_open(RECORD_LOADER);
|
desktop->loader = furi_record_open(RECORD_LOADER);
|
||||||
if(loader_is_locked(desktop->loader) &&
|
if(loader_is_locked(desktop->loader) &&
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ struct Desktop {
|
|||||||
|
|
||||||
ViewPort* lock_icon_viewport;
|
ViewPort* lock_icon_viewport;
|
||||||
ViewPort* dummy_mode_icon_viewport;
|
ViewPort* dummy_mode_icon_viewport;
|
||||||
|
ViewPort* stealth_mode_icon_viewport;
|
||||||
|
|
||||||
AnimationManager* animation_manager;
|
AnimationManager* animation_manager;
|
||||||
|
|
||||||
@@ -79,3 +80,4 @@ void desktop_free(Desktop* desktop);
|
|||||||
void desktop_lock(Desktop* desktop);
|
void desktop_lock(Desktop* desktop);
|
||||||
void desktop_unlock(Desktop* desktop);
|
void desktop_unlock(Desktop* desktop);
|
||||||
void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled);
|
void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled);
|
||||||
|
void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ void desktop_scene_lock_menu_on_enter(void* context) {
|
|||||||
desktop_lock_menu_set_callback(desktop->lock_menu, desktop_scene_lock_menu_callback, desktop);
|
desktop_lock_menu_set_callback(desktop->lock_menu, desktop_scene_lock_menu_callback, desktop);
|
||||||
desktop_lock_menu_set_pin_state(desktop->lock_menu, desktop->settings.pin_code.length > 0);
|
desktop_lock_menu_set_pin_state(desktop->lock_menu, desktop->settings.pin_code.length > 0);
|
||||||
desktop_lock_menu_set_dummy_mode_state(desktop->lock_menu, desktop->settings.dummy_mode);
|
desktop_lock_menu_set_dummy_mode_state(desktop->lock_menu, desktop->settings.dummy_mode);
|
||||||
|
desktop_lock_menu_set_stealth_mode_state(
|
||||||
|
desktop->lock_menu, furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode));
|
||||||
desktop_lock_menu_set_idx(desktop->lock_menu, 0);
|
desktop_lock_menu_set_idx(desktop->lock_menu, 0);
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
|
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
|
||||||
@@ -78,6 +80,16 @@ bool desktop_scene_lock_menu_on_event(void* context, SceneManagerEvent event) {
|
|||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
desktop->scene_manager, DesktopSceneMain);
|
desktop->scene_manager, DesktopSceneMain);
|
||||||
break;
|
break;
|
||||||
|
case DesktopLockMenuEventStealthModeOn:
|
||||||
|
desktop_set_stealth_mode_state(desktop, true);
|
||||||
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
|
desktop->scene_manager, DesktopSceneMain);
|
||||||
|
break;
|
||||||
|
case DesktopLockMenuEventStealthModeOff:
|
||||||
|
desktop_set_stealth_mode_state(desktop, false);
|
||||||
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
|
desktop->scene_manager, DesktopSceneMain);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ typedef enum {
|
|||||||
DesktopLockMenuEventPinLock,
|
DesktopLockMenuEventPinLock,
|
||||||
DesktopLockMenuEventDummyModeOn,
|
DesktopLockMenuEventDummyModeOn,
|
||||||
DesktopLockMenuEventDummyModeOff,
|
DesktopLockMenuEventDummyModeOff,
|
||||||
|
DesktopLockMenuEventStealthModeOn,
|
||||||
|
DesktopLockMenuEventStealthModeOff,
|
||||||
|
|
||||||
DesktopAnimationEventCheckAnimation,
|
DesktopAnimationEventCheckAnimation,
|
||||||
DesktopAnimationEventNewIdleAnimation,
|
DesktopAnimationEventNewIdleAnimation,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DesktopLockMenuIndexLock,
|
DesktopLockMenuIndexLock,
|
||||||
DesktopLockMenuIndexPinLock,
|
DesktopLockMenuIndexStealth,
|
||||||
DesktopLockMenuIndexDummy,
|
DesktopLockMenuIndexDummy,
|
||||||
|
|
||||||
DesktopLockMenuIndexTotalCount
|
DesktopLockMenuIndexTotalCount
|
||||||
@@ -39,6 +39,14 @@ void desktop_lock_menu_set_dummy_mode_state(DesktopLockMenuView* lock_menu, bool
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void desktop_lock_menu_set_stealth_mode_state(DesktopLockMenuView* lock_menu, bool stealth_mode) {
|
||||||
|
with_view_model(
|
||||||
|
lock_menu->view,
|
||||||
|
DesktopLockMenuViewModel * model,
|
||||||
|
{ model->stealth_mode = stealth_mode; },
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|
||||||
void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx) {
|
void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx) {
|
||||||
furi_assert(idx < DesktopLockMenuIndexTotalCount);
|
furi_assert(idx < DesktopLockMenuIndexTotalCount);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
@@ -58,11 +66,11 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) {
|
|||||||
|
|
||||||
if(i == DesktopLockMenuIndexLock) {
|
if(i == DesktopLockMenuIndexLock) {
|
||||||
str = "Lock";
|
str = "Lock";
|
||||||
} else if(i == DesktopLockMenuIndexPinLock) {
|
} else if(i == DesktopLockMenuIndexStealth) {
|
||||||
if(m->pin_is_set) {
|
if(m->stealth_mode) {
|
||||||
str = "Lock with PIN";
|
str = "Sound Mode";
|
||||||
} else {
|
} else {
|
||||||
str = "Set PIN";
|
str = "Stealth Mode";
|
||||||
}
|
}
|
||||||
} else if(i == DesktopLockMenuIndexDummy) { //-V547
|
} else if(i == DesktopLockMenuIndexDummy) { //-V547
|
||||||
if(m->dummy_mode) {
|
if(m->dummy_mode) {
|
||||||
@@ -93,6 +101,8 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
|
|||||||
uint8_t idx = 0;
|
uint8_t idx = 0;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
bool dummy_mode = false;
|
bool dummy_mode = false;
|
||||||
|
bool stealth_mode = false;
|
||||||
|
bool pin_is_set = false;
|
||||||
bool update = false;
|
bool update = false;
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
@@ -120,14 +130,24 @@ bool desktop_lock_menu_input_callback(InputEvent* event, void* context) {
|
|||||||
}
|
}
|
||||||
idx = model->idx;
|
idx = model->idx;
|
||||||
dummy_mode = model->dummy_mode;
|
dummy_mode = model->dummy_mode;
|
||||||
|
stealth_mode = model->stealth_mode;
|
||||||
|
pin_is_set = model->pin_is_set;
|
||||||
},
|
},
|
||||||
update);
|
update);
|
||||||
|
|
||||||
if(event->key == InputKeyOk) {
|
if(event->key == InputKeyOk) {
|
||||||
if((idx == DesktopLockMenuIndexLock) && (event->type == InputTypeShort)) {
|
if((idx == DesktopLockMenuIndexLock)) {
|
||||||
lock_menu->callback(DesktopLockMenuEventLock, lock_menu->context);
|
if((pin_is_set) && (event->type == InputTypeShort)) {
|
||||||
} else if((idx == DesktopLockMenuIndexPinLock) && (event->type == InputTypeShort)) {
|
lock_menu->callback(DesktopLockMenuEventPinLock, lock_menu->context);
|
||||||
lock_menu->callback(DesktopLockMenuEventPinLock, lock_menu->context);
|
} else if((pin_is_set == false) && (event->type == InputTypeShort)) {
|
||||||
|
lock_menu->callback(DesktopLockMenuEventLock, lock_menu->context);
|
||||||
|
}
|
||||||
|
} else if(idx == DesktopLockMenuIndexStealth) {
|
||||||
|
if((stealth_mode == false) && (event->type == InputTypeShort)) {
|
||||||
|
lock_menu->callback(DesktopLockMenuEventStealthModeOn, lock_menu->context);
|
||||||
|
} else if((stealth_mode == true) && (event->type == InputTypeShort)) {
|
||||||
|
lock_menu->callback(DesktopLockMenuEventStealthModeOff, lock_menu->context);
|
||||||
|
}
|
||||||
} else if(idx == DesktopLockMenuIndexDummy) {
|
} else if(idx == DesktopLockMenuIndexDummy) {
|
||||||
if((dummy_mode == false) && (event->type == InputTypeShort)) {
|
if((dummy_mode == false) && (event->type == InputTypeShort)) {
|
||||||
lock_menu->callback(DesktopLockMenuEventDummyModeOn, lock_menu->context);
|
lock_menu->callback(DesktopLockMenuEventDummyModeOn, lock_menu->context);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ typedef struct {
|
|||||||
uint8_t idx;
|
uint8_t idx;
|
||||||
bool pin_is_set;
|
bool pin_is_set;
|
||||||
bool dummy_mode;
|
bool dummy_mode;
|
||||||
|
bool stealth_mode;
|
||||||
} DesktopLockMenuViewModel;
|
} DesktopLockMenuViewModel;
|
||||||
|
|
||||||
void desktop_lock_menu_set_callback(
|
void desktop_lock_menu_set_callback(
|
||||||
@@ -29,6 +30,7 @@ void desktop_lock_menu_set_callback(
|
|||||||
View* desktop_lock_menu_get_view(DesktopLockMenuView* lock_menu);
|
View* desktop_lock_menu_get_view(DesktopLockMenuView* lock_menu);
|
||||||
void desktop_lock_menu_set_pin_state(DesktopLockMenuView* lock_menu, bool pin_is_set);
|
void desktop_lock_menu_set_pin_state(DesktopLockMenuView* lock_menu, bool pin_is_set);
|
||||||
void desktop_lock_menu_set_dummy_mode_state(DesktopLockMenuView* lock_menu, bool dummy_mode);
|
void desktop_lock_menu_set_dummy_mode_state(DesktopLockMenuView* lock_menu, bool dummy_mode);
|
||||||
|
void desktop_lock_menu_set_stealth_mode_state(DesktopLockMenuView* lock_menu, bool stealth_mode);
|
||||||
void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx);
|
void desktop_lock_menu_set_idx(DesktopLockMenuView* lock_menu, uint8_t idx);
|
||||||
DesktopLockMenuView* desktop_lock_menu_alloc();
|
DesktopLockMenuView* desktop_lock_menu_alloc();
|
||||||
void desktop_lock_menu_free(DesktopLockMenuView* lock_menu);
|
void desktop_lock_menu_free(DesktopLockMenuView* lock_menu);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ static const uint8_t reset_sound_mask = 1 << 4;
|
|||||||
static const uint8_t reset_display_mask = 1 << 5;
|
static const uint8_t reset_display_mask = 1 << 5;
|
||||||
static const uint8_t reset_blink_mask = 1 << 6;
|
static const uint8_t reset_blink_mask = 1 << 6;
|
||||||
|
|
||||||
void notification_vibro_on();
|
void notification_vibro_on(bool force);
|
||||||
void notification_vibro_off();
|
void notification_vibro_off();
|
||||||
void notification_sound_on(float freq, float volume);
|
void notification_sound_on(float freq, float volume, bool force);
|
||||||
void notification_sound_off();
|
void notification_sound_off();
|
||||||
|
|
||||||
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value);
|
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value);
|
||||||
@@ -141,17 +141,21 @@ uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// generics
|
// generics
|
||||||
void notification_vibro_on() {
|
void notification_vibro_on(bool force) {
|
||||||
furi_hal_vibro_on(true);
|
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode) || force) {
|
||||||
|
furi_hal_vibro_on(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void notification_vibro_off() {
|
void notification_vibro_off() {
|
||||||
furi_hal_vibro_on(false);
|
furi_hal_vibro_on(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notification_sound_on(float freq, float volume) {
|
void notification_sound_on(float freq, float volume, bool force) {
|
||||||
if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
|
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode) || force) {
|
||||||
furi_hal_speaker_start(freq, volume);
|
if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
|
||||||
|
furi_hal_speaker_start(freq, volume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +178,8 @@ void notification_process_notification_message(
|
|||||||
NotificationApp* app,
|
NotificationApp* app,
|
||||||
NotificationAppMessage* message) {
|
NotificationAppMessage* message) {
|
||||||
uint32_t notification_message_index = 0;
|
uint32_t notification_message_index = 0;
|
||||||
|
bool force_volume = false;
|
||||||
|
bool force_vibro = false;
|
||||||
const NotificationMessage* notification_message;
|
const NotificationMessage* notification_message;
|
||||||
notification_message = (*message->sequence)[notification_message_index];
|
notification_message = (*message->sequence)[notification_message_index];
|
||||||
|
|
||||||
@@ -269,7 +275,7 @@ void notification_process_notification_message(
|
|||||||
break;
|
break;
|
||||||
case NotificationMessageTypeVibro:
|
case NotificationMessageTypeVibro:
|
||||||
if(notification_message->data.vibro.on) {
|
if(notification_message->data.vibro.on) {
|
||||||
if(vibro_setting) notification_vibro_on();
|
if(vibro_setting) notification_vibro_on(force_vibro);
|
||||||
} else {
|
} else {
|
||||||
notification_vibro_off();
|
notification_vibro_off();
|
||||||
}
|
}
|
||||||
@@ -278,7 +284,8 @@ void notification_process_notification_message(
|
|||||||
case NotificationMessageTypeSoundOn:
|
case NotificationMessageTypeSoundOn:
|
||||||
notification_sound_on(
|
notification_sound_on(
|
||||||
notification_message->data.sound.frequency,
|
notification_message->data.sound.frequency,
|
||||||
notification_message->data.sound.volume * speaker_volume_setting);
|
notification_message->data.sound.volume * speaker_volume_setting,
|
||||||
|
force_volume);
|
||||||
reset_mask |= reset_sound_mask;
|
reset_mask |= reset_sound_mask;
|
||||||
break;
|
break;
|
||||||
case NotificationMessageTypeSoundOff:
|
case NotificationMessageTypeSoundOff:
|
||||||
@@ -307,9 +314,11 @@ void notification_process_notification_message(
|
|||||||
break;
|
break;
|
||||||
case NotificationMessageTypeForceSpeakerVolumeSetting:
|
case NotificationMessageTypeForceSpeakerVolumeSetting:
|
||||||
speaker_volume_setting = notification_message->data.forced_settings.speaker_volume;
|
speaker_volume_setting = notification_message->data.forced_settings.speaker_volume;
|
||||||
|
force_volume = true;
|
||||||
break;
|
break;
|
||||||
case NotificationMessageTypeForceVibroSetting:
|
case NotificationMessageTypeForceVibroSetting:
|
||||||
vibro_setting = notification_message->data.forced_settings.vibro;
|
vibro_setting = notification_message->data.forced_settings.vibro;
|
||||||
|
force_vibro = true;
|
||||||
break;
|
break;
|
||||||
case NotificationMessageTypeForceDisplayBrightnessSetting:
|
case NotificationMessageTypeForceDisplayBrightnessSetting:
|
||||||
display_brightness_setting =
|
display_brightness_setting =
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ struct RpcSession {
|
|||||||
RpcBufferIsEmptyCallback buffer_is_empty_callback;
|
RpcBufferIsEmptyCallback buffer_is_empty_callback;
|
||||||
RpcSessionClosedCallback closed_callback;
|
RpcSessionClosedCallback closed_callback;
|
||||||
RpcSessionTerminatedCallback terminated_callback;
|
RpcSessionTerminatedCallback terminated_callback;
|
||||||
|
RpcOwner owner;
|
||||||
void* context;
|
void* context;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,6 +84,11 @@ struct Rpc {
|
|||||||
FuriMutex* busy_mutex;
|
FuriMutex* busy_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RpcOwner rpc_session_get_owner(RpcSession* session) {
|
||||||
|
furi_assert(session);
|
||||||
|
return session->owner;
|
||||||
|
}
|
||||||
|
|
||||||
static void rpc_close_session_process(const PB_Main* request, void* context) {
|
static void rpc_close_session_process(const PB_Main* request, void* context) {
|
||||||
furi_assert(request);
|
furi_assert(request);
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
@@ -348,7 +354,7 @@ static void rpc_session_free_callback(FuriThreadState thread_state, void* contex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcSession* rpc_session_open(Rpc* rpc) {
|
RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) {
|
||||||
furi_assert(rpc);
|
furi_assert(rpc);
|
||||||
|
|
||||||
RpcSession* session = malloc(sizeof(RpcSession));
|
RpcSession* session = malloc(sizeof(RpcSession));
|
||||||
@@ -357,6 +363,7 @@ RpcSession* rpc_session_open(Rpc* rpc) {
|
|||||||
session->rpc = rpc;
|
session->rpc = rpc;
|
||||||
session->terminate = false;
|
session->terminate = false;
|
||||||
session->decode_error = false;
|
session->decode_error = false;
|
||||||
|
session->owner = owner;
|
||||||
RpcHandlerDict_init(session->handlers);
|
RpcHandlerDict_init(session->handlers);
|
||||||
|
|
||||||
session->decoded_message = malloc(sizeof(PB_Main));
|
session->decoded_message = malloc(sizeof(PB_Main));
|
||||||
|
|||||||
@@ -30,6 +30,21 @@ typedef void (*RpcSessionClosedCallback)(void* context);
|
|||||||
* and all operations were finished */
|
* and all operations were finished */
|
||||||
typedef void (*RpcSessionTerminatedCallback)(void* context);
|
typedef void (*RpcSessionTerminatedCallback)(void* context);
|
||||||
|
|
||||||
|
/** RPC owner */
|
||||||
|
typedef enum {
|
||||||
|
RpcOwnerUnknown = 0,
|
||||||
|
RpcOwnerBle,
|
||||||
|
RpcOwnerUsb,
|
||||||
|
RpcOwnerCount,
|
||||||
|
} RpcOwner;
|
||||||
|
|
||||||
|
/** Get RPC session owner
|
||||||
|
*
|
||||||
|
* @param session pointer to RpcSession descriptor
|
||||||
|
* @return session owner
|
||||||
|
*/
|
||||||
|
RpcOwner rpc_session_get_owner(RpcSession* session);
|
||||||
|
|
||||||
/** Open RPC session
|
/** Open RPC session
|
||||||
*
|
*
|
||||||
* USAGE:
|
* USAGE:
|
||||||
@@ -44,10 +59,11 @@ typedef void (*RpcSessionTerminatedCallback)(void* context);
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param rpc instance
|
* @param rpc instance
|
||||||
|
* @param owner owner of session
|
||||||
* @return pointer to RpcSession descriptor, or
|
* @return pointer to RpcSession descriptor, or
|
||||||
* NULL if RPC is busy and can't open session now
|
* NULL if RPC is busy and can't open session now
|
||||||
*/
|
*/
|
||||||
RpcSession* rpc_session_open(Rpc* rpc);
|
RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner);
|
||||||
|
|
||||||
/** Close RPC session
|
/** Close RPC session
|
||||||
* It is guaranteed that no callbacks will be called
|
* It is guaranteed that no callbacks will be called
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void rpc_cli_command_start_session(Cli* cli, FuriString* args, void* context) {
|
|||||||
FURI_LOG_D(TAG, "Free memory %lu", mem_before);
|
FURI_LOG_D(TAG, "Free memory %lu", mem_before);
|
||||||
|
|
||||||
furi_hal_usb_lock();
|
furi_hal_usb_lock();
|
||||||
RpcSession* rpc_session = rpc_session_open(rpc);
|
RpcSession* rpc_session = rpc_session_open(rpc, RpcOwnerUsb);
|
||||||
if(rpc_session == NULL) {
|
if(rpc_session == NULL) {
|
||||||
printf("Session start error\r\n");
|
printf("Session start error\r\n");
|
||||||
furi_hal_usb_unlock();
|
furi_hal_usb_unlock();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "rpc_i.h"
|
#include "rpc_i.h"
|
||||||
#include "gui.pb.h"
|
#include "gui.pb.h"
|
||||||
#include <gui/gui_i.h>
|
#include <gui/gui_i.h>
|
||||||
|
#include <assets_icons.h>
|
||||||
|
|
||||||
#define TAG "RpcGui"
|
#define TAG "RpcGui"
|
||||||
|
|
||||||
@@ -31,6 +32,8 @@ typedef struct {
|
|||||||
|
|
||||||
uint32_t input_key_counter[InputKeyMAX];
|
uint32_t input_key_counter[InputKeyMAX];
|
||||||
uint32_t input_counter;
|
uint32_t input_counter;
|
||||||
|
|
||||||
|
ViewPort* rpc_session_active_viewport;
|
||||||
} RpcGuiSystem;
|
} RpcGuiSystem;
|
||||||
|
|
||||||
static const PB_Gui_ScreenOrientation rpc_system_gui_screen_orientation_map[] = {
|
static const PB_Gui_ScreenOrientation rpc_system_gui_screen_orientation_map[] = {
|
||||||
@@ -352,6 +355,12 @@ static void rpc_system_gui_virtual_display_frame_process(const PB_Main* request,
|
|||||||
(void)session;
|
(void)session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rpc_active_session_icon_draw_callback(Canvas* canvas, void* context) {
|
||||||
|
UNUSED(context);
|
||||||
|
furi_assert(canvas);
|
||||||
|
canvas_draw_icon(canvas, 0, 0, &I_Rpc_active_7x8);
|
||||||
|
}
|
||||||
|
|
||||||
void* rpc_system_gui_alloc(RpcSession* session) {
|
void* rpc_system_gui_alloc(RpcSession* session) {
|
||||||
furi_assert(session);
|
furi_assert(session);
|
||||||
|
|
||||||
@@ -359,6 +368,18 @@ void* rpc_system_gui_alloc(RpcSession* session) {
|
|||||||
rpc_gui->gui = furi_record_open(RECORD_GUI);
|
rpc_gui->gui = furi_record_open(RECORD_GUI);
|
||||||
rpc_gui->session = session;
|
rpc_gui->session = session;
|
||||||
|
|
||||||
|
// Active session icon
|
||||||
|
rpc_gui->rpc_session_active_viewport = view_port_alloc();
|
||||||
|
view_port_set_width(rpc_gui->rpc_session_active_viewport, icon_get_width(&I_Rpc_active_7x8));
|
||||||
|
view_port_draw_callback_set(
|
||||||
|
rpc_gui->rpc_session_active_viewport, rpc_active_session_icon_draw_callback, session);
|
||||||
|
if(rpc_session_get_owner(rpc_gui->session) != RpcOwnerBle) {
|
||||||
|
view_port_enabled_set(rpc_gui->rpc_session_active_viewport, true);
|
||||||
|
} else {
|
||||||
|
view_port_enabled_set(rpc_gui->rpc_session_active_viewport, false);
|
||||||
|
}
|
||||||
|
gui_add_view_port(rpc_gui->gui, rpc_gui->rpc_session_active_viewport, GuiLayerStatusBarLeft);
|
||||||
|
|
||||||
RpcHandler rpc_handler = {
|
RpcHandler rpc_handler = {
|
||||||
.message_handler = NULL,
|
.message_handler = NULL,
|
||||||
.decode_submessage = NULL,
|
.decode_submessage = NULL,
|
||||||
@@ -399,6 +420,9 @@ void rpc_system_gui_free(void* context) {
|
|||||||
rpc_gui->virtual_display_not_empty = false;
|
rpc_gui->virtual_display_not_empty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_remove_view_port(rpc_gui->gui, rpc_gui->rpc_session_active_viewport);
|
||||||
|
view_port_free(rpc_gui->rpc_session_active_viewport);
|
||||||
|
|
||||||
if(rpc_gui->is_streaming) {
|
if(rpc_gui->is_streaming) {
|
||||||
rpc_gui->is_streaming = false;
|
rpc_gui->is_streaming = false;
|
||||||
// Remove GUI framebuffer callback
|
// Remove GUI framebuffer callback
|
||||||
@@ -415,4 +439,4 @@ void rpc_system_gui_free(void* context) {
|
|||||||
}
|
}
|
||||||
furi_record_close(RECORD_GUI);
|
furi_record_close(RECORD_GUI);
|
||||||
free(rpc_gui);
|
free(rpc_gui);
|
||||||
}
|
}
|
||||||
@@ -163,18 +163,33 @@ static NotificationAppSettings* alloc_settings() {
|
|||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, backlight_text[value_index]);
|
variable_item_set_current_value_text(item, backlight_text[value_index]);
|
||||||
|
|
||||||
item = variable_item_list_add(
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode)) {
|
||||||
app->variable_item_list, "Volume", VOLUME_COUNT, volume_changed, app);
|
item = variable_item_list_add(app->variable_item_list, "Volume", 1, NULL, app);
|
||||||
value_index =
|
value_index = 0;
|
||||||
value_index_float(app->notification->settings.speaker_volume, volume_value, VOLUME_COUNT);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_text(item, "Stealth");
|
||||||
variable_item_set_current_value_text(item, volume_text[value_index]);
|
} else {
|
||||||
|
item = variable_item_list_add(
|
||||||
|
app->variable_item_list, "Volume", VOLUME_COUNT, volume_changed, app);
|
||||||
|
value_index = value_index_float(
|
||||||
|
app->notification->settings.speaker_volume, volume_value, VOLUME_COUNT);
|
||||||
|
variable_item_set_current_value_index(item, value_index);
|
||||||
|
variable_item_set_current_value_text(item, volume_text[value_index]);
|
||||||
|
}
|
||||||
|
|
||||||
item =
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode)) {
|
||||||
variable_item_list_add(app->variable_item_list, "Vibro", VIBRO_COUNT, vibro_changed, app);
|
item = variable_item_list_add(app->variable_item_list, "Vibro", 1, NULL, app);
|
||||||
value_index = value_index_bool(app->notification->settings.vibro_on, vibro_value, VIBRO_COUNT);
|
value_index = 0;
|
||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, vibro_text[value_index]);
|
variable_item_set_current_value_text(item, "Stealth");
|
||||||
|
} else {
|
||||||
|
item = variable_item_list_add(
|
||||||
|
app->variable_item_list, "Vibro", VIBRO_COUNT, vibro_changed, app);
|
||||||
|
value_index =
|
||||||
|
value_index_bool(app->notification->settings.vibro_on, vibro_value, VIBRO_COUNT);
|
||||||
|
variable_item_set_current_value_index(item, value_index);
|
||||||
|
variable_item_set_current_value_text(item, vibro_text[value_index]);
|
||||||
|
}
|
||||||
|
|
||||||
app->view_dispatcher = view_dispatcher_alloc();
|
app->view_dispatcher = view_dispatcher_alloc();
|
||||||
view_dispatcher_enable_queue(app->view_dispatcher);
|
view_dispatcher_enable_queue(app->view_dispatcher);
|
||||||
|
|||||||
BIN
assets/icons/StatusBar/Muted_8x8.png
Normal file
BIN
assets/icons/StatusBar/Muted_8x8.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/icons/StatusBar/Rpc_active_7x8.png
Normal file
BIN
assets/icons/StatusBar/Rpc_active_7x8.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
23
documentation/LFRFIDRaw.md
Normal file
23
documentation/LFRFIDRaw.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Reading RAW RFID data
|
||||||
|
|
||||||
|
Flipper Zero has the option to read RAW data from 125 kHz cards that allows you to record the card's data and save it, similar to how a dictaphone records sound.
|
||||||
|
|
||||||
|
To use this function, you need to activate the Debug mode on your Flipper Zero by doing the following:
|
||||||
|
|
||||||
|
1. Go to **Main Menu** → **Settings** → **System**.
|
||||||
|
|
||||||
|
2. Set **Debug** to **ON**.
|
||||||
|
|
||||||
|
Once the Debug mode is activated on your Flipper Zero, you can read RAW data from 125 kHz RFID cards:
|
||||||
|
|
||||||
|
1. Go to **Main Menu** → **125 kHz RFID** → **Extra Actions**.
|
||||||
|
|
||||||
|
2. Select **RAW RFID** data and name the raw file.
|
||||||
|
|
||||||
|
3. Read instructions and press **OK**.
|
||||||
|
|
||||||
|
4. Apply the card to Flipper Zero's back.
|
||||||
|
|
||||||
|
5. Once the reading is finished, press **OK**.
|
||||||
|
|
||||||
|
Two files with data (with ASK and PSK modulations) will be saved in the `lfrfid` folder on the microSD card. Now, you can share it and the card's photo with developers by creating an issue on GitHub.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,22.0,,
|
Version,+,23.0,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/cli/cli.h,,
|
Header,+,applications/services/cli/cli.h,,
|
||||||
Header,+,applications/services/cli/cli_vcp.h,,
|
Header,+,applications/services/cli/cli_vcp.h,,
|
||||||
@@ -1596,7 +1596,8 @@ Function,-,rindex,char*,"const char*, int"
|
|||||||
Function,+,rpc_session_close,void,RpcSession*
|
Function,+,rpc_session_close,void,RpcSession*
|
||||||
Function,+,rpc_session_feed,size_t,"RpcSession*, uint8_t*, size_t, TickType_t"
|
Function,+,rpc_session_feed,size_t,"RpcSession*, uint8_t*, size_t, TickType_t"
|
||||||
Function,+,rpc_session_get_available_size,size_t,RpcSession*
|
Function,+,rpc_session_get_available_size,size_t,RpcSession*
|
||||||
Function,+,rpc_session_open,RpcSession*,Rpc*
|
Function,+,rpc_session_get_owner,RpcOwner,RpcSession*
|
||||||
|
Function,+,rpc_session_open,RpcSession*,"Rpc*, RpcOwner"
|
||||||
Function,+,rpc_session_set_buffer_is_empty_callback,void,"RpcSession*, RpcBufferIsEmptyCallback"
|
Function,+,rpc_session_set_buffer_is_empty_callback,void,"RpcSession*, RpcBufferIsEmptyCallback"
|
||||||
Function,+,rpc_session_set_close_callback,void,"RpcSession*, RpcSessionClosedCallback"
|
Function,+,rpc_session_set_close_callback,void,"RpcSession*, RpcSessionClosedCallback"
|
||||||
Function,+,rpc_session_set_context,void,"RpcSession*, void*"
|
Function,+,rpc_session_set_context,void,"RpcSession*, void*"
|
||||||
|
|||||||
|
@@ -1,5 +1,5 @@
|
|||||||
entry,status,name,type,params
|
entry,status,name,type,params
|
||||||
Version,+,22.0,,
|
Version,+,23.0,,
|
||||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||||
Header,+,applications/services/cli/cli.h,,
|
Header,+,applications/services/cli/cli.h,,
|
||||||
Header,+,applications/services/cli/cli_vcp.h,,
|
Header,+,applications/services/cli/cli_vcp.h,,
|
||||||
@@ -2414,7 +2414,8 @@ Function,-,roundl,long double,long double
|
|||||||
Function,+,rpc_session_close,void,RpcSession*
|
Function,+,rpc_session_close,void,RpcSession*
|
||||||
Function,+,rpc_session_feed,size_t,"RpcSession*, uint8_t*, size_t, TickType_t"
|
Function,+,rpc_session_feed,size_t,"RpcSession*, uint8_t*, size_t, TickType_t"
|
||||||
Function,+,rpc_session_get_available_size,size_t,RpcSession*
|
Function,+,rpc_session_get_available_size,size_t,RpcSession*
|
||||||
Function,+,rpc_session_open,RpcSession*,Rpc*
|
Function,+,rpc_session_get_owner,RpcOwner,RpcSession*
|
||||||
|
Function,+,rpc_session_open,RpcSession*,"Rpc*, RpcOwner"
|
||||||
Function,+,rpc_session_set_buffer_is_empty_callback,void,"RpcSession*, RpcBufferIsEmptyCallback"
|
Function,+,rpc_session_set_buffer_is_empty_callback,void,"RpcSession*, RpcBufferIsEmptyCallback"
|
||||||
Function,+,rpc_session_set_close_callback,void,"RpcSession*, RpcSessionClosedCallback"
|
Function,+,rpc_session_set_close_callback,void,"RpcSession*, RpcSessionClosedCallback"
|
||||||
Function,+,rpc_session_set_context,void,"RpcSession*, void*"
|
Function,+,rpc_session_set_context,void,"RpcSession*, void*"
|
||||||
|
|||||||
|
@@ -31,6 +31,7 @@ typedef enum {
|
|||||||
FuriHalRtcFlagC2Update = (1 << 3),
|
FuriHalRtcFlagC2Update = (1 << 3),
|
||||||
FuriHalRtcFlagHandOrient = (1 << 4),
|
FuriHalRtcFlagHandOrient = (1 << 4),
|
||||||
FuriHalRtcFlagLegacySleep = (1 << 5),
|
FuriHalRtcFlagLegacySleep = (1 << 5),
|
||||||
|
FuriHalRtcFlagStealthMode = (1 << 6),
|
||||||
} FuriHalRtcFlag;
|
} FuriHalRtcFlag;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from SCons.Platform import TempFileMunge
|
from SCons.Platform import TempFileMunge
|
||||||
from SCons.Node import FS
|
from SCons.Node import FS
|
||||||
from SCons.Errors import UserError
|
from SCons.Errors import UserError
|
||||||
|
from SCons.Warnings import warn, WarningOnByDefault
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@@ -246,7 +248,12 @@ known_extapps = [
|
|||||||
for apptype in apps_to_build_as_faps
|
for apptype in apps_to_build_as_faps
|
||||||
for app in appenv["APPBUILD"].get_apps_of_type(apptype, True)
|
for app in appenv["APPBUILD"].get_apps_of_type(apptype, True)
|
||||||
]
|
]
|
||||||
|
incompatible_apps = []
|
||||||
for app in known_extapps:
|
for app in known_extapps:
|
||||||
|
if not app.supports_hardware_target(appenv.subst("f${TARGET_HW}")):
|
||||||
|
incompatible_apps.append(app)
|
||||||
|
continue
|
||||||
|
|
||||||
app_artifacts = appenv.BuildAppElf(app)
|
app_artifacts = appenv.BuildAppElf(app)
|
||||||
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
|
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
|
||||||
app_artifacts.installer = [
|
app_artifacts.installer = [
|
||||||
@@ -254,6 +261,13 @@ for app in known_extapps:
|
|||||||
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),
|
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if len(incompatible_apps):
|
||||||
|
print(
|
||||||
|
"WARNING: The following apps are not compatible with the current target hardware and will not be built: {}".format(
|
||||||
|
", ".join([app.name for app in incompatible_apps])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if appenv["FORCE"]:
|
if appenv["FORCE"]:
|
||||||
appenv.AlwaysBuild([extapp.compact for extapp in apps_artifacts.values()])
|
appenv.AlwaysBuild([extapp.compact for extapp in apps_artifacts.values()])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user