formatting

This commit is contained in:
MX 2024-07-15 20:02:45 +03:00
parent deeb9dcb15
commit 726cb770d0
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
488 changed files with 3301 additions and 3288 deletions

View File

@ -17,7 +17,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}
static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
@ -85,7 +85,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}
static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);

View File

@ -23,7 +23,7 @@ static void lfrfid_cli_print_usage(void) {
"rfid raw_emulate <filename> - emulate raw data (not very useful, but helps debug protocols)\r\n");
printf(
"rfid raw_analyze <filename> - outputs raw data to the cli and tries to decode it (useful for protocol development)\r\n");
};
}
typedef struct {
ProtocolId protocol;

@ -1 +1 @@
Subproject commit 73ca3f2ac02e313004aa3a724f2f8a0e4646ad10
Subproject commit 6ba386c09e5650f3ea814faee021829f3332ee35

View File

@ -15,7 +15,7 @@ void crypto_cli_print_usage(void) {
printf("\thas_key <key_slot:int>\t - Check if secure enclave has key in slot\r\n");
printf(
"\tstore_key <key_slot:int> <key_type:str> <key_size:int> <key_data:hex>\t - Store key in secure enclave. !!! NON-REVERSIBLE OPERATION - READ MANUAL FIRST !!!\r\n");
};
}
void crypto_cli_encrypt(Cli* cli, FuriString* args) {
int key_slot = 0;

View File

@ -126,7 +126,7 @@ static void loader_menu_build_menu(LoaderMenuApp* app, LoaderMenu* menu) {
menu_add_item(
app->primary_menu, "Settings", &A_Settings_14, i++, loader_menu_switch_to_settings, app);
};
}
static void loader_menu_build_submenu(LoaderMenuApp* app, LoaderMenu* loader_menu) {
for(size_t i = 0; i < FLIPPER_SETTINGS_APPS_COUNT; i++) {

View File

@ -39,7 +39,7 @@ void notification_message_save_settings(NotificationApp* app) {
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}
// internal layer
static void
@ -471,7 +471,7 @@ static bool notification_load_settings(NotificationApp* app) {
furi_record_close(RECORD_STORAGE);
return fs_result;
};
}
static bool notification_save_settings(NotificationApp* app) {
NotificationSettings settings;
@ -506,7 +506,7 @@ static bool notification_save_settings(NotificationApp* app) {
furi_record_close(RECORD_STORAGE);
return fs_result;
};
}
static void input_event_callback(const void* value, void* context) {
furi_assert(value);
@ -555,7 +555,7 @@ static NotificationApp* notification_app_alloc(void) {
notification_message(app, &sequence_display_backlight_on);
return app;
};
}
// App
int32_t notification_srv(void* p) {
@ -598,4 +598,4 @@ int32_t notification_srv(void* p) {
}
return 0;
};
}

View File

@ -10,7 +10,7 @@ void notification_message(NotificationApp* app, const NotificationSequence* sequ
NotificationAppMessage m = {
.type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL};
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
};
}
void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) {
furi_check(app);
@ -19,7 +19,7 @@ void notification_internal_message(NotificationApp* app, const NotificationSeque
NotificationAppMessage m = {
.type = InternalLayerMessage, .sequence = sequence, .back_event = NULL};
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
};
}
void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) {
furi_check(app);
@ -33,7 +33,7 @@ void notification_message_block(NotificationApp* app, const NotificationSequence
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}
void notification_internal_message_block(
NotificationApp* app,
@ -47,4 +47,4 @@ void notification_internal_message_block(
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}

View File

@ -66,7 +66,7 @@ static void storage_cli_info(Cli* cli, FuriString* path, FuriString* args) {
}
furi_record_close(RECORD_STORAGE);
};
}
static void storage_cli_format(Cli* cli, FuriString* path, FuriString* args) {
UNUSED(args);
@ -93,7 +93,7 @@ static void storage_cli_format(Cli* cli, FuriString* path, FuriString* args) {
} else {
storage_cli_print_usage();
}
};
}
static void storage_cli_list(Cli* cli, FuriString* path, FuriString* args) {
UNUSED(cli);
@ -630,7 +630,7 @@ static void storage_cli_print_usage(void) {
printf(
"\t%s%s - %s\r\n", cli_cmd, strlen(cli_cmd) > 8 ? "\t" : "\t\t", command_descr->help);
}
};
}
void storage_cli(Cli* cli, FuriString* args, void* context) {
UNUSED(context);

View File

@ -8,7 +8,12 @@
extern "C" {
#endif
typedef enum { ST_EXT = 0, ST_INT = 1, ST_ANY, ST_ERROR } StorageType;
typedef enum {
ST_EXT = 0,
ST_INT = 1,
ST_ANY,
ST_ERROR
} StorageType;
typedef struct StorageData StorageData;

View File

@ -160,7 +160,7 @@ static LFSData* storage_int_lfs_data_alloc(void) {
lfs_data->config.lookahead_size = 16;
return lfs_data;
};
}
// Returns true if fingerprint was invalid and LFS reformatting is needed
static bool storage_int_check_and_set_fingerprint(LFSData* lfs_data) {

View File

@ -31,4 +31,7 @@ typedef enum {
PowerSettingsAppViewDialog,
} PowerSettingsAppView;
typedef enum { RebootTypeDFU, RebootTypeNormal } RebootType;
typedef enum {
RebootTypeDFU,
RebootTypeNormal
} RebootType;

View File

@ -18,7 +18,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}
static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
@ -88,7 +88,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}
static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);

View File

