Merge branch 'Flipper-XFW:dev' into dev

This commit is contained in:
Sil
2023-07-24 17:22:24 +02:00
committed by GitHub
454 changed files with 299 additions and 98 deletions

2
.gitignore vendored
View File

@@ -81,4 +81,4 @@ fbt_options.py
assets/dolphin/custom/* assets/dolphin/custom/*
!assets/dolphin/custom/WatchDogs/ !assets/dolphin/custom/WatchDogs/
!assets/dolphin/custom/ReadMe.md !assets/dolphin/custom/ReadMe.md
assets/resources/dolphin_custom/ assets/resources/asset_packs/

View File

@@ -67,7 +67,7 @@ You can easily create your own pack, or find some user made ones in the discord
<br> <br>
<img src="https://user-images.githubusercontent.com/55334727/214016338-95a619c7-88d2-4db5-bb7a-75282d9082b8.png" align="left" width="200px"/> <img src="https://user-images.githubusercontent.com/55334727/214016338-95a619c7-88d2-4db5-bb7a-75282d9082b8.png" align="left" width="200px"/>
Once you have some packs, upload them to your Flipper in <code>SD/dolphin_custom</code> (if you did this right you should see <code>SD/dolphin_custom/PackName/Anims</code> and/or <code>SD/dolphin_custom/PackName/Icons</code>). Once you have some packs, upload them to your Flipper in <code>SD/asset_packs</code> (if you did this right you should see <code>SD/asset_packs/PackName/Anims</code> and/or <code>SD/asset_packs/PackName/Icons</code>).
<br clear="left"/> <br clear="left"/>

View File

@@ -32,11 +32,12 @@ static void xtreme_app_scene_interface_lockscreen_bad_pins_format_changed(Variab
app->save_settings = true; app->save_settings = true;
} }
static void xtreme_app_scene_interface_lockscreen_pin_unlock_from_app_changed(VariableItem* item) { static void
xtreme_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item); XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item); bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF"); variable_item_set_current_value_text(item, value ? "ON" : "OFF");
XTREME_SETTINGS()->pin_unlock_from_app = value; XTREME_SETTINGS()->allow_locked_rpc_commands = value;
app->save_settings = true; app->save_settings = true;
} }
@@ -107,13 +108,13 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) {
item = variable_item_list_add( item = variable_item_list_add(
var_item_list, var_item_list,
"PIN Unlock From App", "Allow RPC while locked",
2, 2,
xtreme_app_scene_interface_lockscreen_pin_unlock_from_app_changed, xtreme_app_scene_interface_lockscreen_allow_locked_rpc_commands_changed,
app); app);
variable_item_set_current_value_index(item, xtreme_settings->pin_unlock_from_app); variable_item_set_current_value_index(item, xtreme_settings->allow_locked_rpc_commands);
variable_item_set_current_value_text( variable_item_set_current_value_text(
item, xtreme_settings->pin_unlock_from_app ? "ON" : "OFF"); item, xtreme_settings->allow_locked_rpc_commands ? "ON" : "OFF");
item = variable_item_list_add( item = variable_item_list_add(
var_item_list, var_item_list,

View File

@@ -216,19 +216,9 @@ static void bt_rpc_send_bytes_callback(void* context, uint8_t* bytes, size_t byt
} }
} }
// Called from GAP thread // Open BT Connection
static bool bt_on_gap_event_callback(GapEvent event, void* context) { void bt_open_rpc_connection(Bt* bt) {
furi_assert(context); if(!bt->rpc_session && bt->status == BtStatusConnected) {
Bt* bt = context;
bool ret = false;
bt->pin = 0;
if(event.type == GapEventTypeConnected) {
// Update status bar
bt->status = BtStatusConnected;
BtMessage message = {.type = BtMessageTypeUpdateStatus};
furi_check(
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
// Clear BT_RPC_EVENT_DISCONNECTED because it might be set from previous session // Clear BT_RPC_EVENT_DISCONNECTED because it might be set from previous session
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) {
@@ -247,6 +237,33 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
FURI_LOG_W(TAG, "RPC is busy, failed to open new session"); FURI_LOG_W(TAG, "RPC is busy, failed to open new session");
} }
} }
}
}
void bt_close_rpc_connection(Bt* bt) {
if(bt->profile == BtProfileSerial && bt->rpc_session) {
FURI_LOG_I(TAG, "Close RPC connection");
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
rpc_session_close(bt->rpc_session);
furi_hal_bt_serial_set_event_callback(0, NULL, NULL);
bt->rpc_session = NULL;
}
}
// Called from GAP thread
static bool bt_on_gap_event_callback(GapEvent event, void* context) {
furi_assert(context);
Bt* bt = context;
bool ret = false;
bt->pin = 0;
if(event.type == GapEventTypeConnected) {
// Update status bar
bt->status = BtStatusConnected;
BtMessage message = {.type = BtMessageTypeUpdateStatus};
furi_check(
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
bt_open_rpc_connection(bt);
// Update battery level // Update battery level
PowerInfo info; PowerInfo info;
power_get_info(bt->power, &info); power_get_info(bt->power, &info);
@@ -323,16 +340,6 @@ static void bt_show_warning(Bt* bt, const char* text) {
dialog_message_show(bt->dialogs, bt->dialog_message); dialog_message_show(bt->dialogs, bt->dialog_message);
} }
static void bt_close_rpc_connection(Bt* bt) {
if(bt->profile == BtProfileSerial && bt->rpc_session) {
FURI_LOG_I(TAG, "Close RPC connection");
furi_event_flag_set(bt->rpc_event, BT_RPC_EVENT_DISCONNECTED);
rpc_session_close(bt->rpc_session);
furi_hal_bt_serial_set_event_callback(0, NULL, NULL);
bt->rpc_session = NULL;
}
}
static void bt_change_profile(Bt* bt, BtMessage* message) { static void bt_change_profile(Bt* bt, BtMessage* message) {
if(furi_hal_bt_is_ble_gatt_gap_supported()) { if(furi_hal_bt_is_ble_gatt_gap_supported()) {
bt_settings_load(&bt->bt_settings); bt_settings_load(&bt->bt_settings);

View File

@@ -99,6 +99,19 @@ void bt_disable_peer_key_update(Bt* bt);
*/ */
void bt_enable_peer_key_update(Bt* bt); void bt_enable_peer_key_update(Bt* bt);
/**
*
* (Probably bad) way of opening the RPC connection, everywhereTM
*/
void bt_open_rpc_connection(Bt* bt);
/**
*
* Closing the RPC connection, everywhereTM
*/
void bt_close_rpc_connection(Bt* bt);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -14,7 +14,7 @@
#include <xtreme.h> #include <xtreme.h>
#define ANIMATION_META_FILE "meta.txt" #define ANIMATION_META_FILE "meta.txt"
#define TAG "AnimationStorage" #define TAG "AnimationStorage"
char ANIMATION_DIR[26 /*"/ext/dolphin_custom//Anims"*/ + XTREME_ASSETS_PACK_NAME_LEN + 1]; char ANIMATION_DIR[26 /*"/ext/asset_packs//Anims"*/ + XTREME_ASSETS_PACK_NAME_LEN + 1];
char ANIMATION_MANIFEST_FILE[sizeof(ANIMATION_DIR) + 13 /*"/manifest.txt"*/]; char ANIMATION_MANIFEST_FILE[sizeof(ANIMATION_DIR) + 13 /*"/manifest.txt"*/];
static void animation_storage_free_bubbles(BubbleAnimation* animation); static void animation_storage_free_bubbles(BubbleAnimation* animation);

