mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
Revert hitag for now, need to cleanup more space
This commit is contained in:
@@ -5,42 +5,6 @@
|
||||
|
||||
#define LFRFID_DICT_FILETYPE "Flipper RFID key"
|
||||
|
||||
bool lfrfid_dict_file_save_hitag1_data(FlipperFormat* file, uint8_t* data) {
|
||||
FuriString* string = furi_string_alloc();
|
||||
bool result = false;
|
||||
uint8_t pageSize = 4;
|
||||
|
||||
do {
|
||||
//write shortened data (tag ID)
|
||||
if(!flipper_format_write_hex(file, "Data", data, pageSize)) break;
|
||||
|
||||
if(!flipper_format_write_comment_cstr(file, "Hitag1 specific data")) break;
|
||||
|
||||
//write pages
|
||||
for(uint8_t p = 0; p < 64; p++) {
|
||||
furi_string_printf(string, "Page %2u", p);
|
||||
if(data[64 * pageSize + p]) {
|
||||
//write page data
|
||||
if(!flipper_format_write_hex(
|
||||
file, furi_string_get_cstr(string), data + p * pageSize, pageSize))
|
||||
break;
|
||||
} else {
|
||||
//write ?? ?? ?? ??
|
||||
if(!flipper_format_write_string_cstr(
|
||||
file, furi_string_get_cstr(string), "?? ?? ?? ??"))
|
||||
break;
|
||||
}
|
||||
if(p == 64 - 1) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} while(false);
|
||||
|
||||
furi_string_free(string);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool lfrfid_dict_file_save(ProtocolDict* dict, ProtocolId protocol, const char* filename) {
|
||||
furi_check(protocol != PROTOCOL_NO);
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
@@ -62,12 +26,8 @@ bool lfrfid_dict_file_save(ProtocolDict* dict, ProtocolId protocol, const char*
|
||||
// TODO: write comment about protocol sizes into file
|
||||
|
||||
protocol_dict_get_data(dict, protocol, data, data_size);
|
||||
if(protocol == LFRFIDProtocolHitag1) {
|
||||
if(!lfrfid_dict_file_save_hitag1_data(file, data)) break;
|
||||
} else {
|
||||
if(!flipper_format_write_hex(file, "Data", data, data_size)) break;
|
||||
}
|
||||
|
||||
if(!flipper_format_write_hex(file, "Data", data, data_size)) break;
|
||||
result = true;
|
||||
} while(false);
|
||||
|
||||
@@ -178,41 +138,6 @@ static ProtocolId lfrfid_dict_protocol_fallback(
|
||||
return result;
|
||||
}
|
||||
|
||||
bool lfrfid_dict_file_load_hitag1_data(FlipperFormat* file, uint8_t* data) {
|
||||
FuriString* string = furi_string_alloc();
|
||||
bool result = false;
|
||||
uint8_t tagID[4];
|
||||
uint8_t pageSize = 4;
|
||||
|
||||
do {
|
||||
//read shortened data (tag ID)
|
||||
if(!flipper_format_read_hex(file, "Data", tagID, 4)) break;
|
||||
|
||||
//read pages
|
||||
for(uint8_t p = 0; p < 64; p++) {
|
||||
furi_string_printf(string, "Page %2u", p);
|
||||
if(flipper_format_read_hex(
|
||||
file, furi_string_get_cstr(string), data + p * pageSize, pageSize)) {
|
||||
data[64 * pageSize + p] = 1;
|
||||
} else {
|
||||
data[64 * pageSize + p] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//check data consistency
|
||||
if(memcmp(tagID, data, pageSize) != 0) break;
|
||||
|
||||
//check if tag ID & config page are succesfully read
|
||||
if(data[64 * pageSize + 0] && data[64 * pageSize + 1]) {
|
||||
result = true;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
furi_string_free(string);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
@@ -238,11 +163,6 @@ ProtocolId lfrfid_dict_file_load(ProtocolDict* dict, const char* filename) {
|
||||
if(protocol == PROTOCOL_NO) {
|
||||
protocol = lfrfid_dict_protocol_fallback(dict, furi_string_get_cstr(str_result), file);
|
||||
if(protocol == PROTOCOL_NO) break;
|
||||
} else if(protocol == LFRFIDProtocolHitag1) {
|
||||
// Hitag1 data
|
||||
size_t data_size = protocol_dict_get_data_size(dict, protocol);
|
||||
if(!lfrfid_dict_file_load_hitag1_data(file, data)) break;
|
||||
protocol_dict_set_data(dict, protocol, data, data_size);
|
||||
} else {
|
||||
// data
|
||||
size_t data_size = protocol_dict_get_data_size(dict, protocol);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,86 +0,0 @@
|
||||
#pragma once
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <furi_hal_rfid.h>
|
||||
#include <furi_hal_interrupt.h>
|
||||
#include <furi_hal_resources.h>
|
||||
#include <flipper_format/flipper_format.h>
|
||||
//#include <toolbox/protocols/protocol_dict.h>
|
||||
#include "protocols/lfrfid_protocols.h"
|
||||
|
||||
#include <toolbox/stream/file_stream.h>
|
||||
#include <toolbox/buffer_stream.h>
|
||||
#include <toolbox/varint.h>
|
||||
#include <tools/varint_pair.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <stm32wbxx_ll_tim.h>
|
||||
#include <stm32wbxx_ll_comp.h>
|
||||
#include <stm32wbxx_ll_dma.h>
|
||||
|
||||
#include <lfrfid_worker_i.h>
|
||||
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define HITAG_BLOCKS 16
|
||||
#define HITAG_BLOCKPAGES 4
|
||||
#define HITAG_PAGES 64
|
||||
#define HITAG_PAGEBYTES 4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
LFRFIDHitagWorkerSettingRead,
|
||||
LFRFIDHitagWorkerSettingEmulate,
|
||||
} LFRFIDHitagWorkerSetting;
|
||||
|
||||
typedef enum {
|
||||
LFRFIDHitagStatusScanning,
|
||||
LFRFIDHitagStatusDetected,
|
||||
LFRFIDHitagStatusRead,
|
||||
} LFRFIDHitagStatus;
|
||||
|
||||
typedef struct LFRFIDHitagWorker LFRFIDHitagWorker;
|
||||
|
||||
/**
|
||||
* @brief Get the tag read status
|
||||
*
|
||||
* @return tag read status
|
||||
*/
|
||||
LFRFIDHitagStatus lfrfid_hitag_worker_get_status(LFRFIDHitagWorker* worker);
|
||||
|
||||
/**
|
||||
* @brief Allocate a new LFRFIDHitagWorker instance
|
||||
*
|
||||
* @return LFRFIDHitagWorker*
|
||||
*/
|
||||
LFRFIDHitagWorker* lfrfid_hitag_worker_alloc(ProtocolDict* dict);
|
||||
|
||||
/**
|
||||
* @brief Free a LFRFIDHitagWorker instance
|
||||
*
|
||||
* @param worker LFRFIDHitagWorker instance
|
||||
*/
|
||||
void lfrfid_hitag_worker_free(LFRFIDHitagWorker* worker);
|
||||
|
||||
/**
|
||||
* @brief Start hitag worker from own generated field
|
||||
*
|
||||
* @param worker LFRFIDHitagWorker instance
|
||||
* @param setting read/emulate
|
||||
*/
|
||||
void lfrfid_hitag_worker_start(LFRFIDHitagWorker* worker, LFRFIDHitagWorkerSetting setting);
|
||||
|
||||
/**
|
||||
* @brief Stop worker
|
||||
*
|
||||
* @param worker
|
||||
*/
|
||||
void lfrfid_hitag_worker_stop(LFRFIDHitagWorker* worker);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -23,7 +23,6 @@ typedef enum {
|
||||
LFRFIDWorkerReadTypeAuto,
|
||||
LFRFIDWorkerReadTypeASKOnly,
|
||||
LFRFIDWorkerReadTypePSKOnly,
|
||||
LFRFIDWorkerReadTypeRTFOnly,
|
||||
} LFRFIDWorkerReadType;
|
||||
|
||||
typedef enum {
|
||||
@@ -33,8 +32,6 @@ typedef enum {
|
||||
LFRFIDWorkerReadSenseCardEnd,
|
||||
LFRFIDWorkerReadStartASK,
|
||||
LFRFIDWorkerReadStartPSK,
|
||||
LFRFIDWorkerReadStartRTF,
|
||||
LFRFIDWorkerReadSenseHitag, //TODO combine with sense carstart?
|
||||
LFRFIDWorkerReadDone,
|
||||
} LFRFIDWorkerReadResult;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <furi.h>
|
||||
#include "lfrfid_worker.h"
|
||||
#include "lfrfid_raw_worker.h"
|
||||
#include "lfrfid_hitag_worker.h"
|
||||
#include "protocols/lfrfid_protocols.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -94,7 +94,7 @@ typedef enum {
|
||||
LFRFIDWorkerReadTimeout,
|
||||
} LFRFIDWorkerReadState;
|
||||
|
||||
static LFRFIDWorkerReadState lfrfid_worker_read_ttf( //tag talks first
|
||||
static LFRFIDWorkerReadState lfrfid_worker_read_internal(
|
||||
LFRFIDWorker* worker,
|
||||
LFRFIDFeature feature,
|
||||
uint32_t timeout,
|
||||
@@ -334,63 +334,6 @@ static LFRFIDWorkerReadState lfrfid_worker_read_ttf( //tag talks first
|
||||
return state;
|
||||
}
|
||||
|
||||
static LFRFIDWorkerReadState lfrfid_worker_read_rtf( //reader talks first
|
||||
LFRFIDWorker* worker,
|
||||
LFRFIDFeature feature,
|
||||
uint32_t timeout,
|
||||
ProtocolId* result_protocol) {
|
||||
UNUSED(feature);
|
||||
LFRFIDWorkerReadState state = LFRFIDWorkerReadTimeout;
|
||||
|
||||
FURI_LOG_D(TAG, "Start RTF");
|
||||
if(worker->read_cb) {
|
||||
worker->read_cb(LFRFIDWorkerReadStartRTF, PROTOCOL_NO, worker->cb_ctx);
|
||||
}
|
||||
LFRFIDHitagWorker* hitag_worker = lfrfid_hitag_worker_alloc(worker->protocols);
|
||||
|
||||
lfrfid_hitag_worker_start(hitag_worker, LFRFIDHitagWorkerSettingRead);
|
||||
|
||||
FURI_LOG_D(TAG, "Read started");
|
||||
|
||||
//scan for hitag for a while and stay in hitag mode if card was detected
|
||||
uint8_t delays = 0;
|
||||
uint8_t delay_ms = 100;
|
||||
bool notified = false;
|
||||
while(1) {
|
||||
furi_delay_ms(delay_ms);
|
||||
|
||||
if(lfrfid_worker_check_for_stop(worker)) {
|
||||
state = LFRFIDWorkerReadExit;
|
||||
*result_protocol = PROTOCOL_NO;
|
||||
break;
|
||||
}
|
||||
|
||||
if(lfrfid_hitag_worker_get_status(hitag_worker) == LFRFIDHitagStatusDetected) {
|
||||
*result_protocol =
|
||||
LFRFIDProtocolHitag1; //TODO get protocol ID from hitag_worker when expanding the worker to include other hitag protocols
|
||||
if(!notified && worker->read_cb) {
|
||||
worker->read_cb(LFRFIDWorkerReadSenseHitag, *result_protocol, worker->cb_ctx);
|
||||
notified = true;
|
||||
}
|
||||
} else if(lfrfid_hitag_worker_get_status(hitag_worker) == LFRFIDHitagStatusRead) {
|
||||
state = LFRFIDWorkerReadOK;
|
||||
*result_protocol =
|
||||
LFRFIDProtocolHitag1; //TODO get protocol ID from hitag_worker when expanding the worker to include other hitag protocols
|
||||
break;
|
||||
} else if(++delays >= timeout / delay_ms) {
|
||||
state = LFRFIDWorkerReadTimeout;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lfrfid_hitag_worker_stop(hitag_worker);
|
||||
lfrfid_hitag_worker_free(hitag_worker);
|
||||
|
||||
FURI_LOG_D(TAG, "Read stopped");
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static void lfrfid_worker_mode_read_process(LFRFIDWorker* worker) {
|
||||
ProtocolId read_result = PROTOCOL_NO;
|
||||
LFRFIDWorkerReadState state;
|
||||
@@ -398,8 +341,6 @@ static void lfrfid_worker_mode_read_process(LFRFIDWorker* worker) {
|
||||
|
||||
if(worker->read_type == LFRFIDWorkerReadTypePSKOnly) {
|
||||
feature = LFRFIDFeaturePSK;
|
||||
} else if(worker->read_type == LFRFIDWorkerReadTypeRTFOnly) {
|
||||
feature = LFRFIDFeatureRTF;
|
||||
} else {
|
||||
feature = LFRFIDFeatureASK;
|
||||
}
|
||||
@@ -407,14 +348,8 @@ static void lfrfid_worker_mode_read_process(LFRFIDWorker* worker) {
|
||||
if(worker->read_type == LFRFIDWorkerReadTypeAuto) {
|
||||
while(1) {
|
||||
// read for a while
|
||||
|
||||
if(feature == LFRFIDFeatureASK || feature == LFRFIDFeaturePSK) {
|
||||
state = lfrfid_worker_read_ttf(
|
||||
worker, feature, LFRFID_WORKER_READ_SWITCH_TIME_MS, &read_result);
|
||||
} else if(feature == LFRFIDFeatureRTF) {
|
||||
state = lfrfid_worker_read_rtf(
|
||||
worker, feature, LFRFID_WORKER_READ_SWITCH_TIME_MS, &read_result);
|
||||
}
|
||||
state = lfrfid_worker_read_internal(
|
||||
worker, feature, LFRFID_WORKER_READ_SWITCH_TIME_MS, &read_result);
|
||||
|
||||
if(state == LFRFIDWorkerReadOK || state == LFRFIDWorkerReadExit) {
|
||||
break;
|
||||
@@ -423,9 +358,7 @@ static void lfrfid_worker_mode_read_process(LFRFIDWorker* worker) {
|
||||
// switch to next feature
|
||||
if(feature == LFRFIDFeatureASK) {
|
||||
feature = LFRFIDFeaturePSK;
|
||||
} else if(feature == LFRFIDFeaturePSK) {
|
||||
feature = LFRFIDFeatureRTF;
|
||||
} else if(feature == LFRFIDFeatureRTF) {
|
||||
} else {
|
||||
feature = LFRFIDFeatureASK;
|
||||
}
|
||||
|
||||
@@ -434,12 +367,10 @@ static void lfrfid_worker_mode_read_process(LFRFIDWorker* worker) {
|
||||
} else {
|
||||
while(1) {
|
||||
if(worker->read_type == LFRFIDWorkerReadTypeASKOnly) {
|
||||
state = lfrfid_worker_read_ttf(worker, feature, UINT32_MAX, &read_result);
|
||||
} else if(worker->read_type == LFRFIDWorkerReadTypePSKOnly) {
|
||||
state = lfrfid_worker_read_ttf(
|
||||
worker, feature, LFRFID_WORKER_READ_SWITCH_TIME_MS, &read_result);
|
||||
state = lfrfid_worker_read_internal(worker, feature, UINT32_MAX, &read_result);
|
||||
} else {
|
||||
state = lfrfid_worker_read_rtf(worker, feature, UINT32_MAX, &read_result);
|
||||
state = lfrfid_worker_read_internal(
|
||||
worker, feature, LFRFID_WORKER_READ_SWITCH_TIME_MS, &read_result);
|
||||
}
|
||||
|
||||
if(state == LFRFIDWorkerReadOK || state == LFRFIDWorkerReadExit) {
|
||||
@@ -475,7 +406,7 @@ static void lfrfid_worker_emulate_dma_isr(bool half, void* context) {
|
||||
furi_stream_buffer_send(stream, &flag, sizeof(uint32_t), 0);
|
||||
}
|
||||
|
||||
static void lfrfid_worker_emulate_ttf(LFRFIDWorker* worker) {
|
||||
static void lfrfid_worker_mode_emulate_process(LFRFIDWorker* worker) {
|
||||
LFRFIDWorkerEmulateBuffer* buffer = malloc(sizeof(LFRFIDWorkerEmulateBuffer));
|
||||
FuriStreamBuffer* stream = furi_stream_buffer_alloc(sizeof(uint32_t), sizeof(uint32_t));
|
||||
LFRFIDProtocol protocol = worker->protocol;
|
||||
@@ -564,39 +495,6 @@ static void lfrfid_worker_emulate_ttf(LFRFIDWorker* worker) {
|
||||
pulse_glue_free(pulse_glue);
|
||||
}
|
||||
|
||||
static void lfrfid_worker_emulate_rtf(LFRFIDWorker* worker) {
|
||||
LFRFIDHitagWorker* hitag_worker = lfrfid_hitag_worker_alloc(
|
||||
worker->protocols); //todo, pass protocols & protocol id when expanding the worker to include other hitag protocols
|
||||
|
||||
lfrfid_hitag_worker_start(hitag_worker, LFRFIDHitagWorkerSettingEmulate);
|
||||
uint8_t delay_ms = 100;
|
||||
while(1) {
|
||||
furi_delay_ms(delay_ms);
|
||||
|
||||
if(lfrfid_worker_check_for_stop(worker)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lfrfid_hitag_worker_stop(hitag_worker);
|
||||
lfrfid_hitag_worker_free(hitag_worker);
|
||||
}
|
||||
|
||||
static void lfrfid_worker_mode_emulate_process(LFRFIDWorker* worker) {
|
||||
if(worker != NULL) {
|
||||
if(worker->protocols != NULL) {
|
||||
LFRFIDFeature feature =
|
||||
protocol_dict_get_features(worker->protocols, worker->protocol);
|
||||
|
||||
if(feature == LFRFIDFeatureRTF) {
|
||||
lfrfid_worker_emulate_rtf(worker);
|
||||
} else {
|
||||
lfrfid_worker_emulate_ttf(worker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************************************/
|
||||
/********************************************* WRITE **********************************************/
|
||||
/**************************************************************************************************/
|
||||
@@ -623,7 +521,7 @@ static void lfrfid_worker_mode_write_process(LFRFIDWorker* worker) {
|
||||
t5577_write(&request->t5577);
|
||||
|
||||
ProtocolId read_result = PROTOCOL_NO;
|
||||
LFRFIDWorkerReadState state = lfrfid_worker_read_ttf(
|
||||
LFRFIDWorkerReadState state = lfrfid_worker_read_internal(
|
||||
worker,
|
||||
protocol_dict_get_features(worker->protocols, protocol),
|
||||
LFRFID_WORKER_WRITE_VERIFY_TIME_MS,
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "protocol_pac_stanley.h"
|
||||
#include "protocol_keri.h"
|
||||
#include "protocol_gallagher.h"
|
||||
#include "protocol_hitag1.h"
|
||||
|
||||
const ProtocolBase* lfrfid_protocols[] = {
|
||||
[LFRFIDProtocolEM4100] = &protocol_em4100,
|
||||
@@ -36,5 +35,4 @@ const ProtocolBase* lfrfid_protocols[] = {
|
||||
[LFRFIDProtocolPACStanley] = &protocol_pac_stanley,
|
||||
[LFRFIDProtocolKeri] = &protocol_keri,
|
||||
[LFRFIDProtocolGallagher] = &protocol_gallagher,
|
||||
[LFRFIDProtocolHitag1] = &protocol_hitag1,
|
||||
};
|
||||
@@ -5,7 +5,6 @@
|
||||
typedef enum {
|
||||
LFRFIDFeatureASK = 1 << 0, /** ASK Demodulation */
|
||||
LFRFIDFeaturePSK = 1 << 1, /** PSK Demodulation */
|
||||
LFRFIDFeatureRTF = 1 << 2, /** Reader Talks First: ASK Demodulation with 2 way communication */
|
||||
} LFRFIDFeature;
|
||||
|
||||
typedef enum {
|
||||
@@ -26,7 +25,6 @@ typedef enum {
|
||||
LFRFIDProtocolPACStanley,
|
||||
LFRFIDProtocolKeri,
|
||||
LFRFIDProtocolGallagher,
|
||||
LFRFIDProtocolHitag1,
|
||||
LFRFIDProtocolMax,
|
||||
} LFRFIDProtocol;
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
#include <furi.h>
|
||||
#include <toolbox/protocols/protocol.h>
|
||||
#include "lfrfid_protocols.h"
|
||||
|
||||
#define HITAG1_PAGES 64
|
||||
#define HITAG1_DATA_SIZE HITAG1_PAGES * 4 + HITAG1_PAGES
|
||||
|
||||
typedef struct {
|
||||
uint8_t tagData[HITAG1_DATA_SIZE];
|
||||
} ProtocolHitag1;
|
||||
|
||||
ProtocolHitag1* protocol_hitag1_alloc(void) {
|
||||
ProtocolHitag1* protocol = malloc(sizeof(ProtocolHitag1));
|
||||
|
||||
return protocol;
|
||||
};
|
||||
|
||||
void protocol_hitag1_free(ProtocolHitag1* protocol) {
|
||||
free(protocol);
|
||||
};
|
||||
|
||||
uint8_t* protocol_hitag1_get_data(ProtocolHitag1* protocol) {
|
||||
return protocol->tagData;
|
||||
};
|
||||
|
||||
void protocol_hitag1_decoder_start(ProtocolHitag1* protocol) {
|
||||
UNUSED(protocol);
|
||||
// Not applicalble, encoding & decoding is handled in lfrfid_hitag_worker...
|
||||
};
|
||||
|
||||
bool protocol_hitag1_decoder_feed(ProtocolHitag1* protocol, bool level, uint32_t duration) {
|
||||
UNUSED(protocol);
|
||||
UNUSED(level);
|
||||
UNUSED(duration);
|
||||
// Not applicalble, encoding & decoding is handled in lfrfid_hitag_worker...
|
||||
|
||||
bool result = false;
|
||||
return result;
|
||||
};
|
||||
|
||||
bool protocol_hitag1_encoder_start(ProtocolHitag1* protocol) {
|
||||
UNUSED(protocol);
|
||||
// Not applicalble, encoding & decoding is handled in lfrfid_hitag_worker...
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
LevelDuration protocol_hitag1_encoder_yield(ProtocolHitag1* protocol) {
|
||||
UNUSED(protocol);
|
||||
// Not applicalble, encoding & decoding is handled in lfrfid_hitag_worker...
|
||||
|
||||
bool level = 0;
|
||||
uint32_t duration = 0;
|
||||
return level_duration_make(level, duration);
|
||||
};
|
||||
|
||||
bool protocol_hitag1_write_data(ProtocolHitag1* protocol, void* data) {
|
||||
UNUSED(protocol);
|
||||
UNUSED(data);
|
||||
|
||||
//this protocol cannot be simply written to card --> don't do anything, just return false
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
void protocol_hitag1_render_data(ProtocolHitag1* protocol, FuriString* result) {
|
||||
uint8_t pages = 0;
|
||||
for(uint8_t p = 0; p < HITAG1_PAGES; p++) {
|
||||
pages += protocol->tagData[HITAG1_PAGES * 4 + p];
|
||||
}
|
||||
furi_string_printf(
|
||||
result,
|
||||
"SN: %02X %02X %02X %02X\r\n"
|
||||
"Pages read: %u / 64",
|
||||
protocol->tagData[0],
|
||||
protocol->tagData[1],
|
||||
protocol->tagData[2],
|
||||
protocol->tagData[3],
|
||||
pages);
|
||||
};
|
||||
|
||||
const ProtocolBase protocol_hitag1 = {
|
||||
.name = "Hitag1",
|
||||
.manufacturer = "Philips",
|
||||
.data_size = HITAG1_DATA_SIZE,
|
||||
.features = LFRFIDFeatureRTF,
|
||||
.validate_count = 1,
|
||||
.alloc = (ProtocolAlloc)protocol_hitag1_alloc,
|
||||
.free = (ProtocolFree)protocol_hitag1_free,
|
||||
.get_data = (ProtocolGetData)protocol_hitag1_get_data,
|
||||
.decoder =
|
||||
{
|
||||
.start = (ProtocolDecoderStart)protocol_hitag1_decoder_start,
|
||||
.feed = (ProtocolDecoderFeed)protocol_hitag1_decoder_feed,
|
||||
},
|
||||
.encoder =
|
||||
{
|
||||
.start = (ProtocolEncoderStart)protocol_hitag1_encoder_start,
|
||||
.yield = (ProtocolEncoderYield)protocol_hitag1_encoder_yield,
|
||||
},
|
||||
.render_data = (ProtocolRenderData)protocol_hitag1_render_data,
|
||||
.render_brief_data = (ProtocolRenderData)protocol_hitag1_render_data,
|
||||
.write_data = (ProtocolWriteData)protocol_hitag1_write_data,
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
#include <toolbox/protocols/protocol.h>
|
||||
|
||||
extern const ProtocolBase protocol_hitag1;
|
||||
Reference in New Issue
Block a user