@ -29,20 +29,20 @@ FuriStreamBuffer* furi_stream_buffer_alloc(size_t size, size_t trigger_level) {
furi_check(hStreamBuffer == (StreamBufferHandle_t)stream_buffer);
return stream_buffer;
};
}
void furi_stream_buffer_free(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);
vStreamBufferDelete((StreamBufferHandle_t)stream_buffer);
free(stream_buffer);
};
}
bool furi_stream_set_trigger_level(FuriStreamBuffer* stream_buffer, size_t trigger_level) {
furi_check(stream_buffer);
return xStreamBufferSetTriggerLevel((StreamBufferHandle_t)stream_buffer, trigger_level) ==
pdTRUE;
};
}
size_t furi_stream_buffer_send(
FuriStreamBuffer* stream_buffer,
@ -62,7 +62,7 @@ size_t furi_stream_buffer_send(
}
return ret;
};
}
size_t furi_stream_buffer_receive(
FuriStreamBuffer* stream_buffer,
@ -89,25 +89,25 @@ size_t furi_stream_buffer_bytes_available(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);
return xStreamBufferBytesAvailable((StreamBufferHandle_t)stream_buffer);
};
}
size_t furi_stream_buffer_spaces_available(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);
return xStreamBufferSpacesAvailable((StreamBufferHandle_t)stream_buffer);
};
}
bool furi_stream_buffer_is_full(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);
return xStreamBufferIsFull((StreamBufferHandle_t)stream_buffer) == pdTRUE;
};
}
bool furi_stream_buffer_is_empty(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);
return (xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE);
};
}
FuriStatus furi_stream_buffer_reset(FuriStreamBuffer* stream_buffer) {
furi_check(stream_buffer);

View File

@ -17,7 +17,7 @@ public:
RecordController(const char* record_name) {
name = record_name;
value = static_cast<TRecordClass*>(furi_record_open(name));
};
}
~RecordController() {
furi_record_close(name);

View File

@ -50,7 +50,8 @@ struct type_index {
* Creates a type_index object for the specified type.
*/
template <typename T>
type_index(tag_type<T>) noexcept : hash_code_{index<T>} {
type_index(tag_type<T>) noexcept
: hash_code_{index<T>} {
}
/**

View File

@ -27,7 +27,7 @@ public:
0)...);
gui = static_cast<Gui*>(furi_record_open("gui"));
};
}
~ViewController() {
for(auto& it : holder) {

View File

@ -122,7 +122,11 @@ bool flipper_format_stream_seek_to_key(Stream* stream, const char* key, bool str
}
static bool flipper_format_stream_read_value(Stream* stream, FuriString* value, bool* last) {
enum { LeadingSpace, ReadValue, TrailingSpace } state = LeadingSpace;
enum {
LeadingSpace,
ReadValue,
TrailingSpace
} state = LeadingSpace;
const size_t buffer_size = 32;
uint8_t buffer[buffer_size];
bool result = false;

View File

@ -37,21 +37,21 @@ ProtocolAwid* protocol_awid_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_awid_free(ProtocolAwid* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_awid_get_data(ProtocolAwid* protocol) {
return protocol->data;
};
}
void protocol_awid_decoder_start(ProtocolAwid* protocol) {
memset(protocol->encoded_data, 0, AWID_ENCODED_DATA_SIZE);
};
}
static bool protocol_awid_can_be_decoded(uint8_t* data) {
bool result = false;
@ -112,7 +112,7 @@ bool protocol_awid_decoder_feed(ProtocolAwid* protocol, bool level, uint32_t dur
}
return result;
};
}
static void protocol_awid_encode(const uint8_t* decoded_data, uint8_t* encoded_data) {
memset(encoded_data, 0, AWID_ENCODED_DATA_SIZE);
@ -125,14 +125,14 @@ static void protocol_awid_encode(const uint8_t* decoded_data, uint8_t* encoded_d
value |= bit_lib_test_parity_32(value, BitLibParityOdd);
bit_lib_set_bits(encoded_data, 8 + i * 4, value, 4);
}
};
}
bool protocol_awid_encoder_start(ProtocolAwid* protocol) {
protocol_awid_encode(protocol->data, (uint8_t*)protocol->encoded_data);
protocol->encoder.encoded_index = 0;
fsk_osc_reset(protocol->encoder.fsk_osc);
return true;
};
}
LevelDuration protocol_awid_encoder_yield(ProtocolAwid* protocol) {
bool level;
@ -145,7 +145,7 @@ LevelDuration protocol_awid_encoder_yield(ProtocolAwid* protocol) {
bit_lib_increment_index(protocol->encoder.encoded_index, AWID_ENCODED_BIT_SIZE);
}
return level_duration_make(level, duration);
};
}
void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) {
// Index map
@ -186,7 +186,7 @@ void protocol_awid_render_data(ProtocolAwid* protocol, FuriString* result) {
furi_string_cat_printf(result, "%02hhX", decoded_data[i]);
}
}
};
}
void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result) {
uint8_t* decoded_data = protocol->data;
@ -210,7 +210,7 @@ void protocol_awid_render_brief_data(ProtocolAwid* protocol, FuriString* result)
} else {
furi_string_cat(result, "\nData: Unknown");
}
};
}
bool protocol_awid_write_data(ProtocolAwid* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -239,7 +239,7 @@ bool protocol_awid_write_data(ProtocolAwid* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_awid = {
.name = "AWID",

View File

@ -116,15 +116,15 @@ typedef struct {
ProtocolElectra* protocol_electra_alloc(void) {
ProtocolElectra* proto = malloc(sizeof(ProtocolElectra));
return (void*)proto;
};
}
void protocol_electra_free(ProtocolElectra* proto) {
free(proto);
};
}
uint8_t* protocol_electra_get_data(ProtocolElectra* proto) {
return proto->data;
};
}
static void electra_decode(
const uint8_t* encoded_base_data,
@ -242,7 +242,7 @@ void protocol_electra_decoder_start(ProtocolElectra* proto) {
ManchesterEventReset,
&proto->decoder_manchester_state,
NULL);
};
}
bool protocol_electra_decoder_feed(ProtocolElectra* proto, bool level, uint32_t duration) {
bool result = false;
@ -299,7 +299,7 @@ bool protocol_electra_decoder_feed(ProtocolElectra* proto, bool level, uint32_t
}
return result;
};
}
static void em_write_nibble(bool low_nibble, uint8_t data, ElectraDecodedData* encoded_base_data) {
uint8_t parity_sum = 0;
@ -354,7 +354,7 @@ bool protocol_electra_encoder_start(ProtocolElectra* proto) {
}
return true;
};
}
LevelDuration protocol_electra_encoder_yield(ProtocolElectra* proto) {
bool level;
@ -378,7 +378,7 @@ LevelDuration protocol_electra_encoder_yield(ProtocolElectra* proto) {
}
return level_duration_make(level, duration);
};
}
bool protocol_electra_write_data(ProtocolElectra* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -408,12 +408,12 @@ bool protocol_electra_write_data(ProtocolElectra* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_electra_render_data(ProtocolElectra* protocol, FuriString* result) {
protocol_electra_encoder_start(protocol);
furi_string_printf(result, "Epilogue: %016llX", protocol->encoded_epilogue);
};
}
const ProtocolBase protocol_electra = {
.name = "Electra",

View File

@ -93,27 +93,27 @@ ProtocolEM4100* protocol_em4100_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 64;
return (void*)proto;
};
}
ProtocolEM4100* protocol_em4100_16_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 16;
return (void*)proto;
};
}
ProtocolEM4100* protocol_em4100_32_alloc(void) {
ProtocolEM4100* proto = malloc(sizeof(ProtocolEM4100));
proto->clock_per_bit = 32;
return (void*)proto;
};
}
void protocol_em4100_free(ProtocolEM4100* proto) {
free(proto);
};
}
uint8_t* protocol_em4100_get_data(ProtocolEM4100* proto) {
return proto->data;
};
}
static void em4100_decode(
const uint8_t* encoded_data,
@ -202,7 +202,7 @@ void protocol_em4100_decoder_start(ProtocolEM4100* proto) {
ManchesterEventReset,
&proto->decoder_manchester_state,
NULL);
};
}
bool protocol_em4100_decoder_feed(ProtocolEM4100* proto, bool level, uint32_t duration) {
bool result = false;
@ -252,7 +252,7 @@ bool protocol_em4100_decoder_feed(ProtocolEM4100* proto, bool level, uint32_t du
}
return result;
};
}
static void em4100_write_nibble(bool low_nibble, uint8_t data, EM4100DecodedData* encoded_data) {
uint8_t parity_sum = 0;
@ -296,7 +296,7 @@ bool protocol_em4100_encoder_start(ProtocolEM4100* proto) {
proto->encoded_polarity = true;
return true;
};
}
LevelDuration protocol_em4100_encoder_yield(ProtocolEM4100* proto) {
bool level = (proto->encoded_data >> (63 - proto->encoded_data_index)) & 1;
@ -315,7 +315,7 @@ LevelDuration protocol_em4100_encoder_yield(ProtocolEM4100* proto) {
}
return level_duration_make(level, duration);
};
}
bool protocol_em4100_write_data(ProtocolEM4100* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -341,7 +341,7 @@ bool protocol_em4100_write_data(ProtocolEM4100* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) {
uint8_t* data = protocol->data;
@ -353,7 +353,7 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) {
(uint16_t)((data[3] << 8) | (data[4])),
protocol->clock_per_bit,
(uint32_t)((data[2] << 16) | (data[3] << 8) | (data[4])));
};
}
const ProtocolBase protocol_em4100 = {
.name = "EM4100",

View File

@ -44,21 +44,21 @@ ProtocolFDXA* protocol_fdx_a_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_fdx_a_free(ProtocolFDXA* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_fdx_a_get_data(ProtocolFDXA* protocol) {
return protocol->data;
};
}
void protocol_fdx_a_decoder_start(ProtocolFDXA* protocol) {
memset(protocol->encoded_data, 0, FDXA_ENCODED_DATA_SIZE);
};
}
static bool protocol_fdx_a_decode(const uint8_t* from, uint8_t* to) {
size_t bit_index = 0;
@ -124,7 +124,7 @@ bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t du
}
return result;
};
}
static void protocol_fdx_a_encode(ProtocolFDXA* protocol) {
protocol->encoded_data[0] = FDXA_PREAMBLE_0;
@ -150,7 +150,7 @@ bool protocol_fdx_a_encoder_start(ProtocolFDXA* protocol) {
protocol_fdx_a_encode(protocol);
return true;
};
}
LevelDuration protocol_fdx_a_encoder_yield(ProtocolFDXA* protocol) {
bool level = 0;
@ -180,7 +180,7 @@ LevelDuration protocol_fdx_a_encoder_yield(ProtocolFDXA* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_fdx_a_write_data(ProtocolFDXA* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -203,7 +203,7 @@ bool protocol_fdx_a_write_data(ProtocolFDXA* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) {
uint8_t data[FDXA_DECODED_DATA_SIZE];
@ -221,7 +221,7 @@ void protocol_fdx_a_render_data(ProtocolFDXA* protocol, FuriString* result) {
"Parity: %c",
bit_lib_get_bits_64(data, 0, 40),
parity_sum == 0 ? '+' : '-');
};
}
const ProtocolBase protocol_fdx_a = {
.name = "FDX-A",

View File

@ -34,20 +34,20 @@ typedef struct {
ProtocolFDXB* protocol_fdx_b_alloc(void) {
ProtocolFDXB* protocol = malloc(sizeof(ProtocolFDXB));
return protocol;
};
}
void protocol_fdx_b_free(ProtocolFDXB* protocol) {
free(protocol);
};
}
uint8_t* protocol_fdx_b_get_data(ProtocolFDXB* proto) {
return proto->data;
};
}
void protocol_fdx_b_decoder_start(ProtocolFDXB* protocol) {
memset(protocol->encoded_data, 0, FDX_B_ENCODED_BYTE_FULL_SIZE);
protocol->last_short = false;
};
}
static bool protocol_fdx_b_can_be_decoded(ProtocolFDXB* protocol) {
bool result = false;
@ -179,7 +179,7 @@ bool protocol_fdx_b_decoder_feed(ProtocolFDXB* protocol, bool level, uint32_t du
}
return result;
};
}
bool protocol_fdx_b_encoder_start(ProtocolFDXB* protocol) {
memset(protocol->encoded_data, 0, FDX_B_ENCODED_BYTE_FULL_SIZE);
@ -203,7 +203,7 @@ bool protocol_fdx_b_encoder_start(ProtocolFDXB* protocol) {
protocol->last_short = false;
protocol->last_level = false;
return true;
};
}
LevelDuration protocol_fdx_b_encoder_yield(ProtocolFDXB* protocol) {
uint32_t duration;
@ -228,7 +228,7 @@ LevelDuration protocol_fdx_b_encoder_yield(ProtocolFDXB* protocol) {
}
return level_duration_make(protocol->last_level, duration);
};
}
// 0 nnnnnnnn
// 8 nnnnnnnn 38 bit (12 digit) National code.
@ -320,7 +320,7 @@ void protocol_fdx_b_render_data(ProtocolFDXB* protocol, FuriString* result) {
reserved,
user_info,
replacement_number);
};
}
void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result) {
// 38 bits of national code
@ -348,7 +348,7 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result
} else {
furi_string_cat(result, "---");
}
};
}
bool protocol_fdx_b_write_data(ProtocolFDXB* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -371,7 +371,7 @@ bool protocol_fdx_b_write_data(ProtocolFDXB* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_fdx_b = {
.name = "FDX-B",

View File

@ -36,15 +36,15 @@ typedef struct {
ProtocolGallagher* protocol_gallagher_alloc(void) {
ProtocolGallagher* proto = malloc(sizeof(ProtocolGallagher));
return (void*)proto;
};
}
void protocol_gallagher_free(ProtocolGallagher* protocol) {
free(protocol);
};
}
uint8_t* protocol_gallagher_get_data(ProtocolGallagher* protocol) {
return protocol->data;
};
}
static void protocol_gallagher_scramble(uint8_t* data, size_t length) {
const uint8_t lut[] = {
@ -152,7 +152,7 @@ void protocol_gallagher_decoder_start(ProtocolGallagher* protocol) {
ManchesterEventReset,
&protocol->decoder_manchester_state,
NULL);
};
}
bool protocol_gallagher_decoder_feed(ProtocolGallagher* protocol, bool level, uint32_t duration) {
bool result = false;
@ -189,7 +189,7 @@ bool protocol_gallagher_decoder_feed(ProtocolGallagher* protocol, bool level, ui
}
return result;
};
}
bool protocol_gallagher_encoder_start(ProtocolGallagher* protocol) {
// Preamble
@ -227,7 +227,7 @@ bool protocol_gallagher_encoder_start(ProtocolGallagher* protocol) {
bit_lib_set_bits(protocol->encoded_data, 16 + (9 * 8), crc, 8);
return true;
};
}
LevelDuration protocol_gallagher_encoder_yield(ProtocolGallagher* protocol) {
bool level = bit_lib_get_bit(protocol->encoded_data, protocol->encoded_data_index);
@ -243,7 +243,7 @@ LevelDuration protocol_gallagher_encoder_yield(ProtocolGallagher* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -266,7 +266,7 @@ bool protocol_gallagher_write_data(ProtocolGallagher* protocol, void* data) {
result = true;
}
return result;
};
}
static void protocol_gallagher_render_data_internal(
ProtocolGallagher* protocol,
@ -296,7 +296,7 @@ static void protocol_gallagher_render_data_internal(
region,
issue_level);
}
};
}
void protocol_gallagher_render_data(ProtocolGallagher* protocol, FuriString* result) {
protocol_gallagher_render_data_internal(protocol, result, false);

View File

@ -38,21 +38,21 @@ ProtocolH10301* protocol_h10301_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_h10301_free(ProtocolH10301* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_h10301_get_data(ProtocolH10301* protocol) {
return protocol->data;
};
}
void protocol_h10301_decoder_start(ProtocolH10301* protocol) {
memset(protocol->encoded_data, 0, sizeof(uint32_t) * 3);
};
}
static void protocol_h10301_decoder_store_data(ProtocolH10301* protocol, bool data) {
protocol->encoded_data[0] = (protocol->encoded_data[0] << 1) |
@ -205,7 +205,7 @@ bool protocol_h10301_decoder_feed(ProtocolH10301* protocol, bool level, uint32_t
}
return result;
};
}
static void protocol_h10301_write_raw_bit(bool bit, uint8_t position, uint32_t* card_data) {
if(bit) {
@ -295,7 +295,7 @@ bool protocol_h10301_encoder_start(ProtocolH10301* protocol) {
protocol->encoder.pulse = 0;
return true;
};
}
LevelDuration protocol_h10301_encoder_yield(ProtocolH10301* protocol) {
bool level = 0;
@ -331,7 +331,7 @@ LevelDuration protocol_h10301_encoder_yield(ProtocolH10301* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_h10301_write_data(ProtocolH10301* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -353,7 +353,7 @@ bool protocol_h10301_write_data(ProtocolH10301* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) {
uint8_t* data = protocol->data;
@ -363,7 +363,7 @@ void protocol_h10301_render_data(ProtocolH10301* protocol, FuriString* result) {
"Card: %hu",
data[0],
(uint16_t)((data[1] << 8) | (data[2])));
};
}
const ProtocolBase protocol_h10301 = {
.name = "H10301",

View File

@ -43,21 +43,21 @@ ProtocolHIDEx* protocol_hid_ex_generic_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_hid_ex_generic_free(ProtocolHIDEx* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_hid_ex_generic_get_data(ProtocolHIDEx* protocol) {
return protocol->data;
};
}
void protocol_hid_ex_generic_decoder_start(ProtocolHIDEx* protocol) {
memset(protocol->encoded_data, 0, HID_ENCODED_DATA_SIZE);
};
}
static bool protocol_hid_ex_generic_can_be_decoded(const uint8_t* data) {
// check preamble
@ -110,7 +110,7 @@ bool protocol_hid_ex_generic_decoder_feed(ProtocolHIDEx* protocol, bool level, u
}
return result;
};
}
static void protocol_hid_ex_generic_encode(ProtocolHIDEx* protocol) {
protocol->encoded_data[0] = HID_PREAMBLE;
@ -135,7 +135,7 @@ bool protocol_hid_ex_generic_encoder_start(ProtocolHIDEx* protocol) {
protocol_hid_ex_generic_encode(protocol);
return true;
};
}
LevelDuration protocol_hid_ex_generic_encoder_yield(ProtocolHIDEx* protocol) {
bool level = 0;
@ -165,7 +165,7 @@ LevelDuration protocol_hid_ex_generic_encoder_yield(ProtocolHIDEx* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -190,7 +190,7 @@ bool protocol_hid_ex_generic_write_data(ProtocolHIDEx* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* result) {
UNUSED(protocol);
@ -200,7 +200,7 @@ void protocol_hid_ex_generic_render_data(ProtocolHIDEx* protocol, FuriString* re
result,
"Type: Generic HID Extended\n"
"Data: Unknown");
};
}
const ProtocolBase protocol_hid_ex_generic = {
.name = "HIDExt",

View File

@ -43,21 +43,21 @@ ProtocolHID* protocol_hid_generic_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_hid_generic_free(ProtocolHID* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_hid_generic_get_data(ProtocolHID* protocol) {
return protocol->data;
};
}
void protocol_hid_generic_decoder_start(ProtocolHID* protocol) {
memset(protocol->encoded_data, 0, HID_ENCODED_DATA_SIZE);
};
}
static bool protocol_hid_generic_can_be_decoded(const uint8_t* data) {
// check preamble
@ -142,7 +142,7 @@ bool protocol_hid_generic_decoder_feed(ProtocolHID* protocol, bool level, uint32
}
return result;
};
}
static void protocol_hid_generic_encode(ProtocolHID* protocol) {
protocol->encoded_data[0] = HID_PREAMBLE;
@ -167,7 +167,7 @@ bool protocol_hid_generic_encoder_start(ProtocolHID* protocol) {
protocol_hid_generic_encode(protocol);
return true;
};
}
LevelDuration protocol_hid_generic_encoder_yield(ProtocolHID* protocol) {
bool level = 0;
@ -197,7 +197,7 @@ LevelDuration protocol_hid_generic_encoder_yield(ProtocolHID* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_hid_generic_write_data(ProtocolHID* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -219,7 +219,7 @@ bool protocol_hid_generic_write_data(ProtocolHID* protocol, void* data) {
result = true;
}
return result;
};
}
static void protocol_hid_generic_string_cat_protocol_bits(
ProtocolHID* protocol,
@ -261,7 +261,7 @@ void protocol_hid_generic_render_data(ProtocolHID* protocol, FuriString* result)
protocol_size);
protocol_hid_generic_string_cat_protocol_bits(protocol, protocol_size, result);
}
};
}
const ProtocolBase protocol_hid_generic = {
.name = "HIDProx",

View File

@ -42,22 +42,22 @@ typedef struct {
ProtocolIdteck* protocol_idteck_alloc(void) {
ProtocolIdteck* protocol = malloc(sizeof(ProtocolIdteck));
return protocol;
};
}
void protocol_idteck_free(ProtocolIdteck* protocol) {
free(protocol);
};
}
uint8_t* protocol_idteck_get_data(ProtocolIdteck* protocol) {
return protocol->data;
};
}
void protocol_idteck_decoder_start(ProtocolIdteck* protocol) {
memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
memset(protocol->negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
memset(protocol->corrupted_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
memset(protocol->corrupted_negative_encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
};
}
static bool protocol_idteck_check_preamble(uint8_t* data, size_t bit_index) {
// Preamble 01001001 01000100 01010100 01001011
@ -144,7 +144,7 @@ bool protocol_idteck_decoder_feed(ProtocolIdteck* protocol, bool level, uint32_t
}
return result;
};
}
bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) {
memset(protocol->encoded_data, 0, IDTECK_ENCODED_DATA_SIZE);
@ -159,7 +159,7 @@ bool protocol_idteck_encoder_start(ProtocolIdteck* protocol) {
protocol->encoder.bit_clock_index = 0;
return true;
};
}
LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) {
LevelDuration level_duration;
@ -189,7 +189,7 @@ LevelDuration protocol_idteck_encoder_yield(ProtocolIdteck* protocol) {
}
return level_duration;
};
}
// factory code
static uint32_t get_fc(const uint8_t* data) {
@ -232,7 +232,7 @@ bool protocol_idteck_write_data(ProtocolIdteck* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_idteck = {
.name = "Idteck",

View File

@ -38,22 +38,22 @@ typedef struct {
ProtocolIndala* protocol_indala26_alloc(void) {
ProtocolIndala* protocol = malloc(sizeof(ProtocolIndala));
return protocol;
};
}
void protocol_indala26_free(ProtocolIndala* protocol) {
free(protocol);
};
}
uint8_t* protocol_indala26_get_data(ProtocolIndala* protocol) {
return protocol->data;
};
}
void protocol_indala26_decoder_start(ProtocolIndala* protocol) {
memset(protocol->encoded_data, 0, INDALA26_ENCODED_DATA_SIZE);
memset(protocol->negative_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE);
memset(protocol->corrupted_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE);
memset(protocol->corrupted_negative_encoded_data, 0, INDALA26_ENCODED_DATA_SIZE);
};
}
static bool protocol_indala26_check_preamble(uint8_t* data, size_t bit_index) {
// Preamble 10100000 00000000 00000000 00000000 1
@ -146,7 +146,7 @@ bool protocol_indala26_decoder_feed(ProtocolIndala* protocol, bool level, uint32
}
return result;
};
}
bool protocol_indala26_encoder_start(ProtocolIndala* protocol) {
memset(protocol->encoded_data, 0, INDALA26_ENCODED_DATA_SIZE);
@ -164,7 +164,7 @@ bool protocol_indala26_encoder_start(ProtocolIndala* protocol) {
protocol->encoder.bit_clock_index = 0;
return true;
};
}
LevelDuration protocol_indala26_encoder_yield(ProtocolIndala* protocol) {
LevelDuration level_duration;
@ -194,7 +194,7 @@ LevelDuration protocol_indala26_encoder_yield(ProtocolIndala* protocol) {
}
return level_duration;
};
}
// factory code
static uint8_t get_fc(const uint8_t* data) {
@ -328,7 +328,7 @@ bool protocol_indala26_write_data(ProtocolIndala* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_indala26 = {
.name = "Indala26",

View File

@ -36,21 +36,21 @@ ProtocolIOProxXSF* protocol_io_prox_xsf_alloc(void) {
protocol->decoder.fsk_demod = fsk_demod_alloc(MIN_TIME, 8, MAX_TIME, 6);
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 64);
return protocol;
};
}
void protocol_io_prox_xsf_free(ProtocolIOProxXSF* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_io_prox_xsf_get_data(ProtocolIOProxXSF* protocol) {
return protocol->data;
};
}
void protocol_io_prox_xsf_decoder_start(ProtocolIOProxXSF* protocol) {
memset(protocol->encoded_data, 0, IOPROXXSF_ENCODED_DATA_SIZE);
};
}
static uint8_t protocol_io_prox_xsf_compute_checksum(const uint8_t* data) {
// Packet structure:
@ -172,7 +172,7 @@ bool protocol_io_prox_xsf_decoder_feed(ProtocolIOProxXSF* protocol, bool level,
}
return result;
};
}
static void protocol_io_prox_xsf_encode(const uint8_t* decoded_data, uint8_t* encoded_data) {
// Packet to transmit:
@ -217,7 +217,7 @@ bool protocol_io_prox_xsf_encoder_start(ProtocolIOProxXSF* protocol) {
protocol->encoder.encoded_index = 0;
fsk_osc_reset(protocol->encoder.fsk_osc);
return true;
};
}
LevelDuration protocol_io_prox_xsf_encoder_yield(ProtocolIOProxXSF* protocol) {
bool level;
@ -230,7 +230,7 @@ LevelDuration protocol_io_prox_xsf_encoder_yield(ProtocolIOProxXSF* protocol) {
bit_lib_increment_index(protocol->encoder.encoded_index, IOPROXXSF_BIT_MAX_SIZE);
}
return level_duration_make(level, duration);
};
}
void protocol_io_prox_xsf_render_data(ProtocolIOProxXSF* protocol, FuriString* result) {
uint8_t* data = protocol->data;
@ -274,7 +274,7 @@ bool protocol_io_prox_xsf_write_data(ProtocolIOProxXSF* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_io_prox_xsf = {
.name = "IoProxXSF",

View File

@ -34,20 +34,20 @@ typedef struct {
ProtocolJablotron* protocol_jablotron_alloc(void) {
ProtocolJablotron* protocol = malloc(sizeof(ProtocolJablotron));
return protocol;
};
}
void protocol_jablotron_free(ProtocolJablotron* protocol) {
free(protocol);
};
}
uint8_t* protocol_jablotron_get_data(ProtocolJablotron* proto) {
return proto->data;
};
}
void protocol_jablotron_decoder_start(ProtocolJablotron* protocol) {
memset(protocol->encoded_data, 0, JABLOTRON_ENCODED_BYTE_FULL_SIZE);
protocol->last_short = false;
};
}
uint8_t protocol_jablotron_checksum(uint8_t* bits) {
uint8_t chksum = 0;
@ -115,7 +115,7 @@ bool protocol_jablotron_decoder_feed(ProtocolJablotron* protocol, bool level, ui
}
return false;
};
}
bool protocol_jablotron_encoder_start(ProtocolJablotron* protocol) {
// preamble
@ -133,7 +133,7 @@ bool protocol_jablotron_encoder_start(ProtocolJablotron* protocol) {
protocol->last_short = false;
protocol->last_level = false;
return true;
};
}
LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) {
uint32_t duration;
@ -158,12 +158,12 @@ LevelDuration protocol_jablotron_encoder_yield(ProtocolJablotron* protocol) {
}
return level_duration_make(protocol->last_level, duration);
};
}
void protocol_jablotron_render_data(ProtocolJablotron* protocol, FuriString* result) {
uint64_t id = protocol_jablotron_card_id(protocol->data);
furi_string_printf(result, "Card: %llX", id);
};
}
bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -184,7 +184,7 @@ bool protocol_jablotron_write_data(ProtocolJablotron* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_jablotron = {
.name = "Jablotron",

View File

@ -37,22 +37,22 @@ typedef struct {
ProtocolKeri* protocol_keri_alloc(void) {
ProtocolKeri* protocol = malloc(sizeof(ProtocolKeri));
return protocol;
};
}
void protocol_keri_free(ProtocolKeri* protocol) {
free(protocol);
};
}
uint8_t* protocol_keri_get_data(ProtocolKeri* protocol) {
return protocol->data;
};
}
void protocol_keri_decoder_start(ProtocolKeri* protocol) {
memset(protocol->encoded_data, 0, KERI_ENCODED_DATA_SIZE);
memset(protocol->negative_encoded_data, 0, KERI_ENCODED_DATA_SIZE);
memset(protocol->corrupted_encoded_data, 0, KERI_ENCODED_DATA_SIZE);
memset(protocol->corrupted_negative_encoded_data, 0, KERI_ENCODED_DATA_SIZE);
};
}
static bool protocol_keri_check_preamble(uint8_t* data, size_t bit_index) {
// Preamble 11100000 00000000 00000000 00000000 1
@ -164,7 +164,7 @@ bool protocol_keri_decoder_feed(ProtocolKeri* protocol, bool level, uint32_t dur
}
return result;
};
}
bool protocol_keri_encoder_start(ProtocolKeri* protocol) {
memset(protocol->encoded_data, 0, KERI_ENCODED_DATA_SIZE);
@ -180,7 +180,7 @@ bool protocol_keri_encoder_start(ProtocolKeri* protocol) {
protocol->encoder.bit_clock_index = 0;
return true;
};
}
LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) {
LevelDuration level_duration;
@ -210,7 +210,7 @@ LevelDuration protocol_keri_encoder_yield(ProtocolKeri* protocol) {
}
return level_duration;
};
}
static void
protocol_keri_render_data_internal(ProtocolKeri* protocol, FuriString* result, bool brief) {
@ -267,7 +267,7 @@ bool protocol_keri_write_data(ProtocolKeri* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_keri = {
.name = "Keri",

View File

@ -47,22 +47,22 @@ typedef struct {
ProtocolNexwatch* protocol_nexwatch_alloc(void) {
ProtocolNexwatch* protocol = malloc(sizeof(ProtocolNexwatch));
return protocol;
};
}
void protocol_nexwatch_free(ProtocolNexwatch* protocol) {
free(protocol);
};
}
uint8_t* protocol_nexwatch_get_data(ProtocolNexwatch* protocol) {
return protocol->data;
};
}
void protocol_nexwatch_decoder_start(ProtocolNexwatch* protocol) {
memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE);
memset(protocol->negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE);
memset(protocol->corrupted_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE);
memset(protocol->corrupted_negative_encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE);
};
}
static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) {
// 01010110
@ -215,7 +215,7 @@ bool protocol_nexwatch_decoder_feed(ProtocolNexwatch* protocol, bool level, uint
}
return result;
};
}
bool protocol_nexwatch_encoder_start(ProtocolNexwatch* protocol) {
memset(protocol->encoded_data, 0, NEXWATCH_ENCODED_DATA_SIZE);
@ -231,7 +231,7 @@ bool protocol_nexwatch_encoder_start(ProtocolNexwatch* protocol) {
protocol->encoder.bit_clock_index = 0;
return true;
};
}
LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) {
LevelDuration level_duration;
@ -261,7 +261,7 @@ LevelDuration protocol_nexwatch_encoder_yield(ProtocolNexwatch* protocol) {
}
return level_duration;
};
}
static void protocol_nexwatch_render_data_internal(
ProtocolNexwatch* protocol,
@ -328,7 +328,7 @@ bool protocol_nexwatch_write_data(ProtocolNexwatch* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_nexwatch = {
.name = "Nexwatch",

View File

@ -38,21 +38,21 @@ ProtocolParadox* protocol_paradox_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_paradox_free(ProtocolParadox* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_paradox_get_data(ProtocolParadox* protocol) {
return protocol->data;
};
}
void protocol_paradox_decoder_start(ProtocolParadox* protocol) {
memset(protocol->encoded_data, 0, PARADOX_ENCODED_DATA_SIZE);
};
}
static bool protocol_paradox_can_be_decoded(ProtocolParadox* protocol) {
// check preamble
@ -101,7 +101,7 @@ bool protocol_paradox_decoder_feed(ProtocolParadox* protocol, bool level, uint32
}
return false;
};
}
static void protocol_paradox_encode(const uint8_t* decoded_data, uint8_t* encoded_data) {
// preamble
@ -114,14 +114,14 @@ static void protocol_paradox_encode(const uint8_t* decoded_data, uint8_t* encode
bit_lib_set_bits(encoded_data, PARADOX_PREAMBLE_LENGTH + i * 2, 0b01, 2);
}
}
};
}
bool protocol_paradox_encoder_start(ProtocolParadox* protocol) {
protocol_paradox_encode(protocol->data, (uint8_t*)protocol->encoded_data);
protocol->encoder.encoded_index = 0;
fsk_osc_reset(protocol->encoder.fsk_osc);
return true;
};
}
LevelDuration protocol_paradox_encoder_yield(ProtocolParadox* protocol) {
bool level;
@ -134,7 +134,7 @@ LevelDuration protocol_paradox_encoder_yield(ProtocolParadox* protocol) {
bit_lib_increment_index(protocol->encoder.encoded_index, PARADOX_ENCODED_BIT_SIZE);
}
return level_duration_make(level, duration);
};
}
static uint8_t protocol_paradox_calculate_checksum(uint8_t fc, uint16_t card_id) {
uint8_t card_hi = (card_id >> 8) & 0xff;
@ -185,7 +185,7 @@ void protocol_paradox_render_data(ProtocolParadox* protocol, FuriString* result)
if(card_crc != calc_crc) {
furi_string_cat(result, "\nCRC Mismatch, Invalid Card!");
}
};
}
void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* result) {
uint8_t* decoded_data = protocol->data;
@ -200,7 +200,7 @@ void protocol_paradox_render_brief_data(ProtocolParadox* protocol, FuriString* r
if(calc_crc != card_crc) {
furi_string_cat(result, "\nCRC Mismatch, Invalid Card!");
}
};
}
bool protocol_paradox_write_data(ProtocolParadox* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -222,7 +222,7 @@ bool protocol_paradox_write_data(ProtocolParadox* protocol, void* data) {
result = true;
}
return result;
};
}
const ProtocolBase protocol_paradox = {
.name = "Paradox",

View File

@ -41,21 +41,21 @@ ProtocolPyramid* protocol_pyramid_alloc(void) {
protocol->encoder.fsk_osc = fsk_osc_alloc(8, 10, 50);
return protocol;
};
}
void protocol_pyramid_free(ProtocolPyramid* protocol) {
fsk_demod_free(protocol->decoder.fsk_demod);
fsk_osc_free(protocol->encoder.fsk_osc);
free(protocol);
};
}
uint8_t* protocol_pyramid_get_data(ProtocolPyramid* protocol) {
return protocol->data;
};
}
void protocol_pyramid_decoder_start(ProtocolPyramid* protocol) {
memset(protocol->encoded_data, 0, PYRAMID_ENCODED_DATA_SIZE);
};
}
static bool protocol_pyramid_can_be_decoded(uint8_t* data) {
// check preamble
@ -122,7 +122,7 @@ bool protocol_pyramid_decoder_feed(ProtocolPyramid* protocol, bool level, uint32
}
return result;
};
}
bool protocol_pyramid_get_parity(const uint8_t* bits, uint8_t type, int length) {
int x;
@ -184,7 +184,7 @@ bool protocol_pyramid_encoder_start(ProtocolPyramid* protocol) {
protocol_pyramid_encode(protocol);
return true;
};
}
LevelDuration protocol_pyramid_encoder_yield(ProtocolPyramid* protocol) {
bool level = 0;
@ -214,7 +214,7 @@ LevelDuration protocol_pyramid_encoder_yield(ProtocolPyramid* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_pyramid_write_data(ProtocolPyramid* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -238,7 +238,7 @@ bool protocol_pyramid_write_data(ProtocolPyramid* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result) {
uint8_t* decoded_data = protocol->data;
@ -256,7 +256,7 @@ void protocol_pyramid_render_data(ProtocolPyramid* protocol, FuriString* result)
} else {
furi_string_cat_printf(result, "Data: Unknown");
}
};
}
const ProtocolBase protocol_pyramid = {
.name = "Pyramid",

View File

@ -47,15 +47,15 @@ typedef struct {
ProtocolSecurakey* protocol_securakey_alloc(void) {
ProtocolSecurakey* protocol = malloc(sizeof(ProtocolSecurakey));
return (void*)protocol;
};
}
void protocol_securakey_free(ProtocolSecurakey* protocol) {
free(protocol);
};
}
uint8_t* protocol_securakey_get_data(ProtocolSecurakey* protocol) {
return protocol->data;
};
}
static bool protocol_securakey_can_be_decoded(ProtocolSecurakey* protocol) {
// check 19 bits preamble + format flag
@ -71,7 +71,7 @@ static bool protocol_securakey_can_be_decoded(ProtocolSecurakey* protocol) {
} else {
return false;
}
};
}
static void protocol_securakey_decode(ProtocolSecurakey* protocol) {
memset(protocol->data, 0, SECURAKEY_DECODED_DATA_SIZE_BYTES);
@ -142,7 +142,7 @@ static void protocol_securakey_decode(ProtocolSecurakey* protocol) {
// plaintext format (preamble and 32-bit? card number)
// pppppppp pppppppp cccccccc cccccccc cccccccc cccccccc
// 00000000 00000000 00101011 00011101 00000100 01001010
};
}
void protocol_securakey_decoder_start(ProtocolSecurakey* protocol) {
// always takes in encoded data as RKKT for simplicity
@ -153,7 +153,7 @@ void protocol_securakey_decoder_start(ProtocolSecurakey* protocol) {
ManchesterEventReset,
&protocol->decoder_manchester_state,
NULL);
};
}
bool protocol_securakey_decoder_feed(ProtocolSecurakey* protocol, bool level, uint32_t duration) {
bool result = false;
@ -187,7 +187,7 @@ bool protocol_securakey_decoder_feed(ProtocolSecurakey* protocol, bool level, ui
}
}
return result;
};
}
void protocol_securakey_render_data(ProtocolSecurakey* protocol, FuriString* result) {
if(bit_lib_get_bits_16(protocol->data, 0, 16) == 0) {
@ -209,7 +209,7 @@ void protocol_securakey_render_data(ProtocolSecurakey* protocol, FuriString* res
bit_lib_get_bits_16(protocol->data, 0, 16),
bit_lib_get_bits_16(protocol->data, 16, 16));
}
};
}
bool protocol_securakey_encoder_start(ProtocolSecurakey* protocol) {
// set all of our encoded_data bits to zeros.
@ -277,7 +277,7 @@ bool protocol_securakey_encoder_start(ProtocolSecurakey* protocol) {
protocol->encoded_data_index = 0;
protocol->encoded_polarity = true;
return true;
};
}
LevelDuration protocol_securakey_encoder_yield(ProtocolSecurakey* protocol) {
if(bit_lib_get_bits_16(protocol->data, 0, 16) == 0) {
@ -305,7 +305,7 @@ LevelDuration protocol_securakey_encoder_yield(ProtocolSecurakey* protocol) {
}
return level_duration_make(level, duration);
}
};
}
bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) {
protocol_securakey_encoder_start(protocol);
@ -337,7 +337,7 @@ bool protocol_securakey_write_data(ProtocolSecurakey* protocol, void* data) {
}
}
return result;
};
}
const ProtocolBase protocol_securakey = {
.name = "Radio Key",

View File

@ -35,15 +35,15 @@ typedef struct {
ProtocolViking* protocol_viking_alloc(void) {
ProtocolViking* proto = malloc(sizeof(ProtocolViking));
return (void*)proto;
};
}
void protocol_viking_free(ProtocolViking* protocol) {
free(protocol);
};
}
uint8_t* protocol_viking_get_data(ProtocolViking* protocol) {
return protocol->data;
};
}
static void protocol_viking_decode(ProtocolViking* protocol) {
// Copy Card ID
@ -80,7 +80,7 @@ void protocol_viking_decoder_start(ProtocolViking* protocol) {
ManchesterEventReset,
&protocol->decoder_manchester_state,
NULL);
};
}
bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t duration) {
bool result = false;
@ -117,7 +117,7 @@ bool protocol_viking_decoder_feed(ProtocolViking* protocol, bool level, uint32_t
}
return result;
};
}
bool protocol_viking_encoder_start(ProtocolViking* protocol) {
// Preamble
@ -135,7 +135,7 @@ bool protocol_viking_encoder_start(ProtocolViking* protocol) {
bit_lib_set_bits(protocol->encoded_data, 56, checksum, 8);
return true;
};
}
LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) {
bool level = bit_lib_get_bit(protocol->encoded_data, protocol->encoded_data_index);
@ -151,7 +151,7 @@ LevelDuration protocol_viking_encoder_yield(ProtocolViking* protocol) {
}
return level_duration_make(level, duration);
};
}
bool protocol_viking_write_data(ProtocolViking* protocol, void* data) {
LFRFIDWriteRequest* request = (LFRFIDWriteRequest*)data;
@ -173,11 +173,11 @@ bool protocol_viking_write_data(ProtocolViking* protocol, void* data) {
result = true;
}
return result;
};
}
void protocol_viking_render_data(ProtocolViking* protocol, FuriString* result) {
furi_string_printf(result, "ID: %08lX", bit_lib_get_bits_32(protocol->data, 0, 32));
};
}
const ProtocolBase protocol_viking = {
.name = "Viking",

View File

@ -47,7 +47,7 @@ Iso14443_3aError iso14443_3a_listener_tx_with_custom_parity(
}
return ret;
};
}
Iso14443_3aError iso14443_3a_listener_send_standard_frame(
Iso14443_3aListener* instance,

View File

@ -38,7 +38,7 @@ static void mf_ultralight_listener_send_short_resp(MfUltralightListener* instanc
bit_buffer_set_size(instance->tx_buffer, 4);
bit_buffer_set_byte(instance->tx_buffer, 0, data);
iso14443_3a_listener_tx(instance->iso14443_3a_listener, instance->tx_buffer);
};
}
static void mf_ultralight_listener_perform_read(
MfUltralightPage* pages,

View File

@ -204,7 +204,7 @@ static void onewire_slave_exti_callback(void* context) {
} else {
pulse_start = DWT->CYCCNT;
}
};
}
/*********************** PUBLIC ***********************/

View File

@ -397,7 +397,7 @@ bool tar_archive_unpack_to(
FURI_LOG_I(TAG, "Restoring '%s'", destination);
return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, &param) == MTAR_ESUCCESS);
};
}
bool tar_archive_add_file(
TarArchive* archive,