mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-15 17:18:01 +00:00
e3c7201a20
* Furi: rename and move core * Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest * Furi: CMSIS_OS drop and refactoring. * Furi: refactoring, remove cmsis legacy * Furi: fix incorrect assert on queue deallocation, cleanup timer * Furi: improve delay api, get rid of floats * hal: dropped furi_hal_crc * Furi: move DWT based delay to cortex HAL * Furi: update core documentation Co-authored-by: hedger <hedger@nanode.su>
65 lines
1.2 KiB
C++
65 lines
1.2 KiB
C++
#include "rfid_key.h"
|
|
#include <core/check.h>
|
|
#include <string.h>
|
|
|
|
RfidKey::RfidKey() {
|
|
clear();
|
|
}
|
|
|
|
RfidKey::~RfidKey() {
|
|
}
|
|
|
|
void RfidKey::set_type(LfrfidKeyType _type) {
|
|
type = _type;
|
|
}
|
|
|
|
void RfidKey::set_data(const uint8_t* _data, const uint8_t _data_size) {
|
|
furi_assert(_data_size <= data.size());
|
|
for(uint8_t i = 0; i < _data_size; i++) {
|
|
data[i] = _data[i];
|
|
}
|
|
}
|
|
|
|
void RfidKey::set_name(const char* _name) {
|
|
strlcpy(name, _name, get_name_length());
|
|
}
|
|
|
|
LfrfidKeyType RfidKey::get_type() {
|
|
return type;
|
|
}
|
|
|
|
const uint8_t* RfidKey::get_data() {
|
|
return &data[0];
|
|
}
|
|
|
|
const char* RfidKey::get_type_text() {
|
|
return lfrfid_key_get_type_string(type);
|
|
}
|
|
|
|
uint8_t RfidKey::get_type_data_count() const {
|
|
return lfrfid_key_get_type_data_count(type);
|
|
}
|
|
|
|
char* RfidKey::get_name() {
|
|
return name;
|
|
}
|
|
|
|
uint8_t RfidKey::get_name_length() {
|
|
return LFRFID_KEY_NAME_SIZE;
|
|
}
|
|
|
|
void RfidKey::clear() {
|
|
set_name("");
|
|
set_type(LfrfidKeyType::KeyEM4100);
|
|
data.fill(0);
|
|
}
|
|
|
|
RfidKey& RfidKey::operator=(const RfidKey& rhs) {
|
|
if(this == &rhs) return *this;
|
|
|
|
set_type(rhs.type);
|
|
set_name(rhs.name);
|
|
set_data(&rhs.data[0], get_type_data_count());
|
|
|
|
return *this;
|
|
}
|