mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-22 20:43:07 +00:00
[FL-2675] /int space reservation (#1448)
* storage: added global #defines for /int, /ext & /any * storage: introduced PATH_EXT, PATH_INT& PATH_ANY macros * core apps: moved hardcoded config files names to separate headers; prefixed them with "."; updater: added file name migration to new naming convention on backup extraction * storage: fixed storage_merge_recursive handling of complex directory structures; storage_move_to_sd: changed data migration logic to all non-dot files & all folders * core: added macro aliases for core record names * Bumped protobuf commit pointer * storage: reserved 5 pages in /int; denying write&creation of non-dot files when running out of free space Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
52a83fc929
commit
056446dfed
171 changed files with 1111 additions and 910 deletions
|
@ -156,10 +156,10 @@ const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScr
|
|||
|
||||
int32_t about_settings_app(void* p) {
|
||||
UNUSED(p);
|
||||
DialogsApp* dialogs = furi_record_open("dialogs");
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
ViewDispatcher* view_dispatcher = view_dispatcher_alloc();
|
||||
EmptyScreen* empty_screen = empty_screen_alloc();
|
||||
const uint32_t empty_screen_index = 0;
|
||||
|
@ -198,12 +198,12 @@ int32_t about_settings_app(void* p) {
|
|||
}
|
||||
|
||||
dialog_message_free(message);
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
|
||||
view_dispatcher_remove_view(view_dispatcher, empty_screen_index);
|
||||
view_dispatcher_free(view_dispatcher);
|
||||
empty_screen_free(empty_screen);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -16,7 +16,7 @@ bool archive_back_event_callback(void* context) {
|
|||
ArchiveApp* archive_alloc() {
|
||||
ArchiveApp* archive = malloc(sizeof(ArchiveApp));
|
||||
|
||||
archive->gui = furi_record_open("gui");
|
||||
archive->gui = furi_record_open(RECORD_GUI);
|
||||
archive->text_input = text_input_alloc();
|
||||
string_init(archive->fav_move_str);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void archive_free(ArchiveApp* archive) {
|
|||
|
||||
text_input_free(archive->text_input);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
archive->gui = NULL;
|
||||
|
||||
free(archive);
|
||||
|
|
|
@ -29,21 +29,22 @@ bool archive_app_is_available(void* context, const char* path) {
|
|||
|
||||
if(app == ArchiveAppTypeU2f) {
|
||||
bool file_exists = false;
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
file_exists = storage_file_open(file, "/any/u2f/key.u2f", FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
file_exists =
|
||||
storage_file_open(file, ANY_PATH("u2f/key.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
if(file_exists) {
|
||||
storage_file_close(file);
|
||||
file_exists =
|
||||
storage_file_open(file, "/any/u2f/cnt.u2f", FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
storage_file_open(file, ANY_PATH("u2f/cnt.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
if(file_exists) {
|
||||
storage_file_close(file);
|
||||
}
|
||||
}
|
||||
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return file_exists;
|
||||
} else {
|
||||
|
@ -77,10 +78,10 @@ void archive_app_delete_file(void* context, const char* path) {
|
|||
bool res = false;
|
||||
|
||||
if(app == ArchiveAppTypeU2f) {
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
res = (storage_common_remove(fs_api, "/any/u2f/key.u2f") == FSE_OK);
|
||||
res |= (storage_common_remove(fs_api, "/any/u2f/cnt.u2f") == FSE_OK);
|
||||
furi_record_close("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
res = (storage_common_remove(fs_api, ANY_PATH("u2f/key.u2f")) == FSE_OK);
|
||||
res |= (storage_common_remove(fs_api, ANY_PATH("u2f/cnt.u2f")) == FSE_OK);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
if(archive_is_favorite("/app:u2f/U2F Token")) {
|
||||
archive_favorites_delete("/app:u2f/U2F Token");
|
||||
|
|
|
@ -391,18 +391,18 @@ void archive_favorites_move_mode(ArchiveBrowserView* browser, bool active) {
|
|||
}
|
||||
|
||||
static bool archive_is_dir_exists(string_t path) {
|
||||
if(string_equal_str_p(path, "/any")) {
|
||||
if(string_equal_str_p(path, STORAGE_ANY_PATH_PREFIX)) {
|
||||
return true;
|
||||
}
|
||||
bool state = false;
|
||||
FileInfo file_info;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
if(file_info.flags & FSF_DIRECTORY) {
|
||||
state = true;
|
||||
}
|
||||
}
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../archive_i.h"
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAB_RIGHT InputKeyRight // Default tab swith direction
|
||||
#define TAB_DEFAULT ArchiveTabFavorites // Start tab
|
||||
|
@ -8,14 +9,14 @@
|
|||
|
||||
static const char* tab_default_paths[] = {
|
||||
[ArchiveTabFavorites] = "/app:favorites",
|
||||
[ArchiveTabIButton] = "/any/ibutton",
|
||||
[ArchiveTabNFC] = "/any/nfc",
|
||||
[ArchiveTabSubGhz] = "/any/subghz",
|
||||
[ArchiveTabLFRFID] = "/any/lfrfid",
|
||||
[ArchiveTabInfrared] = "/any/infrared",
|
||||
[ArchiveTabBadUsb] = "/any/badusb",
|
||||
[ArchiveTabIButton] = ANY_PATH("ibutton"),
|
||||
[ArchiveTabNFC] = ANY_PATH("nfc"),
|
||||
[ArchiveTabSubGhz] = ANY_PATH("subghz"),
|
||||
[ArchiveTabLFRFID] = ANY_PATH("lfrfid"),
|
||||
[ArchiveTabInfrared] = ANY_PATH("infrared"),
|
||||
[ArchiveTabBadUsb] = ANY_PATH("badusb"),
|
||||
[ArchiveTabU2f] = "/app:u2f",
|
||||
[ArchiveTabBrowser] = "/any",
|
||||
[ArchiveTabBrowser] = STORAGE_ANY_PATH_PREFIX,
|
||||
};
|
||||
|
||||
static const char* known_ext[] = {
|
||||
|
|
|
@ -49,7 +49,7 @@ static bool archive_favorites_read_line(File* file, string_t str_result) {
|
|||
uint16_t archive_favorites_count(void* context) {
|
||||
furi_assert(context);
|
||||
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
string_t buffer;
|
||||
|
@ -74,7 +74,7 @@ uint16_t archive_favorites_count(void* context) {
|
|||
|
||||
string_clear(buffer);
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ uint16_t archive_favorites_count(void* context) {
|
|||
static bool archive_favourites_rescan() {
|
||||
string_t buffer;
|
||||
string_init(buffer);
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
File* fav_item_file = storage_file_alloc(fs_api);
|
||||
|
||||
|
@ -122,7 +122,7 @@ static bool archive_favourites_rescan() {
|
|||
|
||||
storage_file_free(file);
|
||||
storage_file_free(fav_item_file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ bool archive_favorites_read(void* context) {
|
|||
furi_assert(context);
|
||||
|
||||
ArchiveBrowserView* browser = context;
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
File* fav_item_file = storage_file_alloc(fs_api);
|
||||
|
||||
|
@ -184,7 +184,7 @@ bool archive_favorites_read(void* context) {
|
|||
string_clear(buffer);
|
||||
storage_file_free(file);
|
||||
storage_file_free(fav_item_file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
archive_set_item_count(browser, file_count);
|
||||
|
||||
|
@ -204,7 +204,7 @@ bool archive_favorites_delete(const char* format, ...) {
|
|||
va_end(args);
|
||||
|
||||
string_init(buffer);
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
bool result = storage_file_open(file, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
|
@ -233,7 +233,7 @@ bool archive_favorites_delete(const char* format, ...) {
|
|||
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
|
||||
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ bool archive_is_favorite(const char* format, ...) {
|
|||
va_end(args);
|
||||
|
||||
string_init(buffer);
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
bool found = false;
|
||||
|
@ -272,7 +272,7 @@ bool archive_is_favorite(const char* format, ...) {
|
|||
string_clear(buffer);
|
||||
string_clear(filename);
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ bool archive_favorites_rename(const char* src, const char* dst) {
|
|||
furi_assert(src);
|
||||
furi_assert(dst);
|
||||
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
string_t path;
|
||||
|
@ -318,7 +318,7 @@ bool archive_favorites_rename(const char* src, const char* dst) {
|
|||
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
|
||||
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ void archive_favorites_save(void* context) {
|
|||
furi_assert(context);
|
||||
|
||||
ArchiveBrowserView* browser = context;
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
for(size_t i = 0; i < archive_file_get_array_size(browser); i++) {
|
||||
|
@ -346,5 +346,5 @@ void archive_favorites_save(void* context) {
|
|||
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
|
||||
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define ARCHIVE_FAV_PATH "/any/favorites.txt"
|
||||
#define ARCHIVE_FAV_TEMP_PATH "/any/favorites.tmp"
|
||||
#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt")
|
||||
#define ARCHIVE_FAV_TEMP_PATH ANY_PATH("favorites.tmp")
|
||||
|
||||
uint16_t archive_favorites_count(void* context);
|
||||
bool archive_favorites_read(void* context);
|
||||
|
|
|
@ -60,7 +60,7 @@ void archive_file_append(const char* path, const char* format, ...) {
|
|||
string_init_vprintf(string, format, args);
|
||||
va_end(args);
|
||||
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(fs_api);
|
||||
|
||||
bool res = storage_file_open(file, path, FSAM_WRITE, FSOM_OPEN_APPEND);
|
||||
|
@ -71,7 +71,7 @@ void archive_file_append(const char* path, const char* format, ...) {
|
|||
|
||||
storage_file_close(file);
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
void archive_delete_file(void* context, const char* format, ...) {
|
||||
|
@ -84,7 +84,7 @@ void archive_delete_file(void* context, const char* format, ...) {
|
|||
va_end(args);
|
||||
|
||||
ArchiveBrowserView* browser = context;
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
FileInfo fileinfo;
|
||||
storage_common_stat(fs_api, string_get_cstr(filename), &fileinfo);
|
||||
|
@ -97,7 +97,7 @@ void archive_delete_file(void* context, const char* format, ...) {
|
|||
res = (storage_common_remove(fs_api, string_get_cstr(filename)) == FSE_OK);
|
||||
}
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
if(archive_is_favorite("%s", string_get_cstr(filename))) {
|
||||
archive_favorites_delete("%s", string_get_cstr(filename));
|
||||
|
|
|
@ -36,7 +36,7 @@ static void archive_loader_callback(const void* message, void* context) {
|
|||
|
||||
static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selected) {
|
||||
UNUSED(browser);
|
||||
Loader* loader = furi_record_open("loader");
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
|
||||
LoaderStatus status;
|
||||
if(selected->is_app) {
|
||||
|
@ -54,7 +54,7 @@ static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selec
|
|||
FURI_LOG_E(TAG, "loader_start failed: %d", status);
|
||||
}
|
||||
|
||||
furi_record_close("loader");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
}
|
||||
|
||||
void archive_scene_browser_callback(ArchiveBrowserEvent event, void* context) {
|
||||
|
@ -71,10 +71,10 @@ void archive_scene_browser_on_enter(void* context) {
|
|||
archive_update_focus(browser, archive->text_store);
|
||||
view_dispatcher_switch_to_view(archive->view_dispatcher, ArchiveViewBrowser);
|
||||
|
||||
Loader* loader = furi_record_open("loader");
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
archive->loader_stop_subscription =
|
||||
furi_pubsub_subscribe(loader_get_pubsub(loader), archive_loader_callback, archive);
|
||||
furi_record_close("loader");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
uint32_t state = scene_manager_get_scene_state(archive->scene_manager, ArchiveAppSceneBrowser);
|
||||
|
||||
|
@ -196,10 +196,10 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
if(!archive_is_home(browser)) {
|
||||
archive_leave_dir(browser);
|
||||
} else {
|
||||
Loader* loader = furi_record_open("loader");
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
furi_pubsub_unsubscribe(
|
||||
loader_get_pubsub(loader), archive->loader_stop_subscription);
|
||||
furi_record_close("loader");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
view_dispatcher_stop(archive->view_dispatcher);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
void archive_scene_browser_on_exit(void* context) {
|
||||
ArchiveApp* archive = (ArchiveApp*)context;
|
||||
|
||||
Loader* loader = furi_record_open("loader");
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
furi_pubsub_unsubscribe(loader_get_pubsub(loader), archive->loader_stop_subscription);
|
||||
furi_record_close("loader");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ bool archive_scene_rename_on_event(void* context, SceneManagerEvent event) {
|
|||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SCENE_RENAME_CUSTOM_EVENT) {
|
||||
Storage* fs_api = furi_record_open("storage");
|
||||
Storage* fs_api = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
const char* path_src = archive_get_name(archive->browser);
|
||||
ArchiveFile_t* file = archive_get_current_file(archive->browser);
|
||||
|
@ -62,7 +62,7 @@ bool archive_scene_rename_on_event(void* context, SceneManagerEvent event) {
|
|||
string_cat_printf(path_dst, "/%s%s", archive->text_store, known_ext[file->type]);
|
||||
|
||||
storage_common_rename(fs_api, path_src, string_get_cstr(path_dst));
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
if(file->fav) {
|
||||
archive_favorites_rename(path_src, string_get_cstr(path_dst));
|
||||
|
|
|
@ -32,9 +32,9 @@ BadUsbApp* bad_usb_app_alloc(char* arg) {
|
|||
string_set_str(app->file_path, arg);
|
||||
}
|
||||
|
||||
app->gui = furi_record_open("gui");
|
||||
app->notifications = furi_record_open("notification");
|
||||
app->dialogs = furi_record_open("dialogs");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
app->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_enable_queue(app->view_dispatcher);
|
||||
|
@ -92,9 +92,9 @@ void bad_usb_app_free(BadUsbApp* app) {
|
|||
scene_manager_free(app->scene_manager);
|
||||
|
||||
// Close records
|
||||
furi_record_close("gui");
|
||||
furi_record_close("notification");
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
|
||||
string_clear(app->file_path);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <gui/modules/widget.h>
|
||||
#include "views/bad_usb_view.h"
|
||||
|
||||
#define BAD_USB_APP_PATH_FOLDER "/any/badusb"
|
||||
#define BAD_USB_APP_PATH_FOLDER ANY_PATH("badusb")
|
||||
#define BAD_USB_APP_EXTENSION ".txt"
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -455,7 +455,7 @@ static int32_t bad_usb_worker(void* context) {
|
|||
FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
|
||||
|
||||
FURI_LOG_I(WORKER_TAG, "Init");
|
||||
File* script_file = storage_file_alloc(furi_record_open("storage"));
|
||||
File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
string_init(bad_usb->line);
|
||||
string_init(bad_usb->line_prev);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static void bt_cli_command_carrier_tx(Cli* cli, string_t args, void* context) {
|
|||
break;
|
||||
}
|
||||
|
||||
Bt* bt = furi_record_open("bt");
|
||||
Bt* bt = furi_record_open(RECORD_BT);
|
||||
bt_disconnect(bt);
|
||||
furi_hal_bt_reinit();
|
||||
printf("Transmitting carrier at %d channel at %d dB power\r\n", channel, power);
|
||||
|
@ -46,7 +46,7 @@ static void bt_cli_command_carrier_tx(Cli* cli, string_t args, void* context) {
|
|||
furi_hal_bt_stop_tone_tx();
|
||||
|
||||
bt_set_profile(bt, BtProfileSerial);
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
} while(false);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ static void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
|
|||
break;
|
||||
}
|
||||
|
||||
Bt* bt = furi_record_open("bt");
|
||||
Bt* bt = furi_record_open(RECORD_BT);
|
||||
bt_disconnect(bt);
|
||||
furi_hal_bt_reinit();
|
||||
printf("Receiving carrier at %d channel\r\n", channel);
|
||||
|
@ -77,7 +77,7 @@ static void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
|
|||
furi_hal_bt_stop_packet_test();
|
||||
|
||||
bt_set_profile(bt, BtProfileSerial);
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
} while(false);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ static void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
|
|||
break;
|
||||
}
|
||||
|
||||
Bt* bt = furi_record_open("bt");
|
||||
Bt* bt = furi_record_open(RECORD_BT);
|
||||
bt_disconnect(bt);
|
||||
furi_hal_bt_reinit();
|
||||
printf(
|
||||
|
@ -125,7 +125,7 @@ static void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
|
|||
printf("Transmitted %lu packets", furi_hal_bt_get_transmitted_packets());
|
||||
|
||||
bt_set_profile(bt, BtProfileSerial);
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
} while(false);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ static void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
|
|||
break;
|
||||
}
|
||||
|
||||
Bt* bt = furi_record_open("bt");
|
||||
Bt* bt = furi_record_open(RECORD_BT);
|
||||
bt_disconnect(bt);
|
||||
furi_hal_bt_reinit();
|
||||
printf("Receiving packets at %d channel at %d M datarate\r\n", channel, datarate);
|
||||
|
@ -160,7 +160,7 @@ static void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
|
|||
printf("Received %hu packets", packets_received);
|
||||
|
||||
bt_set_profile(bt, BtProfileSerial);
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
} while(false);
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ static void bt_cli_print_usage() {
|
|||
|
||||
static void bt_cli(Cli* cli, string_t args, void* context) {
|
||||
UNUSED(context);
|
||||
furi_record_open("bt");
|
||||
furi_record_open(RECORD_BT);
|
||||
|
||||
string_t cmd;
|
||||
string_init(cmd);
|
||||
|
@ -223,14 +223,14 @@ static void bt_cli(Cli* cli, string_t args, void* context) {
|
|||
}
|
||||
|
||||
string_clear(cmd);
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
}
|
||||
|
||||
void bt_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
cli_add_command(cli, "bt", CliCommandFlagDefault, bt_cli, NULL);
|
||||
furi_record_close("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, RECORD_BT, CliCommandFlagDefault, bt_cli, NULL);
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(bt_cli);
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,7 @@ BtDebugApp* bt_debug_app_alloc() {
|
|||
bt_settings_load(&app->settings);
|
||||
|
||||
// Gui
|
||||
app->gui = furi_record_open("gui");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// View dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@ -88,7 +88,7 @@ void bt_debug_app_free(BtDebugApp* app) {
|
|||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
// Close gui record
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
app->gui = NULL;
|
||||
|
||||
// Free rest
|
||||
|
@ -99,7 +99,7 @@ int32_t bt_debug_app(void* p) {
|
|||
UNUSED(p);
|
||||
if(!furi_hal_bt_is_testing_supported()) {
|
||||
FURI_LOG_E(TAG, "Incorrect radio stack: radio testing fetures are absent.");
|
||||
DialogsApp* dialogs = furi_record_open("dialogs");
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
dialog_message_show_storage_error(dialogs, "Incorrect\nRadioStack");
|
||||
return 255;
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ BtHid* bt_hid_app_alloc() {
|
|||
BtHid* app = malloc(sizeof(BtHid));
|
||||
|
||||
// Gui
|
||||
app->gui = furi_record_open("gui");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// Bt
|
||||
app->bt = furi_record_open("bt");
|
||||
app->bt = furi_record_open(RECORD_BT);
|
||||
|
||||
// Notifications
|
||||
app->notifications = furi_record_open("notification");
|
||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// View dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@ -161,11 +161,11 @@ void bt_hid_app_free(BtHid* app) {
|
|||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
// Close records
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
app->gui = NULL;
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
app->notifications = NULL;
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_BT);
|
||||
app->bt = NULL;
|
||||
|
||||
// Free rest
|
||||
|
|
|
@ -124,23 +124,23 @@ Bt* bt_alloc() {
|
|||
// Pin code view port
|
||||
bt->pin_code_view_port = bt_pin_code_view_port_alloc(bt);
|
||||
// Notification
|
||||
bt->notification = furi_record_open("notification");
|
||||
bt->notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
// Gui
|
||||
bt->gui = furi_record_open("gui");
|
||||
bt->gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(bt->gui, bt->statusbar_view_port, GuiLayerStatusBarLeft);
|
||||
gui_add_view_port(bt->gui, bt->pin_code_view_port, GuiLayerFullscreen);
|
||||
|
||||
// Dialogs
|
||||
bt->dialogs = furi_record_open("dialogs");
|
||||
bt->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
bt->dialog_message = dialog_message_alloc();
|
||||
|
||||
// Power
|
||||
bt->power = furi_record_open("power");
|
||||
bt->power = furi_record_open(RECORD_POWER);
|
||||
FuriPubSub* power_pubsub = power_get_pubsub(bt->power);
|
||||
furi_pubsub_subscribe(power_pubsub, bt_battery_level_changed_callback, bt);
|
||||
|
||||
// RPC
|
||||
bt->rpc = furi_record_open("rpc");
|
||||
bt->rpc = furi_record_open(RECORD_RPC);
|
||||
bt->rpc_event = furi_event_flag_alloc();
|
||||
|
||||
// API evnent
|
||||
|
@ -353,7 +353,7 @@ int32_t bt_srv() {
|
|||
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
|
||||
FURI_LOG_W(TAG, "Skipped BT init: device in special startup mode");
|
||||
ble_glue_wait_for_c2_start(FURI_HAL_BT_C2_START_TIMEOUT);
|
||||
furi_record_create("bt", bt);
|
||||
furi_record_create(RECORD_BT, bt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ int32_t bt_srv() {
|
|||
bt->status = BtStatusUnavailable;
|
||||
}
|
||||
|
||||
furi_record_create("bt", bt);
|
||||
furi_record_create(RECORD_BT, bt);
|
||||
|
||||
BtMessage message;
|
||||
while(1) {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RECORD_BT "bt"
|
||||
|
||||
typedef struct Bt Bt;
|
||||
|
||||
typedef enum {
|
||||
|
|
3
applications/bt/bt_service/bt_keys_filename.h
Normal file
3
applications/bt/bt_service/bt_keys_filename.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define BT_KEYS_STORAGE_FILE_NAME ".bt.keys"
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
#include <furi.h>
|
||||
#include <lib/toolbox/saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define BT_KEYS_STORAGE_PATH "/int/bt.keys"
|
||||
#define BT_KEYS_STORAGE_PATH INT_PATH(BT_KEYS_STORAGE_FILE_NAME)
|
||||
#define BT_KEYS_STORAGE_VERSION (0)
|
||||
#define BT_KEYS_STORAGE_MAGIC (0x18)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "bt_i.h"
|
||||
#include "bt_keys_filename.h"
|
||||
|
||||
bool bt_keys_storage_load(Bt* bt);
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
#include <furi.h>
|
||||
#include <lib/toolbox/saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define BT_SETTINGS_PATH "/int/bt.settings"
|
||||
#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME)
|
||||
#define BT_SETTINGS_VERSION (0)
|
||||
#define BT_SETTINGS_MAGIC (0x19)
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "bt_settings_filename.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ BtSettingsApp* bt_settings_app_alloc() {
|
|||
|
||||
// Load settings
|
||||
bt_settings_load(&app->settings);
|
||||
app->gui = furi_record_open("gui");
|
||||
app->bt = furi_record_open("bt");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->bt = furi_record_open(RECORD_BT);
|
||||
|
||||
// View Dispatcher and Scene Manager
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@ -70,8 +70,8 @@ void bt_settings_app_free(BtSettingsApp* app) {
|
|||
scene_manager_free(app->scene_manager);
|
||||
|
||||
// Records
|
||||
furi_record_close("gui");
|
||||
furi_record_close("bt");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_BT);
|
||||
free(app);
|
||||
}
|
||||
|
||||
|
|
3
applications/bt/bt_settings_filename.h
Normal file
3
applications/bt/bt_settings_filename.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define BT_SETTINGS_FILE_NAME ".bt.settings"
|
|
@ -185,7 +185,7 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
|
|||
|
||||
// Ensure that we running alone
|
||||
if(!(command->flags & CliCommandFlagParallelSafe)) {
|
||||
Loader* loader = furi_record_open("loader");
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
bool safety_lock = loader_lock(loader);
|
||||
if(safety_lock) {
|
||||
// Execute command
|
||||
|
@ -194,7 +194,7 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
|
|||
} else {
|
||||
printf("Other application is running, close it first");
|
||||
}
|
||||
furi_record_close("loader");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
} else {
|
||||
// Execute command
|
||||
command->callback(cli, args, command->context);
|
||||
|
@ -466,7 +466,7 @@ int32_t cli_srv(void* p) {
|
|||
// Init basic cli commands
|
||||
cli_commands_init(cli);
|
||||
|
||||
furi_record_create("cli", cli);
|
||||
furi_record_create(RECORD_CLI, cli);
|
||||
|
||||
if(cli->session != NULL) {
|
||||
furi_stdglue_set_thread_stdout_callback(cli->session->tx_stdout);
|
||||
|
|
|
@ -33,6 +33,8 @@ typedef enum {
|
|||
CliCommandFlagInsomniaSafe = (1 << 1), /**< Safe to run with insomnia mode on */
|
||||
} CliCommandFlag;
|
||||
|
||||
#define RECORD_CLI "cli"
|
||||
|
||||
/** Cli type anonymous structure */
|
||||
typedef struct Cli Cli;
|
||||
|
||||
|
|
|
@ -166,13 +166,13 @@ void cli_command_vibro(Cli* cli, string_t args, void* context) {
|
|||
UNUSED(cli);
|
||||
UNUSED(context);
|
||||
if(!string_cmp(args, "0")) {
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
notification_message_block(notification, &sequence_reset_vibro);
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
} else if(!string_cmp(args, "1")) {
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
notification_message_block(notification, &sequence_set_vibro_on);
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
} else {
|
||||
cli_print_usage("vibro", "<1|0>", string_get_cstr(args));
|
||||
}
|
||||
|
@ -244,9 +244,9 @@ void cli_command_led(Cli* cli, string_t args, void* context) {
|
|||
};
|
||||
|
||||
// Send notification
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
notification_internal_message_block(notification, ¬ification_sequence);
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
}
|
||||
|
||||
void cli_command_ps(Cli* cli, string_t args, void* context) {
|
||||
|
|
|
@ -317,9 +317,9 @@ static void crypto_cli(Cli* cli, string_t args, void* context) {
|
|||
|
||||
void crypto_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, "crypto", CliCommandFlagDefault, crypto_cli, NULL);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(crypto_cli);
|
||||
#endif
|
||||
|
|
|
@ -88,10 +88,10 @@ int32_t blink_test_app(void* p) {
|
|||
furi_timer_start(timer, furi_kernel_get_tick_frequency());
|
||||
|
||||
// Register view port in GUI
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
NotificationApp* notifications = furi_record_open("notification");
|
||||
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
uint8_t state = 0;
|
||||
BlinkEvent event;
|
||||
|
@ -119,8 +119,8 @@ int32_t blink_test_app(void* p) {
|
|||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
|
||||
furi_record_close("notification");
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ DisplayTest* display_test_alloc() {
|
|||
|
||||
View* view = NULL;
|
||||
|
||||
instance->gui = furi_record_open("gui");
|
||||
instance->gui = furi_record_open(RECORD_GUI);
|
||||
instance->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_enable_queue(instance->view_dispatcher);
|
||||
view_dispatcher_attach_to_gui(
|
||||
|
@ -206,7 +206,7 @@ void display_test_free(DisplayTest* instance) {
|
|||
view_display_test_free(instance->view_display_test);
|
||||
|
||||
view_dispatcher_free(instance->view_dispatcher);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
free(instance);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ FileBrowserApp* file_browser_app_alloc(char* arg) {
|
|||
UNUSED(arg);
|
||||
FileBrowserApp* app = malloc(sizeof(FileBrowserApp));
|
||||
|
||||
app->gui = furi_record_open("gui");
|
||||
app->dialogs = furi_record_open("dialogs");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_enable_queue(app->view_dispatcher);
|
||||
|
@ -80,9 +80,9 @@ void file_browser_app_free(FileBrowserApp* app) {
|
|||
scene_manager_free(app->scene_manager);
|
||||
|
||||
// Close records
|
||||
furi_record_close("gui");
|
||||
furi_record_close("notification");
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
|
||||
string_clear(app->file_path);
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "../file_browser_app_i.h"
|
||||
#include "furi_hal.h"
|
||||
#include "gui/modules/widget_elements/widget_element_i.h"
|
||||
|
||||
#include <furi_hal.h>
|
||||
#include <gui/modules/widget_elements/widget_element_i.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
static void
|
||||
file_browser_scene_start_ok_callback(GuiButtonType result, InputType type, void* context) {
|
||||
|
@ -17,7 +19,7 @@ bool file_browser_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
string_set_str(app->file_path, "/any/badusb/demo_windows.txt");
|
||||
string_set_str(app->file_path, ANY_PATH("badusb/demo_windows.txt"));
|
||||
scene_manager_next_scene(app->scene_manager, FileBrowserSceneBrowser);
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
|
|
|
@ -78,7 +78,7 @@ int32_t keypad_test_app(void* p) {
|
|||
view_port_input_callback_set(view_port, keypad_test_input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
InputEvent event;
|
||||
|
@ -149,7 +149,7 @@ int32_t keypad_test_app(void* p) {
|
|||
furi_message_queue_free(event_queue);
|
||||
delete_mutex(&state_mutex);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ int32_t text_box_test_app(void* p) {
|
|||
view_port_input_callback_set(view_port, text_box_test_input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
uint32_t test_renders_num = COUNT_OF(text_box_test_render);
|
||||
|
@ -121,7 +121,7 @@ int32_t text_box_test_app(void* p) {
|
|||
furi_message_queue_free(event_queue);
|
||||
delete_mutex(&state_mutex);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -189,8 +189,8 @@ static UartEchoApp* uart_echo_app_alloc() {
|
|||
app->rx_stream = xStreamBufferCreate(2048, 1);
|
||||
|
||||
// Gui
|
||||
app->gui = furi_record_open("gui");
|
||||
app->notification = furi_record_open("notification");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// View dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@ -256,8 +256,8 @@ static void uart_echo_app_free(UartEchoApp* app) {
|
|||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
// Close gui record
|
||||
furi_record_close("gui");
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
app->gui = NULL;
|
||||
|
||||
vStreamBufferDelete(app->rx_stream);
|
||||
|
|
|
@ -51,7 +51,7 @@ int32_t usb_mouse_app(void* p) {
|
|||
view_port_input_callback_set(view_port, usb_mouse_input_callback, event_queue);
|
||||
|
||||
// Open GUI and register view_port
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
UsbMouseEvent event;
|
||||
|
|
|
@ -59,7 +59,7 @@ UsbTestApp* usb_test_app_alloc() {
|
|||
UsbTestApp* app = malloc(sizeof(UsbTestApp));
|
||||
|
||||
// Gui
|
||||
app->gui = furi_record_open("gui");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// View dispatcher
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
|
@ -106,7 +106,7 @@ void usb_test_app_free(UsbTestApp* app) {
|
|||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
// Close gui record
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
app->gui = NULL;
|
||||
|
||||
// Free rest
|
||||
|
|
|
@ -32,10 +32,10 @@ int32_t vibro_test_app(void* p) {
|
|||
view_port_input_callback_set(view_port, vibro_test_input_callback, event_queue);
|
||||
|
||||
// Register view port in GUI
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
InputEvent event;
|
||||
|
||||
|
@ -60,8 +60,8 @@ int32_t vibro_test_app(void* p) {
|
|||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
|
||||
furi_record_close("notification");
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -137,9 +137,9 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
|
|||
bool blocked = animation_manager_check_blocking(animation_manager);
|
||||
|
||||
if(!blocked) {
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(animation_manager->current_animation);
|
||||
|
@ -170,9 +170,9 @@ bool animation_manager_interact_process(AnimationManager* animation_manager) {
|
|||
animation_manager->levelup_pending = false;
|
||||
animation_manager->levelup_active = true;
|
||||
animation_manager_switch_to_one_shot_view(animation_manager);
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
dolphin_upgrade_level(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
} else if(animation_manager->levelup_active) {
|
||||
animation_manager->levelup_active = false;
|
||||
animation_manager_start_new_idle(animation_manager);
|
||||
|
@ -205,7 +205,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
|||
furi_assert(animation_manager);
|
||||
|
||||
StorageAnimation* blocking_animation = NULL;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FS_Error sd_status = storage_sd_status(storage);
|
||||
|
||||
if(sd_status == FSE_INTERNAL) {
|
||||
|
@ -220,7 +220,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
|||
furi_assert(blocking_animation);
|
||||
animation_manager->sd_shown_sd_ok = true;
|
||||
} else if(!animation_manager->sd_shown_no_db) {
|
||||
bool db_exists = storage_common_stat(storage, "/ext/Manifest", NULL) == FSE_OK;
|
||||
bool db_exists = storage_common_stat(storage, EXT_PATH("Manifest"), NULL) == FSE_OK;
|
||||
if(!db_exists) {
|
||||
blocking_animation = animation_storage_find_animation(NO_DB_ANIMATION_NAME);
|
||||
furi_assert(blocking_animation);
|
||||
|
@ -234,9 +234,9 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
|||
}
|
||||
}
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
if(!blocking_animation && stats.level_up_is_pending) {
|
||||
blocking_animation = animation_storage_find_animation(NEW_MAIL_ANIMATION_NAME);
|
||||
furi_assert(blocking_animation);
|
||||
|
@ -252,7 +252,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
|||
animation_manager->state = AnimationManagerStateBlocked;
|
||||
}
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return !!blocking_animation;
|
||||
}
|
||||
|
@ -287,15 +287,15 @@ AnimationManager* animation_manager_alloc(void) {
|
|||
bubble_animation_view_set_interact_callback(
|
||||
animation_manager->animation_view, animation_manager_interact_callback, animation_manager);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
|
||||
storage_get_pubsub(storage), animation_manager_check_blocking_callback, animation_manager);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
|
||||
dolphin_get_pubsub(dolphin), animation_manager_check_blocking_callback, animation_manager);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
animation_manager->sd_shown_sd_ok = true;
|
||||
if(!animation_manager_check_blocking(animation_manager)) {
|
||||
|
@ -308,15 +308,15 @@ AnimationManager* animation_manager_alloc(void) {
|
|||
void animation_manager_free(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
furi_pubsub_unsubscribe(
|
||||
dolphin_get_pubsub(dolphin), animation_manager->pubsub_subscription_dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
furi_pubsub_unsubscribe(
|
||||
storage_get_pubsub(storage), animation_manager->pubsub_subscription_storage);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
string_clear(animation_manager->freezed_animation_name);
|
||||
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
|
||||
|
@ -340,16 +340,16 @@ static bool animation_manager_is_valid_idle_animation(
|
|||
bool result = true;
|
||||
|
||||
if(!strcmp(info->name, BAD_BATTERY_ANIMATION_NAME)) {
|
||||
Power* power = furi_record_open("power");
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
bool battery_is_well = power_is_battery_healthy(power);
|
||||
furi_record_close("power");
|
||||
furi_record_close(RECORD_POWER);
|
||||
|
||||
result = !battery_is_well;
|
||||
}
|
||||
if(!strcmp(info->name, NO_SD_ANIMATION_NAME)) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FS_Error sd_status = storage_sd_status(storage);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
result = (sd_status == FSE_NOT_READY);
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ static StorageAnimation*
|
|||
StorageAnimationList_init(animation_list);
|
||||
animation_storage_fill_animation_list(&animation_list);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
uint32_t whole_weight = 0;
|
||||
|
||||
StorageAnimationList_it_t it;
|
||||
|
@ -492,9 +492,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
|||
StorageAnimation* restore_animation = animation_storage_find_animation(
|
||||
string_get_cstr(animation_manager->freezed_animation_name));
|
||||
if(restore_animation) {
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(restore_animation);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
|
||||
|
@ -543,9 +543,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
|||
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
furi_assert(!animation_manager->one_shot_view);
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
animation_manager->one_shot_view = one_shot_view_alloc();
|
||||
one_shot_view_set_interact_callback(
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <assets_dolphin_blocking.h>
|
||||
|
||||
#define ANIMATION_META_FILE "meta.txt"
|
||||
#define ANIMATION_DIR "/ext/dolphin"
|
||||
#define ANIMATION_DIR EXT_PATH("dolphin")
|
||||
#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt"
|
||||
#define TAG "AnimationStorage"
|
||||
|
||||
|
@ -29,7 +29,7 @@ static bool animation_storage_load_single_manifest_info(
|
|||
furi_assert(manifest_info);
|
||||
|
||||
bool result = false;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
string_t read_string;
|
||||
|
@ -75,7 +75,7 @@ static bool animation_storage_load_single_manifest_info(
|
|||
string_clear(read_string);
|
||||
flipper_format_free(file);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
|||
furi_assert(sizeof(StorageAnimationList_t) == sizeof(void*));
|
||||
furi_assert(!StorageAnimationList_size(*animation_list));
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
|
@ -134,7 +134,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
|||
StorageAnimationList_push_back(*animation_list, (StorageAnimation*)&dolphin_internal[i]);
|
||||
}
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
StorageAnimation* animation_storage_find_animation(const char* name) {
|
||||
|
@ -434,7 +434,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
|||
uint32_t height = 0;
|
||||
uint32_t width = 0;
|
||||
uint32_t* u32array = NULL;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* ff = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_format_set_strict_mode(ff, true);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "desktop/views/desktop_view_pin_timeout.h"
|
||||
#include "desktop_i.h"
|
||||
#include "helpers/pin_lock.h"
|
||||
#include "helpers/slideshow_filename.h"
|
||||
|
||||
static void desktop_auto_lock_arm(Desktop*);
|
||||
static void desktop_auto_lock_inhibit(Desktop*);
|
||||
|
@ -127,9 +128,9 @@ void desktop_lock(Desktop* desktop) {
|
|||
|
||||
void desktop_unlock(Desktop* desktop) {
|
||||
view_port_enabled_set(desktop->lock_viewport, false);
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_set_lockdown(gui, false);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
desktop_view_locked_unlock(desktop->locked_view);
|
||||
scene_manager_search_and_switch_to_previous_scene(desktop->scene_manager, DesktopSceneMain);
|
||||
desktop_auto_lock_arm(desktop);
|
||||
|
@ -139,7 +140,7 @@ Desktop* desktop_alloc() {
|
|||
Desktop* desktop = malloc(sizeof(Desktop));
|
||||
|
||||
desktop->animation_manager = animation_manager_alloc();
|
||||
desktop->gui = furi_record_open("gui");
|
||||
desktop->gui = furi_record_open(RECORD_GUI);
|
||||
desktop->scene_thread = furi_thread_alloc();
|
||||
desktop->view_dispatcher = view_dispatcher_alloc();
|
||||
desktop->scene_manager = scene_manager_alloc(&desktop_scene_handlers, desktop);
|
||||
|
@ -218,17 +219,17 @@ Desktop* desktop_alloc() {
|
|||
gui_add_view_port(desktop->gui, desktop->lock_viewport, GuiLayerStatusBarLeft);
|
||||
|
||||
// Special case: autostart application is already running
|
||||
desktop->loader = furi_record_open("loader");
|
||||
desktop->loader = furi_record_open(RECORD_LOADER);
|
||||
if(loader_is_locked(desktop->loader) &&
|
||||
animation_manager_is_animation_loaded(desktop->animation_manager)) {
|
||||
animation_manager_unload_and_stall_animation(desktop->animation_manager);
|
||||
}
|
||||
|
||||
desktop->notification = furi_record_open("notification");
|
||||
desktop->notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
desktop->app_start_stop_subscription = furi_pubsub_subscribe(
|
||||
loader_get_pubsub(desktop->loader), desktop_loader_callback, desktop);
|
||||
|
||||
desktop->input_events_pubsub = furi_record_open("input_events");
|
||||
desktop->input_events_pubsub = furi_record_open(RECORD_INPUT_EVENTS);
|
||||
desktop->input_events_subscription = NULL;
|
||||
|
||||
desktop->auto_lock_timer =
|
||||
|
@ -250,9 +251,9 @@ void desktop_free(Desktop* desktop) {
|
|||
|
||||
desktop->loader = NULL;
|
||||
desktop->input_events_pubsub = NULL;
|
||||
furi_record_close("loader");
|
||||
furi_record_close("notification");
|
||||
furi_record_close("input_events");
|
||||
furi_record_close(RECORD_LOADER);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_INPUT_EVENTS);
|
||||
|
||||
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdMain);
|
||||
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
|
||||
|
@ -276,7 +277,7 @@ void desktop_free(Desktop* desktop) {
|
|||
popup_free(desktop->hw_mismatch_popup);
|
||||
desktop_view_pin_timeout_free(desktop->pin_timeout_view);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
desktop->gui = NULL;
|
||||
|
||||
furi_thread_free(desktop->scene_thread);
|
||||
|
@ -289,9 +290,9 @@ void desktop_free(Desktop* desktop) {
|
|||
}
|
||||
|
||||
static bool desktop_check_file_flag(const char* flag_path) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool exists = storage_common_stat(storage, flag_path, NULL) == FSE_OK;
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
@ -318,7 +319,7 @@ int32_t desktop_srv(void* p) {
|
|||
desktop_lock(desktop);
|
||||
}
|
||||
|
||||
if(desktop_check_file_flag("/int/slideshow")) {
|
||||
if(desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
|
||||
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSlideshow);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include "desktop_settings_filename.h"
|
||||
|
||||
#include <furi_hal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <toolbox/saved_struct.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define DESKTOP_SETTINGS_VER (4)
|
||||
#define DESKTOP_SETTINGS_PATH "/int/desktop.settings"
|
||||
|
||||
#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
|
||||
#define DESKTOP_SETTINGS_MAGIC (0x17)
|
||||
#define PIN_MAX_LENGTH 12
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ static bool desktop_settings_back_event_callback(void* context) {
|
|||
DesktopSettingsApp* desktop_settings_app_alloc() {
|
||||
DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp));
|
||||
|
||||
app->gui = furi_record_open("gui");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
app->scene_manager = scene_manager_alloc(&desktop_settings_scene_handlers, app);
|
||||
view_dispatcher_enable_queue(app->view_dispatcher);
|
||||
|
@ -83,7 +83,7 @@ void desktop_settings_app_free(DesktopSettingsApp* app) {
|
|||
view_dispatcher_free(app->view_dispatcher);
|
||||
scene_manager_free(app->scene_manager);
|
||||
// Records
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
free(app);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define DESKTOP_SETTINGS_FILE_NAME ".desktop.settings"
|
|
@ -25,9 +25,9 @@ void desktop_settings_scene_pin_setup_done_on_enter(void* context) {
|
|||
|
||||
app->settings.pin_code = app->pincode_buffer;
|
||||
SAVE_DESKTOP_SETTINGS(&app->settings);
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
notification_message(notification, &sequence_single_vibro);
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
desktop_view_pin_input_set_context(app->pin_input_view, app);
|
||||
desktop_view_pin_input_set_back_callback(app->pin_input_view, NULL);
|
||||
|
|
|
@ -44,9 +44,9 @@ static const uint8_t desktop_helpers_fails_timeout[] = {
|
|||
};
|
||||
|
||||
void desktop_pin_lock_error_notify() {
|
||||
NotificationApp* notification = furi_record_open("notification");
|
||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
notification_message(notification, &sequence_pin_fail);
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
}
|
||||
|
||||
uint32_t desktop_pin_lock_get_fail_timeout() {
|
||||
|
@ -67,9 +67,9 @@ void desktop_pin_lock(DesktopSettings* settings) {
|
|||
|
||||
furi_hal_rtc_set_pin_fails(0);
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagLock);
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_close(cli);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
settings->is_locked = 1;
|
||||
SAVE_DESKTOP_SETTINGS(settings);
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ void desktop_pin_unlock(DesktopSettings* settings) {
|
|||
furi_assert(settings);
|
||||
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagLock);
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_open(cli, &cli_vcp);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
settings->is_locked = 0;
|
||||
SAVE_DESKTOP_SETTINGS(settings);
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ void desktop_pin_lock_init(DesktopSettings* settings) {
|
|||
}
|
||||
|
||||
if(desktop_pin_lock_is_locked()) {
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_close(cli);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void slideshow_free(Slideshow* slideshow) {
|
|||
}
|
||||
|
||||
bool slideshow_load(Slideshow* slideshow, const char* fspath) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* slideshow_file = storage_file_alloc(storage);
|
||||
slideshow->loaded = false;
|
||||
do {
|
||||
|
@ -86,7 +86,7 @@ bool slideshow_load(Slideshow* slideshow, const char* fspath) {
|
|||
}
|
||||
} while(false);
|
||||
storage_file_free(slideshow_file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return slideshow->loaded;
|
||||
}
|
||||
|
||||
|
|
3
applications/desktop/helpers/slideshow_filename.h
Normal file
3
applications/desktop/helpers/slideshow_filename.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define SLIDESHOW_FILE_NAME ".slideshow"
|
|
@ -22,7 +22,7 @@ void desktop_scene_debug_on_enter(void* context) {
|
|||
|
||||
bool desktop_scene_debug_on_event(void* context, SceneManagerEvent event) {
|
||||
Desktop* desktop = (Desktop*)context;
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
|
@ -55,7 +55,7 @@ bool desktop_scene_debug_on_event(void* context, SceneManagerEvent event) {
|
|||
}
|
||||
}
|
||||
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
return consumed;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ void desktop_scene_locked_on_enter(void* context) {
|
|||
if(state == SCENE_LOCKED_FIRST_ENTER) {
|
||||
bool pin_locked = desktop_pin_lock_is_locked();
|
||||
view_port_enabled_set(desktop->lock_viewport, true);
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_set_lockdown(gui, true);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
if(pin_locked) {
|
||||
LOAD_DESKTOP_SETTINGS(&desktop->settings);
|
||||
|
|
|
@ -24,13 +24,13 @@ typedef struct {
|
|||
} DesktopScenePinInputState;
|
||||
|
||||
static void desktop_scene_locked_light_red(bool value) {
|
||||
NotificationApp* app = furi_record_open("notification");
|
||||
NotificationApp* app = furi_record_open(RECORD_NOTIFICATION);
|
||||
if(value) {
|
||||
notification_message(app, &sequence_set_only_red_255);
|
||||
} else {
|
||||
notification_message(app, &sequence_reset_red);
|
||||
}
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,9 +26,9 @@ bool desktop_scene_slideshow_on_event(void* context, SceneManagerEvent event) {
|
|||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case DesktopSlideshowCompleted:
|
||||
storage = furi_record_open("storage");
|
||||
storage_common_remove(storage, "/int/slideshow");
|
||||
furi_record_close("storage");
|
||||
storage = furi_record_open(RECORD_STORAGE);
|
||||
storage_common_remove(storage, SLIDESHOW_FS_PATH);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
scene_manager_previous_scene(desktop->scene_manager);
|
||||
consumed = true;
|
||||
break;
|
||||
|
|
|
@ -79,9 +79,9 @@ void desktop_debug_render(Canvas* canvas, void* model) {
|
|||
|
||||
} else {
|
||||
char buffer[64];
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
uint32_t current_lvl = stats.level;
|
||||
uint32_t remaining = dolphin_state_xp_to_levelup(m->icounter);
|
||||
|
@ -175,7 +175,7 @@ void desktop_debug_free(DesktopDebugView* debug_view) {
|
|||
}
|
||||
|
||||
void desktop_debug_get_dolphin_data(DesktopDebugView* debug_view) {
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
with_view_model(
|
||||
debug_view->view, (DesktopDebugViewModel * model) {
|
||||
|
@ -185,7 +185,7 @@ void desktop_debug_get_dolphin_data(DesktopDebugView* debug_view) {
|
|||
return true;
|
||||
});
|
||||
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
}
|
||||
|
||||
void desktop_debug_reset_screen_idx(DesktopDebugView* debug_view) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../desktop_i.h"
|
||||
#include "desktop_view_slideshow.h"
|
||||
#include "../helpers/slideshow.h"
|
||||
#include "../helpers/slideshow_filename.h"
|
||||
|
||||
struct DesktopSlideshowView {
|
||||
View* view;
|
||||
|
@ -60,7 +61,7 @@ static void desktop_view_slideshow_enter(void* context) {
|
|||
|
||||
DesktopSlideshowViewModel* model = view_get_model(instance->view);
|
||||
model->slideshow = slideshow_alloc();
|
||||
if(!slideshow_load(model->slideshow, "/int/slideshow")) {
|
||||
if(!slideshow_load(model->slideshow, SLIDESHOW_FS_PATH)) {
|
||||
instance->callback(DesktopSlideshowCompleted, instance->context);
|
||||
}
|
||||
view_commit_model(instance->view, false);
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include <gui/view.h>
|
||||
|
||||
#include "desktop_events.h"
|
||||
#include "../helpers/slideshow_filename.h"
|
||||
|
||||
#define SLIDESHOW_FS_PATH INT_PATH(SLIDESHOW_FILE_NAME)
|
||||
|
||||
typedef struct DesktopSlideshowView DesktopSlideshowView;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ static void dialogs_app_process_message(DialogsApp* app, DialogsAppMessage* mess
|
|||
int32_t dialogs_srv(void* p) {
|
||||
UNUSED(p);
|
||||
DialogsApp* app = dialogs_app_alloc();
|
||||
furi_record_create("dialogs", app);
|
||||
furi_record_create(RECORD_DIALOGS, app);
|
||||
|
||||
DialogsAppMessage message;
|
||||
while(1) {
|
||||
|
|
|
@ -9,6 +9,8 @@ extern "C" {
|
|||
|
||||
/****************** COMMON ******************/
|
||||
|
||||
#define RECORD_DIALOGS "dialogs"
|
||||
|
||||
typedef struct DialogsApp DialogsApp;
|
||||
|
||||
/****************** FILE BROWSER ******************/
|
||||
|
|
|
@ -23,7 +23,7 @@ static void dialogs_app_file_browser_callback(void* context) {
|
|||
|
||||
bool dialogs_app_process_module_file_browser(const DialogsAppMessageDataFileBrowser* data) {
|
||||
bool ret = false;
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
DialogsAppFileBrowserContext* file_browser_context =
|
||||
malloc(sizeof(DialogsAppFileBrowserContext));
|
||||
|
@ -53,7 +53,7 @@ bool dialogs_app_process_module_file_browser(const DialogsAppMessageDataFileBrow
|
|||
file_browser_free(file_browser);
|
||||
API_LOCK_FREE(file_browser_context->lock);
|
||||
free(file_browser_context);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static void dialogs_app_message_callback(DialogExResult result, void* context) {
|
|||
|
||||
DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDataDialog* data) {
|
||||
DialogMessageButton ret = DialogMessageButtonBack;
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
const DialogMessage* message = data->message;
|
||||
DialogsAppMessageContext* message_context = malloc(sizeof(DialogsAppMessageContext));
|
||||
message_context->lock = API_LOCK_INIT_LOCKED();
|
||||
|
@ -96,7 +96,7 @@ DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDa
|
|||
dialog_ex_free(dialog_ex);
|
||||
API_LOCK_FREE(message_context->lock);
|
||||
free(message_context);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ static void dolphin_update_clear_limits_timer_period(Dolphin* dolphin) {
|
|||
int32_t dolphin_srv(void* p) {
|
||||
UNUSED(p);
|
||||
Dolphin* dolphin = dolphin_alloc();
|
||||
furi_record_create("dolphin", dolphin);
|
||||
furi_record_create(RECORD_DOLPHIN, dolphin);
|
||||
|
||||
dolphin_state_load(dolphin->state);
|
||||
xTimerReset(dolphin->butthurt_timer, portMAX_DELAY);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RECORD_DOLPHIN "dolphin"
|
||||
|
||||
typedef struct Dolphin Dolphin;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "dolphin_state.h"
|
||||
#include "dolphin/helpers/dolphin_deed.h"
|
||||
#include "dolphin_state_filename.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <storage/storage.h>
|
||||
#include <furi.h>
|
||||
|
@ -8,7 +10,8 @@
|
|||
#include <toolbox/saved_struct.h>
|
||||
|
||||
#define TAG "DolphinState"
|
||||
#define DOLPHIN_STATE_PATH "/int/dolphin.state"
|
||||
|
||||
#define DOLPHIN_STATE_PATH INT_PATH(DOLPHIN_STATE_FILE_NAME)
|
||||
#define DOLPHIN_STATE_HEADER_MAGIC 0xD0
|
||||
#define DOLPHIN_STATE_HEADER_VERSION 0x01
|
||||
#define LEVEL2_THRESHOLD 735
|
||||
|
|
3
applications/dolphin/helpers/dolphin_state_filename.h
Normal file
3
applications/dolphin/helpers/dolphin_state_filename.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define DOLPHIN_STATE_FILE_NAME ".dolphin.state"
|
|
@ -95,12 +95,12 @@ int32_t passport_app(void* p) {
|
|||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
view_port_draw_callback_set(view_port, render_callback, &stats);
|
||||
view_port_input_callback_set(view_port, input_callback, semaphore);
|
||||
Gui* gui = furi_record_open("gui");
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||
view_port_update(view_port);
|
||||
|
||||
|
@ -108,7 +108,7 @@ int32_t passport_app(void* p) {
|
|||
|
||||
gui_remove_view_port(gui, view_port);
|
||||
view_port_free(view_port);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_semaphore_free(semaphore);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -24,7 +24,7 @@ static void gpio_app_tick_event_callback(void* context) {
|
|||
GpioApp* gpio_app_alloc() {
|
||||
GpioApp* app = malloc(sizeof(GpioApp));
|
||||
|
||||
app->gui = furi_record_open("gui");
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
app->view_dispatcher = view_dispatcher_alloc();
|
||||
app->scene_manager = scene_manager_alloc(&gpio_scene_handlers, app);
|
||||
|
@ -40,7 +40,7 @@ GpioApp* gpio_app_alloc() {
|
|||
|
||||
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
||||
|
||||
app->notifications = furi_record_open("notification");
|
||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
app->var_item_list = variable_item_list_alloc();
|
||||
view_dispatcher_add_view(
|
||||
|
@ -88,8 +88,8 @@ void gpio_app_free(GpioApp* app) {
|
|||
scene_manager_free(app->scene_manager);
|
||||
|
||||
// Close records
|
||||
furi_record_close("gui");
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
free(app);
|
||||
}
|
||||
|
|
|
@ -86,15 +86,15 @@ static void usb_uart_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) {
|
|||
static void usb_uart_vcp_init(UsbUartBridge* usb_uart, uint8_t vcp_ch) {
|
||||
furi_hal_usb_unlock();
|
||||
if(vcp_ch == 0) {
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_close(cli);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
|
||||
} else {
|
||||
furi_check(furi_hal_usb_set_config(&usb_cdc_dual, NULL) == true);
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_open(cli, &cli_vcp);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
}
|
||||
furi_hal_cdc_set_callbacks(vcp_ch, (CdcCallbacks*)&cdc_cb, usb_uart);
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ static void usb_uart_vcp_deinit(UsbUartBridge* usb_uart, uint8_t vcp_ch) {
|
|||
UNUSED(usb_uart);
|
||||
furi_hal_cdc_set_callbacks(vcp_ch, NULL, NULL);
|
||||
if(vcp_ch != 0) {
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_close(cli);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,9 +276,9 @@ static int32_t usb_uart_worker(void* context) {
|
|||
|
||||
furi_hal_usb_unlock();
|
||||
furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_session_open(cli, &cli_vcp);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ Gui* gui_alloc() {
|
|||
|
||||
// Input
|
||||
gui->input_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
|
||||
gui->input_events = furi_record_open("input_events");
|
||||
gui->input_events = furi_record_open(RECORD_INPUT_EVENTS);
|
||||
|
||||
furi_check(gui->input_events);
|
||||
furi_pubsub_subscribe(gui->input_events, gui_input_events_callback, gui);
|
||||
|
@ -497,7 +497,7 @@ int32_t gui_srv(void* p) {
|
|||
UNUSED(p);
|
||||
Gui* gui = gui_alloc();
|
||||
|
||||
furi_record_create("gui", gui);
|
||||
furi_record_create(RECORD_GUI, gui);
|
||||
|
||||
while(1) {
|
||||
uint32_t flags =
|
||||
|
|
|
@ -29,6 +29,8 @@ typedef enum {
|
|||
/** Gui Canvas Commit Callback */
|
||||
typedef void (*GuiCanvasCommitCallback)(uint8_t* data, size_t size, void* context);
|
||||
|
||||
#define RECORD_GUI "gui"
|
||||
|
||||
typedef struct Gui Gui;
|
||||
|
||||
/** Add view_port to view_port tree
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define TAG "BrowserWorker"
|
||||
|
||||
#define ASSETS_DIR "assets"
|
||||
#define BROWSER_ROOT "/any"
|
||||
#define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX
|
||||
#define FILE_NAME_LEN_MAX 256
|
||||
#define LONG_LOAD_THRESHOLD 100
|
||||
|
||||
|
@ -53,13 +53,13 @@ struct BrowserWorker {
|
|||
static bool browser_path_is_file(string_t path) {
|
||||
bool state = false;
|
||||
FileInfo file_info;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
if((file_info.flags & FSF_DIRECTORY) == 0) {
|
||||
state = true;
|
||||
}
|
||||
}
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, string_t name, bool i
|
|||
|
||||
static bool browser_folder_check_and_switch(string_t path) {
|
||||
FileInfo file_info;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
bool is_root = false;
|
||||
while(1) {
|
||||
// Check if folder is existing and navigate back if not
|
||||
|
@ -111,7 +111,7 @@ static bool browser_folder_check_and_switch(string_t path) {
|
|||
}
|
||||
is_root = browser_path_trim(path);
|
||||
}
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return is_root;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ static bool browser_folder_init(
|
|||
FileInfo file_info;
|
||||
uint32_t total_files_cnt = 0;
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* directory = storage_file_alloc(storage);
|
||||
|
||||
char name_temp[FILE_NAME_LEN_MAX];
|
||||
|
@ -167,7 +167,7 @@ static bool browser_folder_init(
|
|||
storage_dir_close(directory);
|
||||
storage_file_free(directory);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ static bool
|
|||
browser_folder_load(BrowserWorker* browser, string_t path, uint32_t offset, uint32_t count) {
|
||||
FileInfo file_info;
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* directory = storage_file_alloc(storage);
|
||||
|
||||
char name_temp[FILE_NAME_LEN_MAX];
|
||||
|
@ -241,7 +241,7 @@ static bool
|
|||
storage_dir_close(directory);
|
||||
storage_file_free(directory);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return (items_cnt == count);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ bool validator_is_file_callback(const char* text, string_t error, void* context)
|
|||
bool ret = true;
|
||||
string_t path;
|
||||
string_init_printf(path, "%s/%s%s", instance->app_path_folder, text, instance->app_extension);
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
if(storage_common_stat(storage, string_get_cstr(path), NULL) == FSE_OK) {
|
||||
ret = false;
|
||||
string_printf(error, "This name\nexists!\nChoose\nanother one.");
|
||||
|
@ -29,7 +29,7 @@ bool validator_is_file_callback(const char* text, string_t error, void* context)
|
|||
ret = true;
|
||||
}
|
||||
string_clear(path);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -163,11 +163,11 @@ iButton* ibutton_alloc() {
|
|||
view_dispatcher_set_tick_event_callback(
|
||||
ibutton->view_dispatcher, ibutton_tick_event_callback, 100);
|
||||
|
||||
ibutton->gui = furi_record_open("gui");
|
||||
ibutton->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
ibutton->storage = furi_record_open("storage");
|
||||
ibutton->dialogs = furi_record_open("dialogs");
|
||||
ibutton->notifications = furi_record_open("notification");
|
||||
ibutton->storage = furi_record_open(RECORD_STORAGE);
|
||||
ibutton->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
ibutton->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
ibutton->key = ibutton_key_alloc();
|
||||
ibutton->key_worker = ibutton_worker_alloc();
|
||||
|
@ -224,16 +224,16 @@ void ibutton_free(iButton* ibutton) {
|
|||
view_dispatcher_free(ibutton->view_dispatcher);
|
||||
scene_manager_free(ibutton->scene_manager);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
ibutton->storage = NULL;
|
||||
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
ibutton->notifications = NULL;
|
||||
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
ibutton->dialogs = NULL;
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
ibutton->gui = NULL;
|
||||
|
||||
ibutton_worker_stop_thread(ibutton->key_worker);
|
||||
|
|
|
@ -12,10 +12,10 @@ static void onewire_cli(Cli* cli, string_t args, void* context);
|
|||
// app cli function
|
||||
void ibutton_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli, cli);
|
||||
cli_add_command(cli, "onewire", CliCommandFlagDefault, onewire_cli, cli);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(ibutton_cli);
|
||||
UNUSED(onewire_cli);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define IBUTTON_FILE_NAME_SIZE 100
|
||||
#define IBUTTON_TEXT_STORE_SIZE 128
|
||||
|
||||
#define IBUTTON_APP_FOLDER "/any/ibutton"
|
||||
#define IBUTTON_APP_FOLDER ANY_PATH("ibutton")
|
||||
#define IBUTTON_APP_EXTENSION ".ibtn"
|
||||
#define IBUTTON_APP_FILE_TYPE "Flipper iButton key"
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static bool
|
|||
}
|
||||
|
||||
static void infrared_find_vacant_remote_name(string_t name, const char* path) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
string_t base_path;
|
||||
string_init_set_str(base_path, path);
|
||||
|
@ -122,7 +122,7 @@ static void infrared_find_vacant_remote_name(string_t name, const char* path) {
|
|||
}
|
||||
|
||||
string_clear(base_path);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
static Infrared* infrared_alloc() {
|
||||
|
@ -140,7 +140,7 @@ static Infrared* infrared_alloc() {
|
|||
infrared->scene_manager = scene_manager_alloc(&infrared_scene_handlers, infrared);
|
||||
infrared->view_dispatcher = view_dispatcher_alloc();
|
||||
|
||||
infrared->gui = furi_record_open("gui");
|
||||
infrared->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
ViewDispatcher* view_dispatcher = infrared->view_dispatcher;
|
||||
view_dispatcher_enable_queue(view_dispatcher);
|
||||
|
@ -149,9 +149,9 @@ static Infrared* infrared_alloc() {
|
|||
view_dispatcher_set_navigation_event_callback(view_dispatcher, infrared_back_event_callback);
|
||||
view_dispatcher_set_tick_event_callback(view_dispatcher, infrared_tick_event_callback, 100);
|
||||
|
||||
infrared->storage = furi_record_open("storage");
|
||||
infrared->dialogs = furi_record_open("dialogs");
|
||||
infrared->notifications = furi_record_open("notification");
|
||||
infrared->storage = furi_record_open(RECORD_STORAGE);
|
||||
infrared->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
infrared->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
infrared->worker = infrared_worker_alloc();
|
||||
infrared->remote = infrared_remote_alloc();
|
||||
|
@ -242,16 +242,16 @@ static void infrared_free(Infrared* infrared) {
|
|||
infrared_remote_free(infrared->remote);
|
||||
infrared_worker_free(infrared->worker);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
infrared->gui = NULL;
|
||||
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
infrared->notifications = NULL;
|
||||
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
infrared->dialogs = NULL;
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
infrared->gui = NULL;
|
||||
|
||||
string_clear(infrared->file_path);
|
||||
|
@ -302,7 +302,7 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
|
|||
}
|
||||
string_cat_printf(new_path, "/%s%s", string_get_cstr(new_name), INFRARED_APP_EXTENSION);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
FS_Error status = storage_common_rename(
|
||||
storage, infrared_remote_get_path(remote), string_get_cstr(new_path));
|
||||
|
@ -312,7 +312,7 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
|
|||
string_clear(new_name);
|
||||
string_clear(new_path);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return (status == FSE_OK || status == FSE_EXIST);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
|
|||
furi_assert(brute_force->db_filename);
|
||||
bool success = false;
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* ff = flipper_format_buffered_file_alloc(storage);
|
||||
|
||||
success = flipper_format_buffered_file_open_existing(ff, brute_force->db_filename);
|
||||
|
@ -68,7 +68,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
|
|||
}
|
||||
|
||||
flipper_format_free(ff);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -94,14 +94,14 @@ bool infrared_brute_force_start(
|
|||
}
|
||||
|
||||
if(*record_count) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
brute_force->ff = flipper_format_buffered_file_alloc(storage);
|
||||
success =
|
||||
flipper_format_buffered_file_open_existing(brute_force->ff, brute_force->db_filename);
|
||||
if(!success) {
|
||||
flipper_format_free(brute_force->ff);
|
||||
brute_force->ff = NULL;
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
|
@ -117,7 +117,7 @@ void infrared_brute_force_stop(InfraredBruteForce* brute_force) {
|
|||
|
||||
string_reset(brute_force->current_record_name);
|
||||
flipper_format_free(brute_force->ff);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
brute_force->ff = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,9 +192,9 @@ static void infrared_cli_start_ir(Cli* cli, string_t args, void* context) {
|
|||
}
|
||||
void infrared_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = (Cli*)furi_record_open("cli");
|
||||
Cli* cli = (Cli*)furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir, NULL);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(infrared_cli_start_ir);
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define INFRARED_MAX_BUTTON_NAME_LENGTH 22
|
||||
#define INFRARED_MAX_REMOTE_NAME_LENGTH 22
|
||||
|
||||
#define INFRARED_APP_FOLDER "/any/infrared"
|
||||
#define INFRARED_APP_FOLDER ANY_PATH("infrared")
|
||||
#define INFRARED_APP_EXTENSION ".ir"
|
||||
|
||||
#define INFRARED_DEFAULT_REMOTE_NAME "Remote"
|
||||
|
|
|
@ -110,7 +110,7 @@ bool infrared_remote_delete_button(InfraredRemote* remote, size_t index) {
|
|||
}
|
||||
|
||||
bool infrared_remote_store(InfraredRemote* remote) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* ff = flipper_format_file_alloc(storage);
|
||||
const char* path = string_get_cstr(remote->path);
|
||||
|
||||
|
@ -134,12 +134,12 @@ bool infrared_remote_store(InfraredRemote* remote) {
|
|||
}
|
||||
|
||||
flipper_format_free(ff);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool infrared_remote_load(InfraredRemote* remote, string_t path) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* ff = flipper_format_buffered_file_alloc(storage);
|
||||
|
||||
string_t buf;
|
||||
|
@ -174,16 +174,16 @@ bool infrared_remote_load(InfraredRemote* remote, string_t path) {
|
|||
|
||||
string_clear(buf);
|
||||
flipper_format_free(ff);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool infrared_remote_remove(InfraredRemote* remote) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
FS_Error status = storage_common_remove(storage, string_get_cstr(remote->path));
|
||||
infrared_remote_reset(remote);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
return (status == FSE_OK || status == FSE_NOT_EXIST);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ void infrared_scene_universal_tv_on_enter(void* context) {
|
|||
ButtonPanel* button_panel = infrared->button_panel;
|
||||
InfraredBruteForce* brute_force = infrared->brute_force;
|
||||
|
||||
infrared_brute_force_set_db_filename(brute_force, "/ext/infrared/assets/tv.ir");
|
||||
infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/tv.ir"));
|
||||
|
||||
button_panel_reserve(button_panel, 2, 3);
|
||||
uint32_t i = 0;
|
||||
|
|
|
@ -68,10 +68,10 @@ int32_t input_srv() {
|
|||
input = malloc(sizeof(Input));
|
||||
input->thread_id = furi_thread_get_current_id();
|
||||
input->event_pubsub = furi_pubsub_alloc();
|
||||
furi_record_create("input_events", input->event_pubsub);
|
||||
furi_record_create(RECORD_INPUT_EVENTS, input->event_pubsub);
|
||||
|
||||
#ifdef SRV_CLI
|
||||
input->cli = furi_record_open("cli");
|
||||
input->cli = furi_record_open(RECORD_CLI);
|
||||
if(input->cli) {
|
||||
cli_add_command(input->cli, "input", CliCommandFlagParallelSafe, input_cli, input);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include <furi_hal_resources.h>
|
||||
|
||||
#define RECORD_INPUT_EVENTS "input_events"
|
||||
|
||||
/** Input Types
|
||||
* Some of them are physical events and some logical
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "rpc/rpc_app.h"
|
||||
|
||||
const char* LfRfidApp::app_folder = "/any/lfrfid";
|
||||
const char* LfRfidApp::app_folder = ANY_PATH("lfrfid");
|
||||
const char* LfRfidApp::app_extension = ".rfid";
|
||||
const char* LfRfidApp::app_filetype = "Flipper RFID key";
|
||||
|
||||
|
|
|
@ -290,8 +290,9 @@ static Loader* loader_alloc() {
|
|||
instance->pubsub = furi_pubsub_alloc();
|
||||
|
||||
#ifdef SRV_CLI
|
||||
instance->cli = furi_record_open("cli");
|
||||
cli_add_command(instance->cli, "loader", CliCommandFlagParallelSafe, loader_cli, instance);
|
||||
instance->cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(
|
||||
instance->cli, RECORD_LOADER, CliCommandFlagParallelSafe, loader_cli, instance);
|
||||
#else
|
||||
UNUSED(loader_cli);
|
||||
#endif
|
||||
|
@ -299,7 +300,7 @@ static Loader* loader_alloc() {
|
|||
instance->loader_thread = furi_thread_get_current_id();
|
||||
|
||||
// Gui
|
||||
instance->gui = furi_record_open("gui");
|
||||
instance->gui = furi_record_open(RECORD_GUI);
|
||||
instance->view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_attach_to_gui(
|
||||
instance->view_dispatcher, instance->gui, ViewDispatcherTypeFullscreen);
|
||||
|
@ -343,7 +344,7 @@ static void loader_free(Loader* instance) {
|
|||
furi_assert(instance);
|
||||
|
||||
if(instance->cli) {
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
}
|
||||
|
||||
furi_pubsub_free(instance->pubsub);
|
||||
|
@ -360,7 +361,7 @@ static void loader_free(Loader* instance) {
|
|||
view_dispatcher_remove_view(loader_instance->view_dispatcher, LoaderMenuViewSettings);
|
||||
view_dispatcher_free(loader_instance->view_dispatcher);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
free(instance);
|
||||
instance = NULL;
|
||||
|
@ -463,7 +464,7 @@ int32_t loader_srv(void* p) {
|
|||
|
||||
FURI_LOG_I(TAG, "Started");
|
||||
|
||||
furi_record_create("loader", loader_instance);
|
||||
furi_record_create(RECORD_LOADER, loader_instance);
|
||||
|
||||
#ifdef LOADER_AUTOSTART
|
||||
loader_start(loader_instance, LOADER_AUTOSTART, NULL);
|
||||
|
@ -480,7 +481,7 @@ int32_t loader_srv(void* p) {
|
|||
}
|
||||
}
|
||||
|
||||
furi_record_destroy("loader");
|
||||
furi_record_destroy(RECORD_LOADER);
|
||||
loader_free(loader_instance);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <core/pubsub.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define RECORD_LOADER "loader"
|
||||
|
||||
typedef struct Loader Loader;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#include "assets_icons.h"
|
||||
#include "m-string.h"
|
||||
#include "music_player_worker.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#include <assets_icons.h>
|
||||
#include <gui/gui.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include "music_player_worker.h"
|
||||
#include <storage/storage.h>
|
||||
|
||||
#include <m-string.h>
|
||||
|
||||
#define TAG "MusicPlayer"
|
||||
|
||||
#define MUSIC_PLAYER_APP_PATH_FOLDER "/any/music_player"
|
||||
#define MUSIC_PLAYER_APP_PATH_FOLDER ANY_PATH("music_player")
|
||||
#define MUSIC_PLAYER_APP_EXTENSION "*"
|
||||
|
||||
#define MUSIC_PLAYER_SEMITONE_HISTORY_SIZE 4
|
||||
|
@ -269,7 +272,7 @@ MusicPlayer* music_player_alloc() {
|
|||
view_port_input_callback_set(instance->view_port, input_callback, instance);
|
||||
|
||||
// Open GUI and register view_port
|
||||
instance->gui = furi_record_open("gui");
|
||||
instance->gui = furi_record_open(RECORD_GUI);
|
||||
gui_add_view_port(instance->gui, instance->view_port, GuiLayerFullscreen);
|
||||
|
||||
return instance;
|
||||
|
@ -277,7 +280,7 @@ MusicPlayer* music_player_alloc() {
|
|||
|
||||
void music_player_free(MusicPlayer* instance) {
|
||||
gui_remove_view_port(instance->gui, instance->view_port);
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
view_port_free(instance->view_port);
|
||||
|
||||
music_player_worker_free(instance->worker);
|
||||
|
@ -302,7 +305,7 @@ int32_t music_player_app(void* p) {
|
|||
} else {
|
||||
string_set_str(file_path, MUSIC_PLAYER_APP_PATH_FOLDER);
|
||||
|
||||
DialogsApp* dialogs = furi_record_open("dialogs");
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
bool res = dialog_file_browser_show(
|
||||
dialogs,
|
||||
file_path,
|
||||
|
@ -312,7 +315,7 @@ int32_t music_player_app(void* p) {
|
|||
&I_music_10px,
|
||||
false);
|
||||
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
if(!res) {
|
||||
FURI_LOG_E(TAG, "No file selected");
|
||||
break;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
static void music_player_cli(Cli* cli, string_t args, void* context) {
|
||||
UNUSED(context);
|
||||
MusicPlayerWorker* music_player_worker = music_player_worker_alloc();
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
do {
|
||||
if(storage_common_stat(storage, string_get_cstr(args), NULL) == FSE_OK) {
|
||||
|
@ -31,17 +31,17 @@ static void music_player_cli(Cli* cli, string_t args, void* context) {
|
|||
music_player_worker_stop(music_player_worker);
|
||||
} while(0);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
music_player_worker_free(music_player_worker);
|
||||
}
|
||||
|
||||
void music_player_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
|
||||
cli_add_command(cli, "music_player", CliCommandFlagDefault, music_player_cli, NULL);
|
||||
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(music_player_cli);
|
||||
#endif
|
||||
|
|
|
@ -329,7 +329,7 @@ bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const c
|
|||
string_t temp_str;
|
||||
string_init(temp_str);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
do {
|
||||
|
@ -367,7 +367,7 @@ bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const c
|
|||
result = true;
|
||||
} while(false);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
flipper_format_free(file);
|
||||
string_clear(temp_str);
|
||||
|
||||
|
@ -381,7 +381,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
|
|||
bool result = false;
|
||||
string_t content;
|
||||
string_init(content);
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
File* file = storage_file_alloc(storage);
|
||||
|
||||
do {
|
||||
|
@ -414,7 +414,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
|
|||
} while(0);
|
||||
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
string_clear(content);
|
||||
|
||||
return result;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define DATA_PICC_TO_PCD_CRC_DROPPED 0xFB
|
||||
#define DATA_PCD_TO_PICC_CRC_DROPPED 0xFA
|
||||
|
||||
#define NFC_DEBUG_PCAP_FILENAME "/ext/nfc/debug.pcap"
|
||||
#define NFC_DEBUG_PCAP_FILENAME EXT_PATH("nfc/debug.pcap")
|
||||
#define NFC_DEBUG_PCAP_BUFFER_SIZE 64
|
||||
|
||||
struct NfcDebugPcapWorker {
|
||||
|
|
|
@ -44,7 +44,7 @@ bool nfc_emv_parser_get_aid_name(
|
|||
for(uint8_t i = 0; i < aid_len; i++) {
|
||||
string_cat_printf(key, "%02X", aid[i]);
|
||||
}
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/aid.nfc", key, aid_name)) {
|
||||
if(nfc_emv_parser_search_data(storage, EXT_PATH("nfc/assets/aid.nfc"), key, aid_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
@ -58,7 +58,8 @@ bool nfc_emv_parser_get_country_name(
|
|||
bool parsed = false;
|
||||
string_t key;
|
||||
string_init_printf(key, "%04X", country_code);
|
||||
if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/country_code.nfc", key, country_name)) {
|
||||
if(nfc_emv_parser_search_data(
|
||||
storage, EXT_PATH("nfc/assets/country_code.nfc"), key, country_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
@ -73,7 +74,7 @@ bool nfc_emv_parser_get_currency_name(
|
|||
string_t key;
|
||||
string_init_printf(key, "%04X", currency_code);
|
||||
if(nfc_emv_parser_search_data(
|
||||
storage, "/ext/nfc/assets/currency_code.nfc", key, currency_name)) {
|
||||
storage, EXT_PATH("nfc/assets/currency_code.nfc"), key, currency_name)) {
|
||||
parsed = true;
|
||||
}
|
||||
string_clear(key);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <flipper_format/flipper_format.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
|
||||
#define NFC_MF_CLASSIC_DICT_PATH "/ext/nfc/assets/mf_classic_dict.nfc"
|
||||
#define NFC_MF_CLASSIC_DICT_PATH EXT_PATH("nfc/assets/mf_classic_dict.nfc")
|
||||
|
||||
#define NFC_MF_CLASSIC_KEY_LEN (13)
|
||||
|
||||
|
|
|
@ -108,10 +108,10 @@ Nfc* nfc_alloc() {
|
|||
nfc->dev = nfc_device_alloc();
|
||||
|
||||
// Open GUI record
|
||||
nfc->gui = furi_record_open("gui");
|
||||
nfc->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
// Open Notification record
|
||||
nfc->notifications = furi_record_open("notification");
|
||||
nfc->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// Submenu
|
||||
nfc->submenu = submenu_alloc();
|
||||
|
@ -224,11 +224,11 @@ void nfc_free(Nfc* nfc) {
|
|||
scene_manager_free(nfc->scene_manager);
|
||||
|
||||
// GUI
|
||||
furi_record_close("gui");
|
||||
furi_record_close(RECORD_GUI);
|
||||
nfc->gui = NULL;
|
||||
|
||||
// Notifications
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
nfc->notifications = NULL;
|
||||
|
||||
free(nfc);
|
||||
|
|
|
@ -131,9 +131,9 @@ static void nfc_cli(Cli* cli, string_t args, void* context) {
|
|||
|
||||
void nfc_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, "nfc", CliCommandFlagDefault, nfc_cli, NULL);
|
||||
furi_record_close("cli");
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(nfc_cli);
|
||||
#endif
|
||||
|
|
|
@ -14,8 +14,8 @@ static const uint32_t nfc_mifare_classic_data_format_version = 1;
|
|||
|
||||
NfcDevice* nfc_device_alloc() {
|
||||
NfcDevice* nfc_dev = malloc(sizeof(NfcDevice));
|
||||
nfc_dev->storage = furi_record_open("storage");
|
||||
nfc_dev->dialogs = furi_record_open("dialogs");
|
||||
nfc_dev->storage = furi_record_open(RECORD_STORAGE);
|
||||
nfc_dev->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
string_init(nfc_dev->load_path);
|
||||
return nfc_dev;
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ NfcDevice* nfc_device_alloc() {
|
|||
void nfc_device_free(NfcDevice* nfc_dev) {
|
||||
furi_assert(nfc_dev);
|
||||
nfc_device_clear(nfc_dev);
|
||||
furi_record_close("storage");
|
||||
furi_record_close("dialogs");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
string_clear(nfc_dev->load_path);
|
||||
free(nfc_dev);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define NFC_DEV_NAME_MAX_LEN 22
|
||||
#define NFC_READER_DATA_MAX_SIZE 64
|
||||
|
||||
#define NFC_APP_FOLDER "/any/nfc"
|
||||
#define NFC_APP_FOLDER ANY_PATH("nfc")
|
||||
#define NFC_APP_EXTENSION ".nfc"
|
||||
#define NFC_APP_SHADOW_EXTENSION ".shd"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ NfcWorker* nfc_worker_alloc() {
|
|||
|
||||
nfc_worker->callback = NULL;
|
||||
nfc_worker->context = NULL;
|
||||
nfc_worker->storage = furi_record_open("storage");
|
||||
nfc_worker->storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
// Initialize rfal
|
||||
while(furi_hal_nfc_is_busy()) {
|
||||
|
@ -39,7 +39,7 @@ void nfc_worker_free(NfcWorker* nfc_worker) {
|
|||
|
||||
furi_thread_free(nfc_worker->thread);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
if(nfc_worker->debug_pcap_worker) nfc_debug_pcap_free(nfc_worker->debug_pcap_worker);
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RECORD_NOTIFICATION "notification"
|
||||
|
||||
typedef struct NotificationApp NotificationApp;
|
||||
typedef struct {
|
||||
float frequency;
|
||||
|
|
|
@ -398,7 +398,7 @@ void notification_process_internal_message(NotificationApp* app, NotificationApp
|
|||
|
||||
static bool notification_load_settings(NotificationApp* app) {
|
||||
NotificationSettings settings;
|
||||
File* file = storage_file_alloc(furi_record_open("storage"));
|
||||
File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
const size_t settings_size = sizeof(NotificationSettings);
|
||||
|
||||
FURI_LOG_I(TAG, "loading settings from \"%s\"", NOTIFICATION_SETTINGS_PATH);
|
||||
|
@ -430,14 +430,14 @@ static bool notification_load_settings(NotificationApp* app) {
|
|||
|
||||
storage_file_close(file);
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return fs_result;
|
||||
};
|
||||
|
||||
static bool notification_save_settings(NotificationApp* app) {
|
||||
NotificationSettings settings;
|
||||
File* file = storage_file_alloc(furi_record_open("storage"));
|
||||
File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
const size_t settings_size = sizeof(NotificationSettings);
|
||||
|
||||
FURI_LOG_I(TAG, "saving settings to \"%s\"", NOTIFICATION_SETTINGS_PATH);
|
||||
|
@ -465,7 +465,7 @@ static bool notification_save_settings(NotificationApp* app) {
|
|||
|
||||
storage_file_close(file);
|
||||
storage_file_free(file);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return fs_result;
|
||||
};
|
||||
|
@ -512,7 +512,7 @@ static NotificationApp* notification_app_alloc() {
|
|||
app->settings.version = NOTIFICATION_SETTINGS_VERSION;
|
||||
|
||||
// display backlight control
|
||||
app->event_record = furi_record_open("input_events");
|
||||
app->event_record = furi_record_open(RECORD_INPUT_EVENTS);
|
||||
furi_pubsub_subscribe(app->event_record, input_event_callback, app);
|
||||
notification_message(app, &sequence_display_backlight_on);
|
||||
|
||||
|
@ -535,7 +535,7 @@ int32_t notification_srv(void* p) {
|
|||
notification_apply_internal_led_layer(&app->led[1], 0x00);
|
||||
notification_apply_internal_led_layer(&app->led[2], 0x00);
|
||||
|
||||
furi_record_create("notification", app);
|
||||
furi_record_create(RECORD_NOTIFICATION, app);
|
||||
|
||||
NotificationAppMessage message;
|
||||
while(1) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <furi_hal.h>
|
||||
#include "notification.h"
|
||||
#include "notification_messages.h"
|
||||
#include "notification_settings_filename.h"
|
||||
|
||||
#define NOTIFICATION_LED_COUNT 3
|
||||
#define NOTIFICATION_EVENT_COMPLETE 0x00000001U
|
||||
|
@ -32,7 +33,7 @@ typedef struct {
|
|||
} NotificationLedLayer;
|
||||
|
||||
#define NOTIFICATION_SETTINGS_VERSION 0x01
|
||||
#define NOTIFICATION_SETTINGS_PATH "/int/notification.settings"
|
||||
#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
|
||||
|
||||
typedef struct {
|
||||
uint8_t version;
|
||||
|
|
|
@ -126,8 +126,8 @@ static uint32_t notification_app_settings_exit(void* context) {
|
|||
|
||||
static NotificationAppSettings* alloc_settings() {
|
||||
NotificationAppSettings* app = malloc(sizeof(NotificationAppSettings));
|
||||
app->notification = furi_record_open("notification");
|
||||
app->gui = furi_record_open("gui");
|
||||
app->notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
|
||||
app->variable_item_list = variable_item_list_alloc();
|
||||
View* view = variable_item_list_get_view(app->variable_item_list);
|
||||
|
@ -184,8 +184,8 @@ static void free_settings(NotificationAppSettings* app) {
|
|||
variable_item_list_free(app->variable_item_list);
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
|
||||
furi_record_close("gui");
|
||||
furi_record_close("notification");
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
free(app);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue