mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 06:08:35 -07:00
Merge branch 'dev' into rabbitnew100mw
This commit is contained in:
@@ -13,7 +13,6 @@ App(
|
||||
"u2f",
|
||||
"xtreme_app",
|
||||
"archive",
|
||||
"nightstand",
|
||||
"main_apps_on_start",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -12,15 +12,15 @@ void ibutton_scene_delete_confirm_on_enter(void* context) {
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeRight, "Delete", ibutton_widget_callback, context);
|
||||
|
||||
furi_string_printf(tmp, "Delete %s?", ibutton->key_name);
|
||||
widget_add_string_element(
|
||||
widget, 128 / 2, 0, AlignCenter, AlignTop, FontPrimary, furi_string_get_cstr(tmp));
|
||||
furi_string_printf(tmp, "\e#Delete %s?\e#", ibutton->key_name);
|
||||
widget_add_text_box_element(
|
||||
widget, 0, 0, 128, 23, AlignCenter, AlignCenter, furi_string_get_cstr(tmp), false);
|
||||
|
||||
furi_string_reset(tmp);
|
||||
ibutton_protocols_render_brief_data(ibutton->protocols, key, tmp);
|
||||
|
||||
widget_add_string_multiline_element(
|
||||
widget, 128 / 2, 16, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(tmp));
|
||||
widget, 128 / 2, 24, AlignCenter, AlignTop, FontSecondary, furi_string_get_cstr(tmp));
|
||||
|
||||
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);
|
||||
furi_string_free(tmp);
|
||||
|
||||
@@ -34,25 +34,13 @@ static void nfc_cli_detect(Cli* cli, FuriString* args) {
|
||||
while(!cmd_exit) {
|
||||
cmd_exit |= cli_cmd_interrupt_received(cli);
|
||||
if(furi_hal_nfc_detect(&dev_data, 400)) {
|
||||
if(dev_data.type == FuriHalNfcTypeA) {
|
||||
printf("UID length: %d, UID:", dev_data.uid_len);
|
||||
for(size_t i = 0; i < dev_data.uid_len; i++) {
|
||||
printf("%02X", dev_data.uid[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
break;
|
||||
} else if(dev_data.type == FuriHalNfcTypeF) {
|
||||
printf("IDm:");
|
||||
for(size_t i = 0; i < 8; i++) {
|
||||
printf("%02X", dev_data.uid[i]);
|
||||
}
|
||||
printf(", PMm:");
|
||||
for(size_t i = 0; i < 8; i++) {
|
||||
printf("%02X", dev_data.f_data.pmm[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
break;
|
||||
printf("Found: %s ", nfc_get_dev_type(dev_data.type));
|
||||
printf("UID length: %d, UID:", dev_data.uid_len);
|
||||
for(size_t i = 0; i < dev_data.uid_len; i++) {
|
||||
printf("%02X", dev_data.uid[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
break;
|
||||
}
|
||||
furi_hal_nfc_sleep();
|
||||
furi_delay_ms(50);
|
||||
@@ -75,17 +63,13 @@ static void nfc_cli_emulate(Cli* cli, FuriString* args) {
|
||||
FuriHalNfcDevData params = {
|
||||
.uid = {0x36, 0x9C, 0xe7, 0xb1, 0x0A, 0xC1, 0x34},
|
||||
.uid_len = 7,
|
||||
.a_data =
|
||||
{
|
||||
.atqa = {0x44, 0x00},
|
||||
.sak = 0x00,
|
||||
},
|
||||
.atqa = {0x44, 0x00},
|
||||
.sak = 0x00,
|
||||
.type = FuriHalNfcTypeA,
|
||||
};
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
if(furi_hal_nfc_listen(
|
||||
params.uid, params.uid_len, params.a_data.atqa, params.a_data.sak, false, 100)) {
|
||||
if(furi_hal_nfc_listen(params.uid, params.uid_len, params.atqa, params.sak, false, 100)) {
|
||||
printf("Reader detected\r\n");
|
||||
furi_hal_nfc_sleep();
|
||||
}
|
||||
|
||||
@@ -39,23 +39,13 @@
|
||||
|
||||
#include "rpc/rpc_app.h"
|
||||
|
||||
#include <m-list.h>
|
||||
#include <m-array.h>
|
||||
|
||||
ARRAY_DEF(FelicaAreaPath, FelicaArea*, M_PTR_OPLIST)
|
||||
ARRAY_DEF(MfClassicUserKeys, char*, M_PTR_OPLIST)
|
||||
ARRAY_DEF(MfClassicUserKeys, char*, M_PTR_OPLIST);
|
||||
|
||||
#define NFC_TEXT_STORE_SIZE 128
|
||||
#define NFC_APP_FOLDER ANY_PATH("nfc")
|
||||
|
||||
typedef struct {
|
||||
FelicaSystem* selected_system;
|
||||
|
||||
FelicaAreaPath_t selected_areas;
|
||||
|
||||
FelicaService* selected_service;
|
||||
} FelicaSelectState;
|
||||
|
||||
typedef enum {
|
||||
NfcRpcStateIdle,
|
||||
NfcRpcStateEmulating,
|
||||
@@ -75,7 +65,6 @@ struct Nfc {
|
||||
FuriString* text_box_store;
|
||||
uint8_t byte_input_store[6];
|
||||
MfClassicUserKeys_t mfc_key_strs; // Used in MFC key listing
|
||||
FelicaSelectState felica_select;
|
||||
|
||||
void* rpc_ctx;
|
||||
NfcRpcState rpc_state;
|
||||
|
||||
@@ -21,8 +21,6 @@ ADD_SCENE(nfc, nfcv_unlock, NfcVUnlock)
|
||||
ADD_SCENE(nfc, nfcv_emulate, NfcVEmulate)
|
||||
ADD_SCENE(nfc, nfcv_sniff, NfcVSniff)
|
||||
ADD_SCENE(nfc, nfcv_read_success, NfcVReadSuccess)
|
||||
ADD_SCENE(nfc, nfcf_read_success, NfcfReadSuccess)
|
||||
ADD_SCENE(nfc, nfcf_menu, NfcfMenu)
|
||||
ADD_SCENE(nfc, mf_ultralight_read_success, MfUltralightReadSuccess)
|
||||
ADD_SCENE(nfc, mf_ultralight_data, MfUltralightData)
|
||||
ADD_SCENE(nfc, mf_ultralight_menu, MfUltralightMenu)
|
||||
@@ -55,10 +53,6 @@ ADD_SCENE(nfc, mf_classic_update_success, MfClassicUpdateSuccess)
|
||||
ADD_SCENE(nfc, mf_classic_wrong_card, MfClassicWrongCard)
|
||||
ADD_SCENE(nfc, emv_read_success, EmvReadSuccess)
|
||||
ADD_SCENE(nfc, emv_menu, EmvMenu)
|
||||
ADD_SCENE(nfc, felica_read_success, FelicaReadSuccess)
|
||||
ADD_SCENE(nfc, felica_menu, FelicaMenu)
|
||||
ADD_SCENE(nfc, felica_info_select, FelicaInfoSelect)
|
||||
ADD_SCENE(nfc, felica_service_data, FelicaServiceData)
|
||||
ADD_SCENE(nfc, emulate_apdu_sequence, EmulateApduSequence)
|
||||
ADD_SCENE(nfc, device_info, DeviceInfo)
|
||||
ADD_SCENE(nfc, delete, Delete)
|
||||
|
||||
@@ -44,8 +44,6 @@ void nfc_scene_delete_on_enter(void* context) {
|
||||
} else if(protocol == NfcDeviceProtocolNfcV) {
|
||||
furi_string_set(temp_str, "ISO15693 tag");
|
||||
nfc_type = "NFC-V";
|
||||
} else if(protocol == NfcDeviceProtocolFelica) {
|
||||
furi_string_set(temp_str, "FeliCa");
|
||||
} else {
|
||||
furi_string_set(temp_str, "Unknown ISO tag");
|
||||
}
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
void nfc_scene_felica_info_select_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_felica_info_select_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
FelicaData* data = &nfc->dev->dev_data.felica_data;
|
||||
FelicaSelectState* state = &nfc->felica_select;
|
||||
|
||||
FelicaAreaPath_init(nfc->felica_select.selected_areas);
|
||||
|
||||
submenu_add_item(submenu, "[Actions]", 0, nfc_scene_felica_info_select_submenu_callback, nfc);
|
||||
uint8_t i = 1;
|
||||
if(state->selected_system == NULL || state->selected_system->code == LITE_SYSTEM_CODE) {
|
||||
submenu_set_header(submenu, "Systems");
|
||||
for
|
||||
M_EACH(current_system, data->systems, FelicaSystemArray_t) {
|
||||
FuriString* system_name = felica_get_system_name(current_system);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
furi_string_get_cstr(system_name),
|
||||
i++,
|
||||
nfc_scene_felica_info_select_submenu_callback,
|
||||
nfc);
|
||||
furi_string_free(system_name);
|
||||
}
|
||||
} else {
|
||||
FelicaSystem* system = state->selected_system;
|
||||
FuriString* header = furi_string_alloc_printf("%04X/", system->code);
|
||||
|
||||
FelicaNode* root = &system->root;
|
||||
furi_assert(root->type == FelicaNodeTypeArea);
|
||||
FelicaArea* area = root->area;
|
||||
if(FelicaAreaPath_size(state->selected_areas) > 0) {
|
||||
FelicaAreaPath_it_t it;
|
||||
for(FelicaAreaPath_it(it, state->selected_areas); !FelicaAreaPath_end_p(it);
|
||||
FelicaAreaPath_next(it)) {
|
||||
FelicaArea* ancestor = *FelicaAreaPath_ref(it);
|
||||
furi_string_cat_printf(header, "%d/", ancestor->number);
|
||||
}
|
||||
area = *FelicaAreaPath_back(state->selected_areas);
|
||||
}
|
||||
furi_string_cat(header, "Areas");
|
||||
|
||||
submenu_set_header(submenu, furi_string_get_cstr(header));
|
||||
furi_string_free(header);
|
||||
|
||||
for
|
||||
M_EACH(node, area->nodes, FelicaNodeArray_t) {
|
||||
FuriString* node_name = furi_string_alloc();
|
||||
if(node->type == FelicaNodeTypeArea) {
|
||||
furi_string_printf(node_name, "Area %d", node->area->number);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
furi_string_get_cstr(node_name),
|
||||
i++,
|
||||
nfc_scene_felica_info_select_submenu_callback,
|
||||
nfc);
|
||||
} else {
|
||||
uint16_t service_code = node->service->number << 6;
|
||||
furi_string_printf(node_name, "Service %04X", service_code);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
furi_string_get_cstr(node_name),
|
||||
i++,
|
||||
nfc_scene_felica_info_select_submenu_callback,
|
||||
nfc);
|
||||
}
|
||||
|
||||
furi_string_free(node_name);
|
||||
}
|
||||
}
|
||||
|
||||
state->selected_service = NULL;
|
||||
submenu_set_selected_item(
|
||||
nfc->submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneFelicaInfoSelect));
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
||||
}
|
||||
|
||||
bool nfc_scene_felica_info_select_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
FelicaData* data = &nfc->dev->dev_data.felica_data;
|
||||
FelicaSelectState* state = &nfc->felica_select;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
uint8_t index = event.event;
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneMfUltralightMenu, index);
|
||||
|
||||
if(index == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
index -= 1;
|
||||
if(state->selected_system == NULL) {
|
||||
state->selected_system = FelicaSystemArray_get(data->systems, index);
|
||||
if(state->selected_system->code == LITE_SYSTEM_CODE) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaServiceData);
|
||||
} else {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaInfoSelect);
|
||||
}
|
||||
consumed = true;
|
||||
} else {
|
||||
FelicaNode* selected_node = NULL;
|
||||
|
||||
FelicaNode* root = &(state->selected_system->root);
|
||||
furi_assert(root->type == FelicaNodeTypeArea);
|
||||
|
||||
if(FelicaAreaPath_size(state->selected_areas) == 0) {
|
||||
selected_node = FelicaNodeArray_get(root->area->nodes, index);
|
||||
} else {
|
||||
FelicaArea* current_area = *FelicaAreaPath_back(state->selected_areas);
|
||||
selected_node = FelicaNodeArray_get(current_area->nodes, index);
|
||||
}
|
||||
|
||||
if(selected_node->type == FelicaNodeTypeArea) {
|
||||
FelicaAreaPath_push_back(state->selected_areas, selected_node->area);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaInfoSelect);
|
||||
consumed = true;
|
||||
} else if(selected_node->type == FelicaNodeTypeService) {
|
||||
state->selected_service = selected_node->service;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaServiceData);
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
if(FelicaAreaPath_size(state->selected_areas) <= 1) {
|
||||
FelicaAreaPath_clear(state->selected_areas);
|
||||
state->selected_system = NULL;
|
||||
} else {
|
||||
FelicaAreaPath_pop_back(NULL, state->selected_areas);
|
||||
}
|
||||
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_felica_info_select_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Clear view
|
||||
FelicaAreaPath_clear(nfc->felica_select.selected_areas);
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
enum SubmenuIndex {
|
||||
/*
|
||||
SubmenuIndexUnlock,
|
||||
*/
|
||||
SubmenuIndexSave,
|
||||
/*
|
||||
SubmenuIndexEmulate,
|
||||
*/
|
||||
SubmenuIndexInfo,
|
||||
};
|
||||
|
||||
void nfc_scene_felica_menu_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_felica_menu_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
// FelicaData* data = &nfc->dev->dev_data.felica_data;
|
||||
|
||||
/*
|
||||
submenu_add_item(
|
||||
submenu, "Unlock", SubmenuIndexUnlock, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
*/
|
||||
submenu_add_item(
|
||||
submenu, "Save", SubmenuIndexSave, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
/*
|
||||
submenu_add_item(
|
||||
submenu, "Emulate", SubmenuIndexEmulate, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
*/
|
||||
submenu_add_item(
|
||||
submenu, "Info", SubmenuIndexInfo, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
|
||||
submenu_set_selected_item(
|
||||
nfc->submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneFelicaMenu));
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
||||
}
|
||||
|
||||
bool nfc_scene_felica_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexSave) {
|
||||
nfc->dev->format = NfcDeviceSaveFormatFelica;
|
||||
// Clear device name
|
||||
nfc_device_set_name(nfc->dev, "");
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
|
||||
consumed = true;
|
||||
/*
|
||||
} else if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaEmulate);
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
|
||||
dolphin_deed(DolphinDeedNfcAddEmulate);
|
||||
} else {
|
||||
dolphin_deed(DolphinDeedNfcEmulate);
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexUnlock) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaUnlockMenu);
|
||||
consumed = true;
|
||||
*/
|
||||
} else if(event.event == SubmenuIndexInfo) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaInfoSelect);
|
||||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneFelicaMenu, event.event);
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_felica_menu_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Clear view
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
|
||||
void nfc_scene_felica_read_success_widget_callback(
|
||||
GuiButtonType result,
|
||||
InputType type,
|
||||
void* context) {
|
||||
furi_assert(context);
|
||||
Nfc* nfc = context;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
|
||||
}
|
||||
}
|
||||
|
||||
void nfc_scene_felica_read_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
FelicaData* felica_data = &nfc->dev->dev_data.felica_data;
|
||||
|
||||
// Setup view
|
||||
Widget* widget = nfc->widget;
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeLeft, "Retry", nfc_scene_felica_read_success_widget_callback, nfc);
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeRight, "More", nfc_scene_felica_read_success_widget_callback, nfc);
|
||||
|
||||
FuriString* temp_str = NULL;
|
||||
if(furi_string_size(nfc->dev->dev_data.parsed_data)) {
|
||||
temp_str = furi_string_alloc_set(nfc->dev->dev_data.parsed_data);
|
||||
} else {
|
||||
temp_str = furi_string_alloc_printf("\e#%s", nfc_felica_type(felica_data->type));
|
||||
|
||||
for
|
||||
M_EACH(current_system, felica_data->systems, FelicaSystemArray_t) {
|
||||
furi_string_cat_printf(
|
||||
temp_str, "\nSystem %04X (#%d):", current_system->code, current_system->number);
|
||||
furi_string_cat_printf(temp_str, "\nIDm:\n ");
|
||||
for(size_t i = 0; i < 8; i++) {
|
||||
furi_string_cat_printf(temp_str, "%02X", current_system->idm[i]);
|
||||
}
|
||||
furi_string_cat_printf(temp_str, "\nPMm:\n ");
|
||||
for(size_t i = 0; i < 8; i++) {
|
||||
furi_string_cat_printf(temp_str, "%02X", current_system->pmm[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
widget_add_text_scroll_element(widget, 0, 0, 128, 52, furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
|
||||
notification_message_block(nfc->notifications, &sequence_set_green_255);
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||
}
|
||||
|
||||
bool nfc_scene_felica_read_success_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == GuiButtonTypeLeft) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRetryConfirm);
|
||||
consumed = true;
|
||||
} else if(event.event == GuiButtonTypeRight) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaMenu);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_felica_read_success_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
notification_message_block(nfc->notifications, &sequence_reset_green);
|
||||
|
||||
// Clear view
|
||||
widget_reset(nfc->widget);
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
|
||||
void nfc_scene_felica_service_data_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
FelicaSelectState* select_state = &nfc->felica_select;
|
||||
FelicaSystem* system = select_state->selected_system;
|
||||
//FelicaService* service = select_state->selected_service;
|
||||
TextBox* text_box = nfc->text_box;
|
||||
|
||||
if(system->code == LITE_SYSTEM_CODE) {
|
||||
FelicaLiteInfo* lite_info = &system->lite_info;
|
||||
uint8_t* data;
|
||||
text_box_set_font(text_box, TextBoxFontHex);
|
||||
furi_string_cat_str(nfc->text_box_store, "S_PAD:\n");
|
||||
for(int i = 0; i < REG_LITE_BLOCK; i++) {
|
||||
data = lite_info->S_PAD[i];
|
||||
for(uint16_t i = 0; i < FELICA_BLOCK_SIZE; i += 2) {
|
||||
if(!(i % 8) && i) {
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
}
|
||||
if(data != NULL) {
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
} else {
|
||||
furi_string_cat_printf(nfc->text_box_store, "???? ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
furi_string_cat_str(nfc->text_box_store, "REG:\n");
|
||||
data = lite_info->REG;
|
||||
for(uint16_t i = 0; i < FELICA_BLOCK_SIZE; i += 2) {
|
||||
if(!(i % 8) && i) {
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
}
|
||||
if(data != NULL) {
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
} else {
|
||||
furi_string_cat_printf(nfc->text_box_store, "???? ");
|
||||
}
|
||||
}
|
||||
|
||||
furi_string_cat_str(nfc->text_box_store, "MAC:\n");
|
||||
data = lite_info->MAC;
|
||||
for(uint16_t i = 0; i < 8; i += 2) {
|
||||
if(!(i % 8) && i) {
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
}
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
}
|
||||
|
||||
furi_string_cat_printf(nfc->text_box_store, "DFC: %04X\n", lite_info->data_format_code);
|
||||
|
||||
furi_string_cat_str(nfc->text_box_store, "ID data:\n");
|
||||
data = lite_info->ID_value;
|
||||
for(uint16_t i = 0; i < 6; i += 2) {
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
}
|
||||
furi_string_cat_str(nfc->text_box_store, "\n");
|
||||
|
||||
furi_string_cat_printf(nfc->text_box_store, "CKV: %04X\n", lite_info->card_key_version);
|
||||
|
||||
furi_string_cat_str(nfc->text_box_store, "MC:\n");
|
||||
data = lite_info->memory_config;
|
||||
for(uint16_t i = 0; i < FELICA_BLOCK_SIZE; i += 2) {
|
||||
if(!(i % 8) && i) {
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
}
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
}
|
||||
|
||||
furi_string_cat_printf(nfc->text_box_store, "WCNT: %06lX\n", lite_info->write_count);
|
||||
|
||||
furi_string_cat_str(nfc->text_box_store, "MAC_A:\n");
|
||||
data = lite_info->MAC_A;
|
||||
for(uint16_t i = 0; i < 8; i += 2) {
|
||||
if(!(i % 8) && i) {
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
}
|
||||
furi_string_cat_printf(nfc->text_box_store, "%02X%02X ", data[i], data[i + 1]);
|
||||
}
|
||||
}
|
||||
text_box_set_text(text_box, furi_string_get_cstr(nfc->text_box_store));
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewTextBox);
|
||||
}
|
||||
|
||||
bool nfc_scene_felica_service_data_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_felica_service_data_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Clean view
|
||||
text_box_reset(nfc->text_box);
|
||||
furi_string_reset(nfc->text_box_store);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
void nfc_scene_nfc_data_info_widget_callback(GuiButtonType result, InputType type, void* context) {
|
||||
Nfc* nfc = context;
|
||||
@@ -89,7 +88,6 @@ void nfc_scene_nfc_data_info_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Widget* widget = nfc->widget;
|
||||
FuriHalNfcDevData* nfc_data = &nfc->dev->dev_data.nfc_data;
|
||||
FuriHalNfcType type = nfc_data->type;
|
||||
NfcDeviceData* dev_data = &nfc->dev->dev_data;
|
||||
NfcProtocol protocol = dev_data->protocol;
|
||||
uint8_t text_scroll_height = 0;
|
||||
@@ -141,8 +139,6 @@ void nfc_scene_nfc_data_info_on_enter(void* context) {
|
||||
furi_string_cat_printf(temp_str, "\e#ISO15693 (unknown)\n");
|
||||
break;
|
||||
}
|
||||
} else if(protocol == NfcDeviceProtocolFelica) {
|
||||
furi_string_cat_printf(temp_str, "\e#%s\n", nfc_felica_type(dev_data->felica_data.type));
|
||||
} else {
|
||||
furi_string_cat_printf(temp_str, "\e#Unknown ISO tag\n");
|
||||
}
|
||||
@@ -200,72 +196,16 @@ void nfc_scene_nfc_data_info_on_enter(void* context) {
|
||||
furi_string_cat_printf(temp_str, " %s\n", status);
|
||||
}
|
||||
|
||||
} else if(type == FuriHalNfcTypeF) {
|
||||
// Set NFC-F data
|
||||
furi_string_cat_printf(temp_str, "ISO 18092 (NFC-F)\n");
|
||||
furi_string_cat_printf(temp_str, "CIN:");
|
||||
// NFC-F Card Identification Number (CIN) starts at "UID" byte 2.
|
||||
for(size_t i = 2; i < nfc_data->uid_len; i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", nfc_data->uid[i]);
|
||||
}
|
||||
// The first 2 bytes of the "UID" are Manufacturer Code (MC)
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"\nMC: %02X %02X ROM: %02X IC: %02X\n\n",
|
||||
nfc_data->uid[0],
|
||||
nfc_data->uid[1],
|
||||
nfc_data->f_data.pmm[0],
|
||||
nfc_data->f_data.pmm[1]);
|
||||
|
||||
furi_string_cat_printf(temp_str, "MRT (1 node/blk):\n");
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- ReqSvc: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_VARIABLE_MRT], 1));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Fixed: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_FIXED_MRT], 0));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Auth1: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_MUTUAL_AUTH_MRT], 1));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Auth2: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_MUTUAL_AUTH_MRT], 0));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Read: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_READ_MRT], 1));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Write: %" PRIuLEAST32 "us\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_WRITE_MRT], 1));
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"- Other: %" PRIuLEAST32 "us\n\n",
|
||||
felica_estimate_timing_us(nfc_data->f_data.pmm[FELICA_PMM_OTHER_MRT], 0));
|
||||
|
||||
furi_string_cat_printf(temp_str, "IDm:");
|
||||
for(size_t i = 0; i < nfc_data->uid_len; i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", nfc_data->uid[i]);
|
||||
}
|
||||
furi_string_cat_printf(temp_str, "\nPMm:");
|
||||
for(size_t i = 0; i < sizeof(nfc_data->f_data.pmm); i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", nfc_data->f_data.pmm[i]);
|
||||
}
|
||||
} else {
|
||||
// Set tag general data
|
||||
char iso_type = FURI_BIT(nfc_data->a_data.sak, 5) ? '4' : '3';
|
||||
char iso_type = FURI_BIT(nfc_data->sak, 5) ? '4' : '3';
|
||||
furi_string_cat_printf(temp_str, "ISO 14443-%c (NFC-A)\n", iso_type);
|
||||
furi_string_cat_printf(temp_str, "UID:");
|
||||
for(size_t i = 0; i < nfc_data->uid_len; i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", nfc_data->uid[i]);
|
||||
}
|
||||
furi_string_cat_printf(
|
||||
temp_str, "\nATQA: %02X %02X ", nfc_data->a_data.atqa[1], nfc_data->a_data.atqa[0]);
|
||||
furi_string_cat_printf(temp_str, " SAK: %02X", nfc_data->a_data.sak);
|
||||
temp_str, "\nATQA: %02X %02X ", nfc_data->atqa[1], nfc_data->atqa[0]);
|
||||
furi_string_cat_printf(temp_str, " SAK: %02X", nfc_data->sak);
|
||||
}
|
||||
|
||||
// Set application specific data
|
||||
|
||||
@@ -24,15 +24,14 @@ void nfc_scene_nfca_read_success_on_enter(void* context) {
|
||||
|
||||
notification_message_block(nfc->notifications, &sequence_set_green_255);
|
||||
|
||||
char iso_type = FURI_BIT(data->a_data.sak, 5) ? '4' : '3';
|
||||
char iso_type = FURI_BIT(data->sak, 5) ? '4' : '3';
|
||||
furi_string_cat_printf(temp_str, "ISO 14443-%c (NFC-A)\n", iso_type);
|
||||
furi_string_cat_printf(temp_str, "UID:");
|
||||
for(size_t i = 0; i < data->uid_len; i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", data->uid[i]);
|
||||
}
|
||||
furi_string_cat_printf(
|
||||
temp_str, "\nATQA: %02X %02X ", data->a_data.atqa[1], data->a_data.atqa[0]);
|
||||
furi_string_cat_printf(temp_str, " SAK: %02X", data->a_data.sak);
|
||||
furi_string_cat_printf(temp_str, "\nATQA: %02X %02X ", data->atqa[1], data->atqa[0]);
|
||||
furi_string_cat_printf(temp_str, " SAK: %02X", data->sak);
|
||||
|
||||
widget_add_text_scroll_element(widget, 0, 0, 128, 52, furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
enum SubmenuIndex {
|
||||
/*
|
||||
SubmenuIndexSave,
|
||||
SubmenuIndexEmulate,
|
||||
*/
|
||||
SubmenuIndexInfo,
|
||||
};
|
||||
|
||||
void nfc_scene_nfcf_menu_submenu_callback(void* context, uint32_t index) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void nfc_scene_nfcf_menu_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
Submenu* submenu = nfc->submenu;
|
||||
// FelicaData* data = &nfc->dev->dev_data.felica_data;
|
||||
|
||||
/*
|
||||
submenu_add_item(
|
||||
submenu, "Save IDm", SubmenuIndexSave, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
submenu_add_item(
|
||||
submenu, "Emulate IDm", SubmenuIndexEmulate, nfc_scene_felica_menu_submenu_callback, nfc);
|
||||
*/
|
||||
submenu_add_item(submenu, "Info", SubmenuIndexInfo, nfc_scene_nfcf_menu_submenu_callback, nfc);
|
||||
|
||||
submenu_set_selected_item(
|
||||
nfc->submenu, scene_manager_get_scene_state(nfc->scene_manager, NfcSceneNfcfMenu));
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewMenu);
|
||||
}
|
||||
|
||||
bool nfc_scene_nfcf_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
/*
|
||||
if(event.event == SubmenuIndexSave) {
|
||||
nfc->dev->format = NfcDeviceSaveFormatFelica;
|
||||
// Clear device name
|
||||
nfc_device_set_name(nfc->dev, "");
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneSaveName);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexEmulate) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaEmulate);
|
||||
if(scene_manager_has_previous_scene(nfc->scene_manager, NfcSceneSetType)) {
|
||||
dolphin_deed(DolphinDeedNfcAddEmulate);
|
||||
} else {
|
||||
dolphin_deed(DolphinDeedNfcEmulate);
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexUnlock) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaUnlockMenu);
|
||||
consumed = true;
|
||||
} else
|
||||
*/
|
||||
if(event.event == SubmenuIndexInfo) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcDataInfo);
|
||||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneNfcfMenu, event.event);
|
||||
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_nfcf_menu_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
// Clear view
|
||||
submenu_reset(nfc->submenu);
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
#include "../nfc_i.h"
|
||||
#include "nfc_device.h"
|
||||
|
||||
void nfc_scene_nfcf_read_success_widget_callback(
|
||||
GuiButtonType result,
|
||||
InputType type,
|
||||
void* context) {
|
||||
furi_assert(context);
|
||||
Nfc* nfc = context;
|
||||
|
||||
if(type == InputTypeShort) {
|
||||
view_dispatcher_send_custom_event(nfc->view_dispatcher, result);
|
||||
}
|
||||
}
|
||||
|
||||
void nfc_scene_nfcf_read_success_on_enter(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
FuriHalNfcDevData* data = &nfc->dev->dev_data.nfc_data;
|
||||
NfcDeviceData* dev_data = &nfc->dev->dev_data;
|
||||
|
||||
// Setup view
|
||||
Widget* widget = nfc->widget;
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeLeft, "Retry", nfc_scene_nfcf_read_success_widget_callback, nfc);
|
||||
widget_add_button_element(
|
||||
widget, GuiButtonTypeRight, "More", nfc_scene_nfcf_read_success_widget_callback, nfc);
|
||||
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
|
||||
if(dev_data->protocol == NfcDeviceProtocolFelica) {
|
||||
furi_string_cat_printf(temp_str, "\e#%s", nfc_felica_type(dev_data->felica_data.type));
|
||||
} else {
|
||||
furi_string_cat_printf(temp_str, "\e#Unknown ISO tag");
|
||||
}
|
||||
|
||||
furi_string_cat_printf(temp_str, "\nISO 18092 (NFC-F)");
|
||||
|
||||
furi_string_cat_printf(temp_str, "\nCIN:");
|
||||
// NFC-F Card Identification Number (CIN) starts at "UID" byte 2.
|
||||
for(size_t i = 2; i < data->uid_len; i++) {
|
||||
furi_string_cat_printf(temp_str, " %02X", data->uid[i]);
|
||||
}
|
||||
|
||||
// The first 2 bytes of the "UID" are Manufacturer Code (MC)
|
||||
furi_string_cat_printf(
|
||||
temp_str,
|
||||
"\nMC: %02X %02X ROM: %02X IC: %02X",
|
||||
data->uid[0],
|
||||
data->uid[1],
|
||||
data->f_data.pmm[0],
|
||||
data->f_data.pmm[1]);
|
||||
|
||||
widget_add_text_scroll_element(widget, 0, 0, 128, 52, furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
|
||||
notification_message_block(nfc->notifications, &sequence_set_green_255);
|
||||
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewWidget);
|
||||
}
|
||||
|
||||
bool nfc_scene_nfcf_read_success_on_event(void* context, SceneManagerEvent event) {
|
||||
Nfc* nfc = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == GuiButtonTypeLeft) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRetryConfirm);
|
||||
consumed = true;
|
||||
} else if(event.event == GuiButtonTypeRight) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcfMenu);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);
|
||||
consumed = true;
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void nfc_scene_nfcf_read_success_on_exit(void* context) {
|
||||
Nfc* nfc = context;
|
||||
|
||||
notification_message_block(nfc->notifications, &sequence_reset_green);
|
||||
|
||||
// Clear view
|
||||
widget_reset(nfc->widget);
|
||||
}
|
||||
@@ -57,6 +57,7 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if((event.event == NfcWorkerEventReadUidNfcB) ||
|
||||
(event.event == NfcWorkerEventReadUidNfcF) ||
|
||||
(event.event == NfcWorkerEventReadUidNfcV)) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneReadCardSuccess);
|
||||
@@ -101,16 +102,6 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventReadUidNfcF) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneNfcfReadSuccess);
|
||||
dolphin_deed(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventReadFelica) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneFelicaReadSuccess);
|
||||
dolphin_deed(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventCardDetected) {
|
||||
nfc_scene_read_set_state(nfc, NfcSceneReadStateReading);
|
||||
nfc_blink_detect_start(nfc);
|
||||
|
||||
@@ -7,8 +7,6 @@ enum SubmenuIndex {
|
||||
SubmenuIndexReadMfUltralight,
|
||||
SubmenuIndexReadEMV,
|
||||
SubmenuIndexReadNFCA,
|
||||
SubmenuIndexReadFelica,
|
||||
SubmenuIndexReadNFCF,
|
||||
};
|
||||
|
||||
void nfc_scene_read_card_type_submenu_callback(void* context, uint32_t index) {
|
||||
@@ -51,18 +49,6 @@ void nfc_scene_read_card_type_on_enter(void* context) {
|
||||
SubmenuIndexReadNFCA,
|
||||
nfc_scene_read_card_type_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read FeliCa",
|
||||
SubmenuIndexReadFelica,
|
||||
nfc_scene_read_card_type_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read NFC-F data",
|
||||
SubmenuIndexReadNFCF,
|
||||
nfc_scene_read_card_type_submenu_callback,
|
||||
nfc);
|
||||
uint32_t state = scene_manager_get_scene_state(nfc->scene_manager, NfcSceneReadCardType);
|
||||
submenu_set_selected_item(submenu, state);
|
||||
|
||||
@@ -99,16 +85,6 @@ bool nfc_scene_read_card_type_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
consumed = true;
|
||||
}
|
||||
if(event.event == SubmenuIndexReadFelica) {
|
||||
nfc->dev->dev_data.read_mode = NfcReadModeFelica;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
consumed = true;
|
||||
}
|
||||
if(event.event == SubmenuIndexReadNFCF) {
|
||||
nfc->dev->dev_data.read_mode = NfcReadModeNFCF;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
consumed = true;
|
||||
}
|
||||
scene_manager_set_scene_state(nfc->scene_manager, NfcSceneReadCardType, event.event);
|
||||
}
|
||||
return consumed;
|
||||
|
||||
@@ -17,7 +17,7 @@ void nfc_scene_set_atqa_on_enter(void* context) {
|
||||
nfc_scene_set_atqa_byte_input_callback,
|
||||
NULL,
|
||||
nfc,
|
||||
nfc->dev->dev_data.nfc_data.a_data.atqa,
|
||||
nfc->dev->dev_data.nfc_data.atqa,
|
||||
2);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewByteInput);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void nfc_scene_set_sak_on_enter(void* context) {
|
||||
nfc_scene_set_sak_byte_input_callback,
|
||||
NULL,
|
||||
nfc,
|
||||
&nfc->dev->dev_data.nfc_data.a_data.sak,
|
||||
&nfc->dev->dev_data.nfc_data.sak,
|
||||
1);
|
||||
view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewByteInput);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
App(
|
||||
appid="subghz",
|
||||
name="SubGHz",
|
||||
apptype=FlipperAppType.MENUEXTERNAL,
|
||||
apptype=FlipperAppType.APP,
|
||||
targets=["f7"],
|
||||
cdefines=["APP_SUBGHZ"],
|
||||
entry_point="subghz_app",
|
||||
requires=[
|
||||
"gui",
|
||||
@@ -25,6 +26,7 @@ App(
|
||||
targets=["f7"],
|
||||
apptype=FlipperAppType.STARTUP,
|
||||
entry_point="subghz_on_system_start",
|
||||
requires=["subghz"],
|
||||
order=40,
|
||||
)
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ static void subghz_load_custom_presets(SubGhzSetting* setting) {
|
||||
furi_assert(setting);
|
||||
|
||||
const char* presets[][2] = {
|
||||
// FM95
|
||||
{"FM95",
|
||||
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
||||
|
||||
@@ -71,6 +72,11 @@ static void subghz_load_custom_presets(SubGhzSetting* setting) {
|
||||
// # HND - FM preset
|
||||
{"HND_1",
|
||||
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 36 10 69 15 32 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
||||
|
||||
// AM_Q
|
||||
{"AM_Q",
|
||||
"02 0D 03 07 08 32 0B 06 14 00 13 00 12 30 11 22 10 1C 18 18 19 18 1D 91 1C 00 1B 07 20 FB 22 11 21 B6 00 00 00 C0 00 00 00 00 00 00"},
|
||||
|
||||
};
|
||||
|
||||
FlipperFormat* fff_temp = flipper_format_string_alloc();
|
||||
|
||||
@@ -3,6 +3,8 @@ ADD_SCENE(xtreme_app, interface, Interface)
|
||||
ADD_SCENE(xtreme_app, interface_graphics, InterfaceGraphics)
|
||||
ADD_SCENE(xtreme_app, interface_mainmenu, InterfaceMainmenu)
|
||||
ADD_SCENE(xtreme_app, interface_mainmenu_add, InterfaceMainmenuAdd)
|
||||
ADD_SCENE(xtreme_app, interface_mainmenu_add_main, InterfaceMainmenuAddMain)
|
||||
ADD_SCENE(xtreme_app, interface_mainmenu_reset, InterfaceMainmenuReset)
|
||||
ADD_SCENE(xtreme_app, interface_lockscreen, InterfaceLockscreen)
|
||||
ADD_SCENE(xtreme_app, interface_statusbar, InterfaceStatusbar)
|
||||
ADD_SCENE(xtreme_app, interface_filebrowser, InterfaceFilebrowser)
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexMenuStyle,
|
||||
VarItemListIndexResetMenu,
|
||||
VarItemListIndexApp,
|
||||
VarItemListIndexRemoveApp,
|
||||
VarItemListIndexAddApp,
|
||||
VarItemListIndexMoveApp,
|
||||
VarItemListIndexRemoveApp,
|
||||
};
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_var_item_list_callback(void* context, uint32_t index) {
|
||||
@@ -24,7 +26,33 @@ static void xtreme_app_scene_interface_mainmenu_app_changed(VariableItem* item)
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
app->mainmenu_app_index = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(
|
||||
item, *CharList_get(app->mainmenu_app_names, app->mainmenu_app_index));
|
||||
item, *CharList_get(app->mainmenu_app_labels, app->mainmenu_app_index));
|
||||
size_t count = CharList_size(app->mainmenu_app_labels);
|
||||
char label[20];
|
||||
snprintf(label, 20, "App %u/%u", 1 + app->mainmenu_app_index, count);
|
||||
variable_item_set_item_label(item, label);
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_mainmenu_move_app_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
uint8_t idx = app->mainmenu_app_index;
|
||||
size_t size = CharList_size(app->mainmenu_app_labels);
|
||||
uint8_t dir = variable_item_get_current_value_index(item);
|
||||
if(size >= 2) {
|
||||
if(dir == 2 && idx != size - 1) {
|
||||
// Right
|
||||
CharList_swap_at(app->mainmenu_app_labels, idx, idx + 1);
|
||||
CharList_swap_at(app->mainmenu_app_exes, idx, idx + 1);
|
||||
app->mainmenu_app_index++;
|
||||
} else if(dir == 0 && idx != 0) {
|
||||
// Left
|
||||
CharList_swap_at(app->mainmenu_app_labels, idx, idx - 1);
|
||||
CharList_swap_at(app->mainmenu_app_exes, idx, idx - 1);
|
||||
app->mainmenu_app_index--;
|
||||
}
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, VarItemListIndexMoveApp);
|
||||
}
|
||||
variable_item_set_current_value_index(item, 1);
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
|
||||
@@ -39,25 +67,34 @@ void xtreme_app_scene_interface_mainmenu_on_enter(void* context) {
|
||||
variable_item_set_current_value_text(
|
||||
item, xtreme_settings->wii_menu ? "Wii Grid" : "App List");
|
||||
|
||||
variable_item_list_add(var_item_list, "Reset Menu", 0, NULL, app);
|
||||
|
||||
size_t count = CharList_size(app->mainmenu_app_labels);
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"App",
|
||||
CharList_size(app->mainmenu_app_names),
|
||||
xtreme_app_scene_interface_mainmenu_app_changed,
|
||||
app);
|
||||
app->mainmenu_app_index = 0;
|
||||
variable_item_set_current_value_index(item, app->mainmenu_app_index);
|
||||
if(CharList_size(app->mainmenu_app_names)) {
|
||||
var_item_list, "App", count, xtreme_app_scene_interface_mainmenu_app_changed, app);
|
||||
if(count) {
|
||||
app->mainmenu_app_index = CLAMP(app->mainmenu_app_index, count - 1, 0U);
|
||||
char label[20];
|
||||
snprintf(label, 20, "App %u/%u", 1 + app->mainmenu_app_index, count);
|
||||
variable_item_set_item_label(item, label);
|
||||
variable_item_set_current_value_text(
|
||||
item, *CharList_get(app->mainmenu_app_names, app->mainmenu_app_index));
|
||||
item, *CharList_get(app->mainmenu_app_labels, app->mainmenu_app_index));
|
||||
} else {
|
||||
app->mainmenu_app_index = 0;
|
||||
variable_item_set_current_value_text(item, "None");
|
||||
}
|
||||
|
||||
variable_item_list_add(var_item_list, "Remove App", 0, NULL, app);
|
||||
variable_item_set_current_value_index(item, app->mainmenu_app_index);
|
||||
|
||||
variable_item_list_add(var_item_list, "Add App", 0, NULL, app);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Move App", 3, xtreme_app_scene_interface_mainmenu_move_app_changed, app);
|
||||
variable_item_set_current_value_text(item, "");
|
||||
variable_item_set_current_value_index(item, 1);
|
||||
variable_item_set_locked(item, count < 2, "Can't move\nwith less\nthan 2 apps!");
|
||||
|
||||
variable_item_list_add(var_item_list, "Remove App", 0, NULL, app);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
var_item_list, xtreme_app_scene_interface_mainmenu_var_item_list_callback, app);
|
||||
|
||||
@@ -77,13 +114,21 @@ bool xtreme_app_scene_interface_mainmenu_on_event(void* context, SceneManagerEve
|
||||
app->scene_manager, XtremeAppSceneInterfaceMainmenu, event.event);
|
||||
consumed = true;
|
||||
switch(event.event) {
|
||||
case VarItemListIndexResetMenu:
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuReset);
|
||||
break;
|
||||
case VarItemListIndexRemoveApp:
|
||||
if(!CharList_size(app->mainmenu_app_names)) break;
|
||||
if(!CharList_size(app->mainmenu_app_paths)) break;
|
||||
if(!CharList_size(app->mainmenu_app_labels)) break;
|
||||
if(!CharList_size(app->mainmenu_app_exes)) break;
|
||||
free(*CharList_get(app->mainmenu_app_labels, app->mainmenu_app_index));
|
||||
free(*CharList_get(app->mainmenu_app_exes, app->mainmenu_app_index));
|
||||
CharList_remove_v(
|
||||
app->mainmenu_app_names, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||
app->mainmenu_app_labels, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||
CharList_remove_v(
|
||||
app->mainmenu_app_paths, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||
app->mainmenu_app_exes, app->mainmenu_app_index, app->mainmenu_app_index + 1);
|
||||
if(app->mainmenu_app_index) app->mainmenu_app_index--;
|
||||
/* fall through */
|
||||
case VarItemListIndexMoveApp:
|
||||
app->save_mainmenu_apps = true;
|
||||
app->require_reboot = true;
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "../xtreme_app.h"
|
||||
|
||||
enum FileBrowserResult {
|
||||
FileBrowserResultOk,
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexMainApp,
|
||||
SubmenuIndexExternalApp,
|
||||
};
|
||||
|
||||
static bool xtreme_app_scene_interface_mainmenu_add_file_browser_callback(
|
||||
static bool fap_selector_item_callback(
|
||||
FuriString* file_path,
|
||||
void* context,
|
||||
uint8_t** icon_ptr,
|
||||
@@ -16,52 +17,87 @@ static bool xtreme_app_scene_interface_mainmenu_add_file_browser_callback(
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
xtreme_app_scene_interface_mainmenu_add_submenu_callback(void* context, uint32_t index) {
|
||||
XtremeApp* app = context;
|
||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneInterfaceMainmenuAdd, index);
|
||||
|
||||
switch(index) {
|
||||
case SubmenuIndexMainApp:
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneInterfaceMainmenuAddMain);
|
||||
break;
|
||||
case SubmenuIndexExternalApp: {
|
||||
const DialogsFileBrowserOptions browser_options = {
|
||||
.extension = ".fap",
|
||||
.icon = &I_unknown_10px,
|
||||
.skip_assets = true,
|
||||
.hide_ext = true,
|
||||
.item_loader_callback = fap_selector_item_callback,
|
||||
.item_loader_context = app,
|
||||
.base_path = EXT_PATH("apps"),
|
||||
};
|
||||
FuriString* temp_path = furi_string_alloc_set_str(EXT_PATH("apps"));
|
||||
if(dialog_file_browser_show(app->dialogs, temp_path, temp_path, &browser_options)) {
|
||||
CharList_push_back(app->mainmenu_app_exes, strdup(furi_string_get_cstr(temp_path)));
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
flipper_application_load_name_and_icon(temp_path, storage, NULL, temp_path);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
if(furi_string_start_with_str(temp_path, "[")) {
|
||||
size_t trim = furi_string_search_str(temp_path, "] ", 1);
|
||||
if(trim != FURI_STRING_FAILURE) {
|
||||
furi_string_right(temp_path, trim + 2);
|
||||
}
|
||||
}
|
||||
CharList_push_back(app->mainmenu_app_labels, strdup(furi_string_get_cstr(temp_path)));
|
||||
app->mainmenu_app_index = CharList_size(app->mainmenu_app_labels) - 1;
|
||||
app->save_mainmenu_apps = true;
|
||||
app->require_reboot = true;
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, XtremeAppSceneInterfaceMainmenu);
|
||||
}
|
||||
furi_string_free(temp_path);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_add_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
FuriString* string = furi_string_alloc_set_str(EXT_PATH("apps"));
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
const DialogsFileBrowserOptions browser_options = {
|
||||
.extension = ".fap",
|
||||
.skip_assets = true,
|
||||
.hide_ext = true,
|
||||
.item_loader_callback = xtreme_app_scene_interface_mainmenu_add_file_browser_callback,
|
||||
.item_loader_context = app,
|
||||
.base_path = EXT_PATH("apps"),
|
||||
};
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Main App",
|
||||
SubmenuIndexMainApp,
|
||||
xtreme_app_scene_interface_mainmenu_add_submenu_callback,
|
||||
app);
|
||||
|
||||
if(dialog_file_browser_show(app->dialogs, string, string, &browser_options)) {
|
||||
CharList_push_back(app->mainmenu_app_paths, strdup(furi_string_get_cstr(string)));
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
flipper_application_load_name_and_icon(string, storage, NULL, string);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
CharList_push_back(app->mainmenu_app_names, strdup(furi_string_get_cstr(string)));
|
||||
app->save_mainmenu_apps = true;
|
||||
app->require_reboot = true;
|
||||
}
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"External App",
|
||||
SubmenuIndexExternalApp,
|
||||
xtreme_app_scene_interface_mainmenu_add_submenu_callback,
|
||||
app);
|
||||
|
||||
furi_string_free(string);
|
||||
submenu_set_header(submenu, "Add Menu App:");
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, FileBrowserResultOk);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewSubmenu);
|
||||
}
|
||||
|
||||
bool xtreme_app_scene_interface_mainmenu_add_on_event(void* context, SceneManagerEvent event) {
|
||||
XtremeApp* app = context;
|
||||
UNUSED(context);
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
consumed = true;
|
||||
switch(event.event) {
|
||||
case FileBrowserResultOk:
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_add_on_exit(void* context) {
|
||||
UNUSED(context);
|
||||
XtremeApp* app = context;
|
||||
submenu_reset(app->submenu);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#include "../xtreme_app.h"
|
||||
|
||||
static void
|
||||
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback(void* context, uint32_t index) {
|
||||
XtremeApp* app = context;
|
||||
const char* name = (const char*)index;
|
||||
|
||||
CharList_push_back(app->mainmenu_app_exes, strdup(name));
|
||||
CharList_push_back(app->mainmenu_app_labels, strdup(name));
|
||||
app->mainmenu_app_index = CharList_size(app->mainmenu_app_labels) - 1;
|
||||
app->save_mainmenu_apps = true;
|
||||
app->require_reboot = true;
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
app->scene_manager, XtremeAppSceneInterfaceMainmenu);
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_add_main_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
Submenu* submenu = app->submenu;
|
||||
|
||||
for(size_t i = 0; i < FLIPPER_APPS_COUNT; i++) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
FLIPPER_APPS[i].name,
|
||||
(uint32_t)FLIPPER_APPS[i].name,
|
||||
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback,
|
||||
app);
|
||||
}
|
||||
for(size_t i = 0; i < FLIPPER_EXTERNAL_APPS_COUNT - 1; i++) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
FLIPPER_EXTERNAL_APPS[i].name,
|
||||
(uint32_t)FLIPPER_EXTERNAL_APPS[i].name,
|
||||
xtreme_app_scene_interface_mainmenu_add_main_submenu_callback,
|
||||
app);
|
||||
}
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewSubmenu);
|
||||
}
|
||||
|
||||
bool xtreme_app_scene_interface_mainmenu_add_main_on_event(void* context, SceneManagerEvent event) {
|
||||
UNUSED(context);
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_add_main_on_exit(void* context) {
|
||||
XtremeApp* app = context;
|
||||
submenu_reset(app->submenu);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#include "../xtreme_app.h"
|
||||
|
||||
static void xtreme_app_scene_interface_mainmenu_reset_dialog_callback(
|
||||
DialogExResult result,
|
||||
void* context) {
|
||||
XtremeApp* app = context;
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, result);
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_reset_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
DialogEx* dialog_ex = app->dialog_ex;
|
||||
|
||||
dialog_ex_set_header(dialog_ex, "Reset Menu Apps?", 64, 10, AlignCenter, AlignCenter);
|
||||
dialog_ex_set_text(dialog_ex, "Your edits will be lost!", 64, 32, AlignCenter, AlignCenter);
|
||||
dialog_ex_set_left_button_text(dialog_ex, "Cancel");
|
||||
dialog_ex_set_right_button_text(dialog_ex, "Reset");
|
||||
|
||||
dialog_ex_set_context(dialog_ex, app);
|
||||
dialog_ex_set_result_callback(
|
||||
dialog_ex, xtreme_app_scene_interface_mainmenu_reset_dialog_callback);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewDialogEx);
|
||||
}
|
||||
|
||||
bool xtreme_app_scene_interface_mainmenu_reset_on_event(void* context, SceneManagerEvent event) {
|
||||
XtremeApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
switch(event.event) {
|
||||
case DialogExResultRight:
|
||||
storage_common_remove(furi_record_open(RECORD_STORAGE), XTREME_MENU_PATH);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
app->save_mainmenu_apps = false;
|
||||
app->require_reboot = true;
|
||||
xtreme_app_apply(app);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void xtreme_app_scene_interface_mainmenu_reset_on_exit(void* context) {
|
||||
XtremeApp* app = context;
|
||||
DialogEx* dialog_ex = app->dialog_ex;
|
||||
|
||||
dialog_ex_reset(dialog_ex);
|
||||
}
|
||||
@@ -16,11 +16,12 @@ bool xtreme_app_apply(XtremeApp* app) {
|
||||
|
||||
if(app->save_mainmenu_apps) {
|
||||
Stream* stream = file_stream_alloc(storage);
|
||||
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||
if(file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||
stream_write_format(stream, "MenuAppList Version %u\n", 0);
|
||||
CharList_it_t it;
|
||||
CharList_it(it, app->mainmenu_app_paths);
|
||||
for(uint i = 0; i < CharList_size(app->mainmenu_app_paths); i++) {
|
||||
stream_write_format(stream, "%s\n", *CharList_get(app->mainmenu_app_paths, i));
|
||||
CharList_it(it, app->mainmenu_app_exes);
|
||||
for(size_t i = 0; i < CharList_size(app->mainmenu_app_exes); i++) {
|
||||
stream_write_format(stream, "%s\n", *CharList_get(app->mainmenu_app_exes, i));
|
||||
}
|
||||
}
|
||||
file_stream_close(stream);
|
||||
@@ -184,6 +185,10 @@ XtremeApp* xtreme_app_alloc() {
|
||||
XtremeAppViewVarItemList,
|
||||
variable_item_list_get_view(app->var_item_list));
|
||||
|
||||
app->submenu = submenu_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, XtremeAppViewSubmenu, submenu_get_view(app->submenu));
|
||||
|
||||
app->text_input = text_input_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, XtremeAppViewTextInput, text_input_get_view(app->text_input));
|
||||
@@ -191,6 +196,10 @@ XtremeApp* xtreme_app_alloc() {
|
||||
app->popup = popup_alloc();
|
||||
view_dispatcher_add_view(app->view_dispatcher, XtremeAppViewPopup, popup_get_view(app->popup));
|
||||
|
||||
app->dialog_ex = dialog_ex_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, XtremeAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
|
||||
|
||||
// Settings init
|
||||
|
||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||
@@ -204,9 +213,8 @@ XtremeApp* xtreme_app_alloc() {
|
||||
if(storage_dir_open(folder, XTREME_ASSETS_PATH)) {
|
||||
while(storage_dir_read(folder, &info, name, XTREME_ASSETS_PACK_NAME_LEN)) {
|
||||
if(info.flags & FSF_DIRECTORY) {
|
||||
char* copy = malloc(XTREME_ASSETS_PACK_NAME_LEN);
|
||||
strlcpy(copy, name, XTREME_ASSETS_PACK_NAME_LEN);
|
||||
uint idx = 0;
|
||||
char* copy = strdup(name);
|
||||
size_t idx = 0;
|
||||
if(strcmp(copy, "NSFW") != 0) {
|
||||
for(; idx < CharList_size(app->asset_pack_names); idx++) {
|
||||
char* comp = *CharList_get(app->asset_pack_names, idx);
|
||||
@@ -228,17 +236,24 @@ XtremeApp* xtreme_app_alloc() {
|
||||
free(name);
|
||||
storage_file_free(folder);
|
||||
|
||||
CharList_init(app->mainmenu_app_names);
|
||||
CharList_init(app->mainmenu_app_paths);
|
||||
CharList_init(app->mainmenu_app_labels);
|
||||
CharList_init(app->mainmenu_app_exes);
|
||||
Stream* stream = file_stream_alloc(storage);
|
||||
FuriString* line = furi_string_alloc();
|
||||
if(file_stream_open(stream, XTREME_APPS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
if(file_stream_open(stream, XTREME_MENU_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
stream_read_line(stream, line);
|
||||
while(stream_read_line(stream, line)) {
|
||||
furi_string_replace_all(line, "\r", "");
|
||||
furi_string_replace_all(line, "\n", "");
|
||||
CharList_push_back(app->mainmenu_app_paths, strdup(furi_string_get_cstr(line)));
|
||||
CharList_push_back(app->mainmenu_app_exes, strdup(furi_string_get_cstr(line)));
|
||||
flipper_application_load_name_and_icon(line, storage, NULL, line);
|
||||
CharList_push_back(app->mainmenu_app_names, strdup(furi_string_get_cstr(line)));
|
||||
if(furi_string_start_with_str(line, "[")) {
|
||||
size_t trim = furi_string_search_str(line, "] ", 1);
|
||||
if(trim != FURI_STRING_FAILURE) {
|
||||
furi_string_right(line, trim + 2);
|
||||
}
|
||||
}
|
||||
CharList_push_back(app->mainmenu_app_labels, strdup(furi_string_get_cstr(line)));
|
||||
}
|
||||
}
|
||||
furi_string_free(line);
|
||||
@@ -298,10 +313,14 @@ void xtreme_app_free(XtremeApp* app) {
|
||||
// Gui modules
|
||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||
variable_item_list_free(app->var_item_list);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewSubmenu);
|
||||
submenu_free(app->submenu);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewTextInput);
|
||||
text_input_free(app->text_input);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewPopup);
|
||||
popup_free(app->popup);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, XtremeAppViewDialogEx);
|
||||
dialog_ex_free(app->dialog_ex);
|
||||
|
||||
// View Dispatcher and Scene Manager
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
@@ -315,14 +334,14 @@ void xtreme_app_free(XtremeApp* app) {
|
||||
}
|
||||
CharList_clear(app->asset_pack_names);
|
||||
|
||||
for(CharList_it(it, app->mainmenu_app_names); !CharList_end_p(it); CharList_next(it)) {
|
||||
for(CharList_it(it, app->mainmenu_app_labels); !CharList_end_p(it); CharList_next(it)) {
|
||||
free(*CharList_cref(it));
|
||||
}
|
||||
CharList_clear(app->mainmenu_app_names);
|
||||
for(CharList_it(it, app->mainmenu_app_paths); !CharList_end_p(it); CharList_next(it)) {
|
||||
CharList_clear(app->mainmenu_app_labels);
|
||||
for(CharList_it(it, app->mainmenu_app_exes); !CharList_end_p(it); CharList_next(it)) {
|
||||
free(*CharList_cref(it));
|
||||
}
|
||||
CharList_clear(app->mainmenu_app_paths);
|
||||
CharList_clear(app->mainmenu_app_exes);
|
||||
|
||||
FrequencyList_clear(app->subghz_static_freqs);
|
||||
FrequencyList_clear(app->subghz_hopper_freqs);
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <assets_icons.h>
|
||||
#include <applications.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/modules/text_input.h>
|
||||
#include <gui/modules/popup.h>
|
||||
#include <lib/toolbox/value_index.h>
|
||||
@@ -37,13 +40,15 @@ typedef struct {
|
||||
SceneManager* scene_manager;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
VariableItemList* var_item_list;
|
||||
Submenu* submenu;
|
||||
TextInput* text_input;
|
||||
Popup* popup;
|
||||
DialogEx* dialog_ex;
|
||||
|
||||
CharList_t asset_pack_names;
|
||||
uint8_t asset_pack_index;
|
||||
CharList_t mainmenu_app_names;
|
||||
CharList_t mainmenu_app_paths;
|
||||
CharList_t mainmenu_app_labels;
|
||||
CharList_t mainmenu_app_exes;
|
||||
uint8_t mainmenu_app_index;
|
||||
bool subghz_use_defaults;
|
||||
FrequencyList_t subghz_static_freqs;
|
||||
@@ -72,8 +77,10 @@ typedef struct {
|
||||
|
||||
typedef enum {
|
||||
XtremeAppViewVarItemList,
|
||||
XtremeAppViewSubmenu,
|
||||
XtremeAppViewTextInput,
|
||||
XtremeAppViewPopup,
|
||||
XtremeAppViewDialogEx,
|
||||
} XtremeAppView;
|
||||
|
||||
bool xtreme_app_apply(XtremeApp* app);
|
||||
|
||||
Reference in New Issue
Block a user