2022-07-05 15:28:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "picopass.h"
|
|
|
|
#include "picopass_worker.h"
|
|
|
|
#include "picopass_device.h"
|
|
|
|
|
2022-09-14 16:11:38 +00:00
|
|
|
#include "rfal_picopass.h"
|
2022-07-05 15:28:27 +00:00
|
|
|
|
|
|
|
#include <furi.h>
|
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <gui/view_dispatcher.h>
|
|
|
|
#include <gui/scene_manager.h>
|
|
|
|
#include <notification/notification_messages.h>
|
|
|
|
|
|
|
|
#include <gui/modules/submenu.h>
|
|
|
|
#include <gui/modules/popup.h>
|
2022-08-23 13:19:17 +00:00
|
|
|
#include <gui/modules/loading.h>
|
2022-07-10 12:46:46 +00:00
|
|
|
#include <gui/modules/text_input.h>
|
2022-07-05 15:28:27 +00:00
|
|
|
#include <gui/modules/widget.h>
|
|
|
|
|
|
|
|
#include <input/input.h>
|
|
|
|
|
2022-09-14 16:11:38 +00:00
|
|
|
#include "scenes/picopass_scene.h"
|
2023-03-28 08:21:14 +00:00
|
|
|
#include "views/dict_attack.h"
|
2022-07-05 15:28:27 +00:00
|
|
|
|
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <lib/toolbox/path.h>
|
2022-10-28 14:08:50 +00:00
|
|
|
#include <picopass_icons.h>
|
2022-07-05 15:28:27 +00:00
|
|
|
|
2022-07-10 12:46:46 +00:00
|
|
|
#define PICOPASS_TEXT_STORE_SIZE 128
|
|
|
|
|
2022-07-05 15:28:27 +00:00
|
|
|
enum PicopassCustomEvent {
|
|
|
|
// Reserve first 100 events for button types and indexes, starting from 0
|
|
|
|
PicopassCustomEventReserved = 100,
|
|
|
|
|
|
|
|
PicopassCustomEventViewExit,
|
|
|
|
PicopassCustomEventWorkerExit,
|
|
|
|
PicopassCustomEventByteInputDone,
|
|
|
|
PicopassCustomEventTextInputDone,
|
2023-03-28 08:21:14 +00:00
|
|
|
PicopassCustomEventDictAttackSkip,
|
2022-07-05 15:28:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
EventTypeTick,
|
|
|
|
EventTypeKey,
|
|
|
|
} EventType;
|
|
|
|
|
|
|
|
struct Picopass {
|
|
|
|
PicopassWorker* worker;
|
|
|
|
ViewDispatcher* view_dispatcher;
|
|
|
|
Gui* gui;
|
|
|
|
NotificationApp* notifications;
|
|
|
|
SceneManager* scene_manager;
|
|
|
|
PicopassDevice* dev;
|
|
|
|
|
2022-07-10 12:46:46 +00:00
|
|
|
char text_store[PICOPASS_TEXT_STORE_SIZE + 1];
|
2022-10-05 15:15:23 +00:00
|
|
|
FuriString* text_box_store;
|
2022-07-10 12:46:46 +00:00
|
|
|
|
2022-07-05 15:28:27 +00:00
|
|
|
// Common Views
|
|
|
|
Submenu* submenu;
|
|
|
|
Popup* popup;
|
2022-08-23 13:19:17 +00:00
|
|
|
Loading* loading;
|
2022-07-10 12:46:46 +00:00
|
|
|
TextInput* text_input;
|
2022-07-05 15:28:27 +00:00
|
|
|
Widget* widget;
|
2023-03-28 08:21:14 +00:00
|
|
|
DictAttack* dict_attack;
|
2022-07-05 15:28:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PicopassViewMenu,
|
|
|
|
PicopassViewPopup,
|
2022-08-23 13:19:17 +00:00
|
|
|
PicopassViewLoading,
|
2022-07-10 12:46:46 +00:00
|
|
|
PicopassViewTextInput,
|
2022-07-05 15:28:27 +00:00
|
|
|
PicopassViewWidget,
|
2023-03-28 08:21:14 +00:00
|
|
|
PicopassViewDictAttack,
|
2022-07-05 15:28:27 +00:00
|
|
|
} PicopassView;
|
|
|
|
|
|
|
|
Picopass* picopass_alloc();
|
|
|
|
|
2022-07-10 12:46:46 +00:00
|
|
|
void picopass_text_store_set(Picopass* picopass, const char* text, ...);
|
|
|
|
|
|
|
|
void picopass_text_store_clear(Picopass* picopass);
|
|
|
|
|
2022-07-05 15:28:27 +00:00
|
|
|
void picopass_blink_start(Picopass* picopass);
|
|
|
|
|
|
|
|
void picopass_blink_stop(Picopass* picopass);
|
2022-08-23 13:19:17 +00:00
|
|
|
|
|
|
|
void picopass_show_loading_popup(void* context, bool show);
|
2023-02-26 07:59:50 +00:00
|
|
|
|
|
|
|
/** Check if memory is set to pattern
|
|
|
|
*
|
|
|
|
* @warning zero size will return false
|
|
|
|
*
|
|
|
|
* @param[in] data Pointer to the byte array
|
|
|
|
* @param[in] pattern The pattern
|
|
|
|
* @param[in] size The byte array size
|
|
|
|
*
|
|
|
|
* @return True if memory is set to pattern, false otherwise
|
|
|
|
*/
|
|
|
|
bool picopass_is_memset(const uint8_t* data, const uint8_t pattern, size_t size);
|