View File

@@ -242,6 +242,11 @@ void desktop_lock(Desktop* desktop, bool pin_lock) {
Cli* cli = furi_record_open(RECORD_CLI); Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli); cli_session_close(cli);
furi_record_close(RECORD_CLI); furi_record_close(RECORD_CLI);
if(!XTREME_SETTINGS()->allow_locked_rpc_commands) {
Bt* bt = furi_record_open(RECORD_BT);
bt_close_rpc_connection(bt);
furi_record_close(RECORD_BT);
}
} }
desktop_auto_lock_inhibit(desktop); desktop_auto_lock_inhibit(desktop);
@@ -270,6 +275,10 @@ void desktop_unlock(Desktop* desktop) {
furi_record_close(RECORD_CLI); furi_record_close(RECORD_CLI);
} }
Bt* bt = furi_record_open(RECORD_BT);
bt_open_rpc_connection(bt);
furi_record_close(RECORD_BT);
DesktopStatus status = {.locked = false}; DesktopStatus status = {.locked = false};
furi_pubsub_publish(desktop->status_pubsub, &status); furi_pubsub_publish(desktop->status_pubsub, &status);
} }
@@ -435,9 +444,7 @@ bool desktop_api_is_locked(Desktop* instance) {
void desktop_api_unlock(Desktop* instance) { void desktop_api_unlock(Desktop* instance) {
furi_assert(instance); furi_assert(instance);
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock) || XTREME_SETTINGS()->pin_unlock_from_app) { view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopLockedEventUnlocked);
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopLockedEventUnlocked);
}
} }
FuriPubSub* desktop_api_get_status_pubsub(Desktop* instance) { FuriPubSub* desktop_api_get_status_pubsub(Desktop* instance) {

View File

@@ -1,4 +1,4 @@
#include "text_input.h" #include "text_input_i.h"
#include <gui/elements.h> #include <gui/elements.h>
#include <assets_icons.h> #include <assets_icons.h>
#include <furi.h> #include <furi.h>
@@ -51,7 +51,7 @@ static const uint8_t keyboard_count = 2;
#define ENTER_KEY '\r' #define ENTER_KEY '\r'
#define BACKSPACE_KEY '\b' #define BACKSPACE_KEY '\b'
#define SWITCH_KEYBOARD_KEY 0xfe #define SWITCH_KEYBOARD_KEY '\t'
static const TextInputKey keyboard_keys_row_1[] = { static const TextInputKey keyboard_keys_row_1[] = {
{'q', 1, 8}, {'q', 1, 8},
@@ -490,7 +490,7 @@ static void text_input_handle_ok(TextInput* text_input, TextInputModel* model, I
} }
} }
static bool text_input_view_input_callback(InputEvent* event, void* context) { bool text_input_view_input_callback(InputEvent* event, void* context) {
TextInput* text_input = context; TextInput* text_input = context;
furi_assert(text_input); furi_assert(text_input);
@@ -811,3 +811,52 @@ void text_input_set_header_text(TextInput* text_input, const char* text) {
with_view_model( with_view_model(
text_input->view, TextInputModel * model, { model->header = text; }, true); text_input->view, TextInputModel * model, { model->header = text; }, true);
} }
bool text_input_insert_character(TextInput* text_input, char chr) {
if(chr == 0x1b) { // Arrow escape code = Select input row
with_view_model(
text_input->view,
TextInputModel * model,
{
model->cursor_select = true;
model->clear_default_text = false;
model->selected_row = 0;
},
true);
return false; // Don't consume so CLI gives arrow input
}
if(chr == 0x01) { // Ctrl A = Select all text
with_view_model(
text_input->view, TextInputModel * model, { model->clear_default_text = true; }, true);
return true;
}
for(size_t k = 0; k < keyboard_count; k++) {
const Keyboard* keyboard = keyboards[k];
for(size_t r = 0; r < keyboard_row_count; r++) {
const TextInputKey* row = get_row(keyboard, r);
uint8_t size = get_row_size(keyboard, r);
for(size_t key = 0; key < size; key++) {
char lower = row[key].text;
char upper = char_to_uppercase(lower);
if(chr == lower || chr == upper) {
with_view_model(
text_input->view,
TextInputModel * model,
{
model->cursor_select = false;
model->selected_keyboard = k;
model->selected_row = r;
model->selected_column = key;
bool shift = (chr == upper) != (model->clear_default_text ||
strlen(model->text_buffer) == 0);
text_input_handle_ok(
text_input, model, shift ? InputTypeLong : InputTypeShort);
},
true);
return true;
}
}
}
}
return false;
}

View File

@@ -89,6 +89,8 @@ void* text_input_get_validator_callback_context(TextInput* text_input);
*/ */
void text_input_set_header_text(TextInput* text_input, const char* text); void text_input_set_header_text(TextInput* text_input, const char* text);
bool text_input_insert_character(TextInput* text_input, char c);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -0,0 +1,5 @@
#pragma once
#include "text_input.h"
bool text_input_view_input_callback(InputEvent* event, void* context);

View File

@@ -68,6 +68,23 @@ const char* input_get_type_name(InputType type) {
} }
} }
void input_fake_event(Input* input, InputKey key, InputType type) {
bool wrap = type == InputTypeShort || type == InputTypeLong;
InputEvent event;
event.key = key;
if(wrap) {
event.type = InputTypePress;
furi_pubsub_publish(input->event_pubsub, &event);
}
event.type = type;
furi_pubsub_publish(input->event_pubsub, &event);
if(wrap) {
event.type = InputTypeRelease;
furi_pubsub_publish(input->event_pubsub, &event);
}
}
int32_t input_srv(void* p) { int32_t input_srv(void* p) {
UNUSED(p); UNUSED(p);
input = malloc(sizeof(Input)); input = malloc(sizeof(Input));

View File

@@ -3,6 +3,10 @@
#include <furi.h> #include <furi.h>
#include <cli/cli.h> #include <cli/cli.h>
#include <toolbox/args.h> #include <toolbox/args.h>
#include <gui/view_i.h>
#include <gui/view_port_i.h>
#include <gui/view_dispatcher_i.h>
#include <gui/modules/text_input_i.h>
static void input_cli_usage() { static void input_cli_usage() {
printf("Usage:\r\n"); printf("Usage:\r\n");
@@ -10,6 +14,7 @@ static void input_cli_usage() {
printf("Cmd list:\r\n"); printf("Cmd list:\r\n");
printf("\tdump\t\t\t - dump input events\r\n"); printf("\tdump\t\t\t - dump input events\r\n");
printf("\tsend <key> <type>\t - send input event\r\n"); printf("\tsend <key> <type>\t - send input event\r\n");
printf("\tkeyboard\t\t - read keyboard input and control flipper with it\r\n");
} }
static void input_cli_dump_events_callback(const void* value, void* ctx) { static void input_cli_dump_events_callback(const void* value, void* ctx) {
@@ -40,6 +45,82 @@ static void input_cli_dump(Cli* cli, FuriString* args, Input* input) {
furi_message_queue_free(input_queue); furi_message_queue_free(input_queue);
} }
static void input_cli_keyboard(Cli* cli, FuriString* args, Input* input) {
UNUSED(args);
Gui* gui = furi_record_open(RECORD_GUI);
printf("Using console keyboard feedback for flipper input\r\n");
printf("\r\nUsage:\r\n");
printf("\tMove = Arrows\r\n");
printf("\tOk = Enter\r\n");
printf("\tHold Ok = Shift + Enter\r\n");
printf("\tBack = Backspace\r\n");
printf("\r\nIn Keyboard:\r\n");
printf("\tType normally on PC Keyboard\r\n");
printf("\tQuit = Ctrl + Q\r\n");
printf("\tSelect All = Ctrl + A\r\n");
printf("\tMove Cursor = Arrows\r\n");
printf("\tSave Text = Enter\r\n");
printf("\r\nPress CTRL+C to stop\r\n");
while(cli_is_connected(cli)) {
char in_chr = cli_getc(cli);
if(in_chr == CliSymbolAsciiETX) break;
InputKey send_key = InputKeyMAX;
InputType send_type = InputTypeShort;
ViewPort* view_port = gui->ongoing_input_view_port;
if(view_port && view_port->input_callback == view_dispatcher_input_callback) {
ViewDispatcher* view_dispatcher = view_port->input_callback_context;
if(view_dispatcher) {
View* view = view_dispatcher->current_view;
if(view && view->input_callback == text_input_view_input_callback) {
TextInput* text_input = view->context;
if(text_input) {
if(in_chr == 0x11) { // Ctrl Q = Close text input
send_key = InputKeyBack;
} else if(text_input_insert_character(text_input, in_chr)) {
continue;
}
}
}
}
}
if(send_key == InputKeyMAX) {
switch(in_chr) {
case CliSymbolAsciiEsc: // Escape code for arrows
if(!cli_read(cli, (uint8_t*)&in_chr, 1) || in_chr != '[') break;
if(!cli_read(cli, (uint8_t*)&in_chr, 1)) break;
if(in_chr >= 'A' && in_chr <= 'D') { // Arrows = Dpad
send_key = in_chr - 'A'; // Arrows in same order as InputKey
}
break;
case CliSymbolAsciiBackspace: // Backspace = Back
send_key = InputKeyBack;
break;
case 0x4d: // Shift Enter = Hold Ok
send_type = InputTypeLong;
/* fall through */
case CliSymbolAsciiCR: // Enter = Ok
send_key = InputKeyOk;
break;
default:
printf("ignoring key: %u\r\n", in_chr);
break;
}
}
if(send_key != InputKeyMAX) {
input_fake_event(input, send_key, send_type);
}
}
furi_record_close(RECORD_GUI);
}
static void input_cli_send_print_usage() { static void input_cli_send_print_usage() {
printf("Invalid arguments. Usage:\r\n"); printf("Invalid arguments. Usage:\r\n");
printf("\tinput send <key> <type>\r\n"); printf("\tinput send <key> <type>\r\n");
@@ -49,7 +130,8 @@ static void input_cli_send_print_usage() {
static void input_cli_send(Cli* cli, FuriString* args, Input* input) { static void input_cli_send(Cli* cli, FuriString* args, Input* input) {
UNUSED(cli); UNUSED(cli);
InputEvent event; InputKey key;
InputType type;
FuriString* key_str; FuriString* key_str;
key_str = furi_string_alloc(); key_str = furi_string_alloc();
bool parsed = false; bool parsed = false;
@@ -60,29 +142,29 @@ static void input_cli_send(Cli* cli, FuriString* args, Input* input) {
break; break;
} }
if(!furi_string_cmp(key_str, "up")) { if(!furi_string_cmp(key_str, "up")) {
event.key = InputKeyUp; key = InputKeyUp;
} else if(!furi_string_cmp(key_str, "down")) { } else if(!furi_string_cmp(key_str, "down")) {
event.key = InputKeyDown; key = InputKeyDown;
} else if(!furi_string_cmp(key_str, "left")) { } else if(!furi_string_cmp(key_str, "left")) {
event.key = InputKeyLeft; key = InputKeyLeft;
} else if(!furi_string_cmp(key_str, "right")) { } else if(!furi_string_cmp(key_str, "right")) {
event.key = InputKeyRight; key = InputKeyRight;
} else if(!furi_string_cmp(key_str, "ok")) { } else if(!furi_string_cmp(key_str, "ok")) {
event.key = InputKeyOk; key = InputKeyOk;
} else if(!furi_string_cmp(key_str, "back")) { } else if(!furi_string_cmp(key_str, "back")) {
event.key = InputKeyBack; key = InputKeyBack;
} else { } else {
break; break;
} }
// Parse Type // Parse Type
if(!furi_string_cmp(args, "press")) { if(!furi_string_cmp(args, "press")) {
event.type = InputTypePress; type = InputTypePress;
} else if(!furi_string_cmp(args, "release")) { } else if(!furi_string_cmp(args, "release")) {
event.type = InputTypeRelease; type = InputTypeRelease;
} else if(!furi_string_cmp(args, "short")) { } else if(!furi_string_cmp(args, "short")) {
event.type = InputTypeShort; type = InputTypeShort;
} else if(!furi_string_cmp(args, "long")) { } else if(!furi_string_cmp(args, "long")) {
event.type = InputTypeLong; type = InputTypeLong;
} else { } else {
break; break;
} }
@@ -90,7 +172,7 @@ static void input_cli_send(Cli* cli, FuriString* args, Input* input) {
} while(false); } while(false);
if(parsed) { //-V547 if(parsed) { //-V547
furi_pubsub_publish(input->event_pubsub, &event); input_fake_event(input, key, type);
} else { } else {
input_cli_send_print_usage(); input_cli_send_print_usage();
} }
@@ -113,6 +195,10 @@ void input_cli(Cli* cli, FuriString* args, void* context) {
input_cli_dump(cli, args, input); input_cli_dump(cli, args, input);
break; break;
} }
if(furi_string_cmp_str(cmd, "keyboard") == 0) {
input_cli_keyboard(cli, args, input);
break;
}
if(furi_string_cmp_str(cmd, "send") == 0) { if(furi_string_cmp_str(cmd, "send") == 0) {
input_cli_send(cli, args, input); input_cli_send(cli, args, input);
break; break;

View File

@@ -46,3 +46,5 @@ void input_isr(void* _ctx);
/** Input CLI command handler */ /** Input CLI command handler */
void input_cli(Cli* cli, FuriString* args, void* context); void input_cli(Cli* cli, FuriString* args, void* context);
void input_fake_event(Input* input, InputKey key, InputType type);

View File

@@ -338,9 +338,6 @@ Power* power_alloc() {
power->settings_events_subscription = power->settings_events_subscription =
furi_pubsub_subscribe(power->settings_events, power_shutdown_time_changed_callback, power); furi_pubsub_subscribe(power->settings_events, power_shutdown_time_changed_callback, power);
power->input_events_pubsub = furi_record_open(RECORD_INPUT_EVENTS);
power->input_events_subscription = NULL;
// State initialization // State initialization
power->state = PowerStateNotCharging; power->state = PowerStateNotCharging;
power->battery_low = false; power->battery_low = false;

View File

@@ -9,11 +9,13 @@
#include <portmacro.h> #include <portmacro.h>
#include <furi.h> #include <furi.h>
#include <furi_hal.h>
#include <cli/cli.h> #include <cli/cli.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <m-dict.h> #include <m-dict.h>
#include <xtreme.h>
#define TAG "RpcSrv" #define TAG "RpcSrv"
@@ -363,41 +365,47 @@ static void rpc_session_thread_state_callback(FuriThreadState thread_state, void
} }
RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) { RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner) {
furi_assert(rpc); if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock) ||
XTREME_SETTINGS()->allow_locked_rpc_commands) {
furi_assert(rpc);
RpcSession* session = malloc(sizeof(RpcSession)); RpcSession* session = malloc(sizeof(RpcSession));
session->callbacks_mutex = furi_mutex_alloc(FuriMutexTypeNormal); session->callbacks_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
session->stream = furi_stream_buffer_alloc(RPC_BUFFER_SIZE, 1); session->stream = furi_stream_buffer_alloc(RPC_BUFFER_SIZE, 1);
session->rpc = rpc; session->rpc = rpc;
session->terminate = false; session->terminate = false;
session->decode_error = false; session->decode_error = false;
session->owner = owner; 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));
session->decoded_message->cb_content.funcs.decode = rpc_pb_content_callback; session->decoded_message->cb_content.funcs.decode = rpc_pb_content_callback;
session->decoded_message->cb_content.arg = session; session->decoded_message->cb_content.arg = session;
session->system_contexts = malloc(COUNT_OF(rpc_systems) * sizeof(void*)); session->system_contexts = malloc(COUNT_OF(rpc_systems) * sizeof(void*));
for(size_t i = 0; i < COUNT_OF(rpc_systems); ++i) { for(size_t i = 0; i < COUNT_OF(rpc_systems); ++i) {
session->system_contexts[i] = rpc_systems[i].alloc(session); session->system_contexts[i] = rpc_systems[i].alloc(session);
}
RpcHandler rpc_handler = {
.message_handler = rpc_close_session_process,
.decode_submessage = NULL,
.context = session,
};
rpc_add_handler(session, PB_Main_stop_session_tag, &rpc_handler);
session->thread =
furi_thread_alloc_ex("RpcSessionWorker", 3072, rpc_session_worker, session);
furi_thread_set_state_context(session->thread, session);
furi_thread_set_state_callback(session->thread, rpc_session_thread_state_callback);
furi_thread_start(session->thread);
return session;
} else {
return NULL;
} }
RpcHandler rpc_handler = {
.message_handler = rpc_close_session_process,
.decode_submessage = NULL,
.context = session,
};
rpc_add_handler(session, PB_Main_stop_session_tag, &rpc_handler);
session->thread = furi_thread_alloc_ex("RpcSessionWorker", 3072, rpc_session_worker, session);
furi_thread_set_state_context(session->thread, session);
furi_thread_set_state_callback(session->thread, rpc_session_thread_state_callback);
furi_thread_start(session->thread);
return session;
} }
void rpc_session_close(RpcSession* session) { void rpc_session_close(RpcSession* session) {

View File

@@ -29,7 +29,8 @@ static void storage_cli_print_usage() {
"\twrite_chunk\t - read data from cli and append it to file, <args> should contain how many bytes you want to write\r\n"); "\twrite_chunk\t - read data from cli and append it to file, <args> should contain how many bytes you want to write\r\n");
printf("\tcopy\t - copy file to new file, <args> must contain new path\r\n"); printf("\tcopy\t - copy file to new file, <args> must contain new path\r\n");
printf("\trename\t - move file to new file, <args> must contain new path\r\n"); printf("\trename\t - move file to new file, <args> must contain new path\r\n");
printf("\tmigrate\t - \r\n"); printf(
"\tmigrate\t - move folder to new path, renaming already present files by adding numbers to the end\r\n");
printf("\tmkdir\t - creates a new directory\r\n"); printf("\tmkdir\t - creates a new directory\r\n");
printf("\tmd5\t - md5 hash of the file\r\n"); printf("\tmd5\t - md5 hash of the file\r\n");
printf("\tstat\t - info about file or dir\r\n"); printf("\tstat\t - info about file or dir\r\n");

1
assets/.gitignore vendored
View File

@@ -3,4 +3,5 @@
/resources/apps/* /resources/apps/*
/resources/dolphin/* /resources/dolphin/*
/resources/dolphin_custom/* /resources/dolphin_custom/*
/resources/asset_packs/*
/resources/apps_data/**/*.fal /resources/apps_data/**/*.fal

View File

@@ -34,6 +34,7 @@ Don't include assets that you are not using, compiler is not going to strip unus
# Structure # Structure
- `compiled` - Output folder made for compiled assets, after building project, in `build` directory. - `compiled` - Output folder made for compiled assets, after building project, in `build` directory.
- `dolphin` - Dolphin game assets sources. Goes to `compiled` and `resources` folders in `build` directory. - `dolphin` - Dolphin game assets sources. Goes to `compiled` and `resources` folders in `build` directory.
- `packs` - User-made Asset packs used for basically all scenes. Compiled to `.bmx` and found at `SD/asset_packs`
- `icons` - Icons sources. Goes to `compiled` folder in `build` directory. - `icons` - Icons sources. Goes to `compiled` folder in `build` directory.
- `protobuf` - Protobuf sources. Goes to `compiled` folder in `build` directory. - `protobuf` - Protobuf sources. Goes to `compiled` folder in `build` directory.
- `resources` - Assets that is going to be provisioned to SD card. - `resources` - Assets that is going to be provisioned to SD card.

View File

@@ -2,10 +2,9 @@
Dolphin assets are split into 3 parts: Dolphin assets are split into 3 parts:
- blocking - Essential animations that are used for blocking system notifications. They are packed to `assets_dolphin_blocking.[h,c]`. - blocking - Essential animations that are used for blocking system notifications. They are packed to `assets_dolphin_blocking.[h,c]`.
- internal - Internal animations that are used for idle dolphin animation. Converted to `assets_dolphin_internal.[h,c]`. - internal - Internal animations that are used for idle dolphin animation. Converted to `assets_dolphin_internal.[h,c]`.
- external - External animations that are used for idle dolphin animation. Packed to resource folder and placed on SD card. - external - External animations that are used for idle dolphin animation. Packed to resource folder and placed on SD card.
- custom - Custom User-made animations that are used for a variety of scenes, such as `dolphin idle, passport, scanning`. Compiled to `.bmx` and found at `SD/dolphin_custom`
# Files # Files

View File

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 834 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 834 B

After

Width:  |  Height:  |  Size: 834 B

View File

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 895 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

View File

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 866 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 883 B

View File

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 890 B

View File

Before

Width:  |  Height:  |  Size: 967 B

After

Width:  |  Height:  |  Size: 967 B

View File

Before

Width:  |  Height:  |  Size: 938 B

After

Width:  |  Height:  |  Size: 938 B

View File

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 871 B

View File

Before

Width:  |  Height:  |  Size: 1010 B

After

Width:  |  Height:  |  Size: 1010 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 830 B

View File

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 399 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 185 B

View File

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 104 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 977 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 384 B

View File

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 755 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Some files were not shown because too many files have changed in this diff Show More