rfid-key.cpp 809 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "rfid-key.h"
  2. #include <furi/check.h>
  3. RfidKey::RfidKey() {
  4. data.fill(0);
  5. for(uint8_t i = 0; i < (LFRFID_KEY_NAME_SIZE + 1); i++) {
  6. name[i] = 0;
  7. }
  8. }
  9. RfidKey::~RfidKey() {
  10. }
  11. void RfidKey::set_type(LfrfidKeyType _type) {
  12. type = _type;
  13. }
  14. void RfidKey::set_data(uint8_t* _data, const uint8_t _data_size) {
  15. furi_assert(_data_size <= data.size());
  16. for(uint8_t i = 0; i < _data_size; i++) {
  17. data[i] = _data[i];
  18. }
  19. }
  20. LfrfidKeyType RfidKey::get_type() {
  21. return type;
  22. }
  23. uint8_t* RfidKey::get_data() {
  24. return &data[0];
  25. }
  26. const char* RfidKey::get_type_text() {
  27. return lfrfid_key_get_type_string(type);
  28. }
  29. const uint8_t RfidKey::get_type_data_count() {
  30. return lfrfid_key_get_type_data_count(type);
  31. }
  32. char* RfidKey::get_name() {
  33. return name;
  34. }