2022-05-06 16:48:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ibutton.h"
|
|
|
|
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <gui/view.h>
|
|
|
|
#include <gui/scene_manager.h>
|
2023-03-02 13:23:33 +00:00
|
|
|
#include <gui/view_dispatcher.h>
|
2022-05-06 16:48:39 +00:00
|
|
|
|
2023-03-20 16:23:17 +00:00
|
|
|
#include <ibutton/ibutton_worker.h>
|
|
|
|
#include <ibutton/ibutton_protocols.h>
|
2023-03-02 13:23:33 +00:00
|
|
|
|
|
|
|
#include <rpc/rpc_app.h>
|
2022-05-06 16:48:39 +00:00
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <dialogs/dialogs.h>
|
2023-03-02 13:23:33 +00:00
|
|
|
#include <notification/notification.h>
|
|
|
|
#include <notification/notification_messages.h>
|
2022-05-06 16:48:39 +00:00
|
|
|
|
|
|
|
#include <gui/modules/submenu.h>
|
|
|
|
#include <gui/modules/popup.h>
|
|
|
|
#include <gui/modules/text_input.h>
|
|
|
|
#include <gui/modules/byte_input.h>
|
|
|
|
#include <gui/modules/widget.h>
|
2023-03-02 13:23:33 +00:00
|
|
|
#include <gui/modules/loading.h>
|
|
|
|
|
|
|
|
#include <assets_icons.h>
|
2022-05-06 16:48:39 +00:00
|
|
|
|
|
|
|
#include "ibutton_custom_event.h"
|
|
|
|
#include "scenes/ibutton_scene.h"
|
|
|
|
|
2024-08-04 09:54:02 +00:00
|
|
|
#define IBUTTON_APP_FOLDER EXT_PATH("ibutton")
|
2024-07-15 04:38:49 +00:00
|
|
|
#define IBUTTON_APP_FILENAME_PREFIX "iBtn"
|
2023-09-01 05:57:49 +00:00
|
|
|
#define IBUTTON_APP_FILENAME_EXTENSION ".ibtn"
|
2023-03-02 13:23:33 +00:00
|
|
|
|
2024-09-07 16:16:56 +00:00
|
|
|
#define IBUTTON_KEY_NAME_SIZE 23
|
2023-03-02 13:23:33 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
iButtonWriteModeInvalid,
|
2024-07-31 16:59:41 +00:00
|
|
|
iButtonWriteModeId,
|
2023-03-02 13:23:33 +00:00
|
|
|
iButtonWriteModeCopy,
|
|
|
|
} iButtonWriteMode;
|
2022-05-06 16:48:39 +00:00
|
|
|
|
|
|
|
struct iButton {
|
|
|
|
SceneManager* scene_manager;
|
|
|
|
ViewDispatcher* view_dispatcher;
|
|
|
|
|
|
|
|
Gui* gui;
|
|
|
|
Storage* storage;
|
|
|
|
DialogsApp* dialogs;
|
|
|
|
NotificationApp* notifications;
|
2023-03-02 13:23:33 +00:00
|
|
|
RpcAppSystem* rpc;
|
2022-05-06 16:48:39 +00:00
|
|
|
|
|
|
|
iButtonKey* key;
|
2023-03-02 13:23:33 +00:00
|
|
|
iButtonWorker* worker;
|
|
|
|
iButtonProtocols* protocols;
|
|
|
|
iButtonWriteMode write_mode;
|
2022-05-06 16:48:39 +00:00
|
|
|
|
2022-10-05 15:15:23 +00:00
|
|
|
FuriString* file_path;
|
2024-09-07 16:16:56 +00:00
|
|
|
char key_name[IBUTTON_KEY_NAME_SIZE];
|
2022-05-06 16:48:39 +00:00
|
|
|
|
|
|
|
Submenu* submenu;
|
|
|
|
ByteInput* byte_input;
|
|
|
|
TextInput* text_input;
|
|
|
|
Popup* popup;
|
|
|
|
Widget* widget;
|
2023-03-02 13:23:33 +00:00
|
|
|
Loading* loading;
|
2022-05-06 16:48:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
iButtonViewSubmenu,
|
|
|
|
iButtonViewByteInput,
|
|
|
|
iButtonViewTextInput,
|
|
|
|
iButtonViewPopup,
|
|
|
|
iButtonViewWidget,
|
2023-03-02 13:23:33 +00:00
|
|
|
iButtonViewLoading,
|
2022-05-06 16:48:39 +00:00
|
|
|
} iButtonView;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
iButtonNotificationMessageError,
|
|
|
|
iButtonNotificationMessageSuccess,
|
2022-06-13 01:08:28 +00:00
|
|
|
iButtonNotificationMessageReadStart,
|
|
|
|
iButtonNotificationMessageEmulateStart,
|
2022-05-06 16:48:39 +00:00
|
|
|
iButtonNotificationMessageYellowBlink,
|
2022-06-13 01:08:28 +00:00
|
|
|
iButtonNotificationMessageEmulateBlink,
|
2022-05-06 16:48:39 +00:00
|
|
|
iButtonNotificationMessageRedOn,
|
|
|
|
iButtonNotificationMessageRedOff,
|
|
|
|
iButtonNotificationMessageGreenOn,
|
|
|
|
iButtonNotificationMessageGreenOff,
|
2022-06-13 01:08:28 +00:00
|
|
|
iButtonNotificationMessageBlinkStop,
|
2022-05-06 16:48:39 +00:00
|
|
|
} iButtonNotificationMessage;
|
|
|
|
|
2023-03-02 13:23:33 +00:00
|
|
|
bool ibutton_select_and_load_key(iButton* ibutton);
|
2023-11-15 08:45:41 +00:00
|
|
|
bool ibutton_load_key(iButton* ibutton, bool show_error);
|
2023-03-02 13:23:33 +00:00
|
|
|
bool ibutton_save_key(iButton* ibutton);
|
2022-05-06 16:48:39 +00:00
|
|
|
bool ibutton_delete_key(iButton* ibutton);
|
2023-03-02 13:23:33 +00:00
|
|
|
void ibutton_reset_key(iButton* ibutton);
|
2022-05-06 16:48:39 +00:00
|
|
|
void ibutton_notification_message(iButton* ibutton, uint32_t message);
|
2023-03-02 13:23:33 +00:00
|
|
|
|
|
|
|
void ibutton_submenu_callback(void* context, uint32_t index);
|
|
|
|
void ibutton_widget_callback(GuiButtonType result, InputType type, void* context);
|