Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
66
applications/lfrfid/helpers/key_info.cpp
Normal file
66
applications/lfrfid/helpers/key_info.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "key_info.h"
|
||||
#include <string.h>
|
||||
|
||||
const char* lfrfid_key_get_type_string(LfrfidKeyType type) {
|
||||
switch(type) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
return "EM4100";
|
||||
break;
|
||||
case LfrfidKeyType::KeyH10301:
|
||||
return "H10301";
|
||||
break;
|
||||
case LfrfidKeyType::KeyI40134:
|
||||
return "I40134";
|
||||
break;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
const char* lfrfid_key_get_manufacturer_string(LfrfidKeyType type) {
|
||||
switch(type) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
return "EM-Marin";
|
||||
break;
|
||||
case LfrfidKeyType::KeyH10301:
|
||||
return "HID";
|
||||
break;
|
||||
case LfrfidKeyType::KeyI40134:
|
||||
return "Indala";
|
||||
break;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
bool lfrfid_key_get_string_type(const char* string, LfrfidKeyType* type) {
|
||||
bool result = true;
|
||||
|
||||
if(strcmp("EM4100", string) == 0) {
|
||||
*type = LfrfidKeyType::KeyEM4100;
|
||||
} else if(strcmp("H10301", string) == 0) {
|
||||
*type = LfrfidKeyType::KeyH10301;
|
||||
} else if(strcmp("I40134", string) == 0) {
|
||||
*type = LfrfidKeyType::KeyI40134;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint8_t lfrfid_key_get_type_data_count(LfrfidKeyType type) {
|
||||
switch(type) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
return 5;
|
||||
break;
|
||||
case LfrfidKeyType::KeyH10301:
|
||||
return 3;
|
||||
break;
|
||||
case LfrfidKeyType::KeyI40134:
|
||||
return 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user