mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-22 18:53:18 +00:00
0a8a944e10
* SubGhz: Add millis() furi, add subghz history struct * SubGhz: Fix subghz history * Gubghz: Fix code repeat history, add clean history * SubGhz: reading and adding keys to history * Gui: Renaming Sub 1-Ghz -> SubGhz * Archive: Renaming Sub 1-Ghz -> SubGhz * SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol * Archive: Fix name subghz * SubGhz: Menu navigation * Assets: Add assets/SubGHz/icon.png * Assets: add new icons for subghz * SubGhz: Fix name Add manually scene * SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol * SubGhz: fix memory leak * SubGhz: change of receiving frequency for read scene * SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene * SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser * Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter * Fix formatting and release build * SubGhz: Delete read scene * SubGhz: Fix frequency add manualli scene, refactoring code * SubGhz: 2 profiles for OOK, fix broken build. * SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code * SubGhz: fix assert on worker double stop. Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
138 lines
3.3 KiB
C
138 lines
3.3 KiB
C
#pragma once
|
|
|
|
#include "archive.h"
|
|
#include <stdint.h>
|
|
#include <furi.h>
|
|
#include <gui/gui_i.h>
|
|
#include <gui/view_dispatcher.h>
|
|
#include <gui/modules/text_input.h>
|
|
#include <loader/loader.h>
|
|
|
|
#include <m-string.h>
|
|
#include <m-array.h>
|
|
#include <storage/storage.h>
|
|
#include "archive_views.h"
|
|
#include "applications.h"
|
|
#include "file-worker.h"
|
|
|
|
#define MAX_DEPTH 32
|
|
#define MAX_FILES 100 //temp
|
|
#define MAX_FILE_SIZE 128
|
|
#define ARCHIVE_FAV_PATH "/any/favorites.txt"
|
|
#define ARCHIVE_FAV_TEMP_PATH "/any/favorites.tmp"
|
|
|
|
typedef enum {
|
|
ArchiveViewMain,
|
|
ArchiveViewTextInput,
|
|
ArchiveViewTotal,
|
|
} ArchiveViewEnum;
|
|
|
|
static const char* flipper_app_name[] = {
|
|
[ArchiveFileTypeIButton] = "iButton",
|
|
[ArchiveFileTypeNFC] = "NFC",
|
|
[ArchiveFileTypeSubGhz] = "Sub-GHz",
|
|
[ArchiveFileTypeLFRFID] = "125 kHz RFID",
|
|
[ArchiveFileTypeIrda] = "Infrared",
|
|
};
|
|
|
|
static const char* known_ext[] = {
|
|
[ArchiveFileTypeIButton] = ".ibtn",
|
|
[ArchiveFileTypeNFC] = ".nfc",
|
|
[ArchiveFileTypeSubGhz] = ".sub",
|
|
[ArchiveFileTypeLFRFID] = ".rfid",
|
|
[ArchiveFileTypeIrda] = ".ir",
|
|
};
|
|
|
|
static const char* tab_default_paths[] = {
|
|
[ArchiveTabFavorites] = "/any/favorites",
|
|
[ArchiveTabIButton] = "/any/ibutton",
|
|
[ArchiveTabNFC] = "/any/nfc",
|
|
[ArchiveTabSubGhz] = "/any/subghz/saved",
|
|
[ArchiveTabLFRFID] = "/any/lfrfid",
|
|
[ArchiveTabIrda] = "/any/irda",
|
|
[ArchiveTabBrowser] = "/any",
|
|
};
|
|
|
|
static inline const char* get_tab_ext(ArchiveTabEnum tab) {
|
|
switch(tab) {
|
|
case ArchiveTabIButton:
|
|
return known_ext[ArchiveFileTypeIButton];
|
|
case ArchiveTabNFC:
|
|
return known_ext[ArchiveFileTypeNFC];
|
|
case ArchiveTabSubGhz:
|
|
return known_ext[ArchiveFileTypeSubGhz];
|
|
case ArchiveTabLFRFID:
|
|
return known_ext[ArchiveFileTypeLFRFID];
|
|
case ArchiveTabIrda:
|
|
return known_ext[ArchiveFileTypeIrda];
|
|
default:
|
|
return "*";
|
|
}
|
|
}
|
|
|
|
static inline const char* get_default_path(ArchiveFileTypeEnum type) {
|
|
switch(type) {
|
|
case ArchiveFileTypeIButton:
|
|
return tab_default_paths[ArchiveTabIButton];
|
|
case ArchiveFileTypeNFC:
|
|
return tab_default_paths[ArchiveTabNFC];
|
|
case ArchiveFileTypeSubGhz:
|
|
return tab_default_paths[ArchiveTabSubGhz];
|
|
case ArchiveFileTypeLFRFID:
|
|
return tab_default_paths[ArchiveTabLFRFID];
|
|
case ArchiveFileTypeIrda:
|
|
return tab_default_paths[ArchiveTabIrda];
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static inline const char* get_favorites_path() {
|
|
return tab_default_paths[ArchiveTabFavorites];
|
|
}
|
|
|
|
typedef enum {
|
|
EventTypeTick,
|
|
EventTypeKey,
|
|
EventTypeExit,
|
|
} EventType;
|
|
|
|
typedef struct {
|
|
union {
|
|
InputEvent input;
|
|
} value;
|
|
EventType type;
|
|
} AppEvent;
|
|
|
|
typedef enum {
|
|
FavoritesCheck,
|
|
FavoritesRead,
|
|
FavoritesDelete,
|
|
FavoritesRename,
|
|
} FavActionsEnum;
|
|
|
|
typedef struct {
|
|
ArchiveTabEnum tab_id;
|
|
string_t name;
|
|
string_t path;
|
|
char text_input_buffer[MAX_NAME_LEN];
|
|
|
|
uint8_t depth;
|
|
uint16_t last_idx[MAX_DEPTH];
|
|
|
|
bool menu;
|
|
} ArchiveBrowser;
|
|
|
|
struct ArchiveApp {
|
|
osMessageQueueId_t event_queue;
|
|
FuriThread* app_thread;
|
|
Loader* loader;
|
|
Gui* gui;
|
|
ViewDispatcher* view_dispatcher;
|
|
View* view_archive_main;
|
|
TextInput* text_input;
|
|
|
|
Storage* api;
|
|
FileWorker* file_worker;
|
|
ArchiveBrowser browser;
|
|
};
|