mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-23 03:03:10 +00:00
1cfa857f98
* SubGhz: scene based application * SubGhz: encoder/decoder separation, DMA streaming, update app and cli. * SubGhz: 2 stage async tx complete, minor cleanup * SubGhz: 2 stage async tx complete, FIX state pin end transmit * SubGhz: Pricenton, receive TE signal * SubGhz: Pricenton, add save data, add load data * SubGhz: Add Read scene, Fix pricenton save, load funtion * SubGhz: Add Read, Receiver, SaveName scene * SubGhz: Read and Save (pricenton) * SubGhz: add Load scence * SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton * SubGhz: Fix pricenton encoder, fix transmitter send * SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring * SubGhz: Fix pricenton encoder defalut TE * Archive: Fix path and name SubGhz * Archive: Fix name app SubGhz * GubGhz: Came: add Save, Load key * GubGhz: GateTX: add Save, Load key * GubGhz: NeroSketch: add Save, Load key * Github: better linters triggers * SubGhz: adding fast loading keys Archive -> Run in app * GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button * SubGhz: format sources and fix compilation * FuriHal: add subghz configuration description for AGC section * SubGhz: save only protocols that can be saved. Cleanup. * Github: lint on pull requests Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
127 lines
3 KiB
C
127 lines
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"
|
|
|
|
#define MAX_DEPTH 32
|
|
#define MAX_FILES 100 //temp
|
|
#define MAX_FILE_SIZE 128
|
|
|
|
typedef enum {
|
|
ArchiveViewMain,
|
|
ArchiveViewTextInput,
|
|
ArchiveViewTotal,
|
|
} ArchiveViewEnum;
|
|
|
|
static const char* flipper_app_name[] = {
|
|
[ArchiveFileTypeIButton] = "iButton",
|
|
[ArchiveFileTypeNFC] = "NFC",
|
|
[ArchiveFileTypeSubOne] = "Sub-1 GHz",
|
|
[ArchiveFileTypeLFRFID] = "125 kHz RFID",
|
|
[ArchiveFileTypeIrda] = "Infrared",
|
|
};
|
|
|
|
static const char* known_ext[] = {
|
|
[ArchiveFileTypeIButton] = ".ibtn",
|
|
[ArchiveFileTypeNFC] = ".nfc",
|
|
[ArchiveFileTypeSubOne] = ".sub",
|
|
[ArchiveFileTypeLFRFID] = ".rfid",
|
|
[ArchiveFileTypeIrda] = ".ir",
|
|
};
|
|
|
|
static const char* tab_default_paths[] = {
|
|
[ArchiveTabFavorites] = "/any/favorites",
|
|
[ArchiveTabIButton] = "/any/ibutton",
|
|
[ArchiveTabNFC] = "/any/nfc",
|
|
[ArchiveTabSubOne] = "/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 ArchiveTabSubOne:
|
|
return known_ext[ArchiveFileTypeSubOne];
|
|
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 ArchiveFileTypeSubOne:
|
|
return tab_default_paths[ArchiveTabSubOne];
|
|
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 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;
|
|
ArchiveBrowser browser;
|
|
};
|