unleashed-firmware/applications/picopass/picopass_device.c
Eric Betts 8af2198684
Iclass UI (#1366)
* Move structs to header
* roll mbedtls into loclass
* Picopass with scene for reading card
* Picopass: fix memory leak
* Lib: return mbedtls back
* Picopass: rename symbols to match naming guide

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-07-06 00:28:27 +09:00

34 lines
957 B
C

#include "picopass_device.h"
#include <toolbox/path.h>
#include <flipper_format/flipper_format.h>
#define TAG "PicopassDevice"
PicopassDevice* picopass_device_alloc() {
PicopassDevice* picopass_dev = malloc(sizeof(PicopassDevice));
picopass_dev->storage = furi_record_open("storage");
picopass_dev->dialogs = furi_record_open("dialogs");
return picopass_dev;
}
void picopass_device_clear(PicopassDevice* dev) {
furi_assert(dev);
picopass_device_data_clear(&dev->dev_data);
memset(&dev->dev_data, 0, sizeof(dev->dev_data));
}
void picopass_device_free(PicopassDevice* picopass_dev) {
furi_assert(picopass_dev);
picopass_device_clear(picopass_dev);
furi_record_close("storage");
furi_record_close("dialogs");
free(picopass_dev);
}
void picopass_device_data_clear(PicopassDeviceData* dev_data) {
FURI_LOG_D(TAG, "picopass_device_data_clear");
memset(&dev_data->AA1, 0, sizeof(ApplicationArea));
}