New LF-RFID app (#534)
* Hal lfrfid: add read timer pulse and period config fns * New debug application for lfrfid subsystem * New lfrfid: app, fix naming * App lfrfid: assets * Container view module * App ibutton: remove unused header * App lfrfid scenes * App notification, add yield to blocking operations, add speaker volume control * App lfrfid: reading key scene * Assets: placeholder icon * App lfrfid: reworked container view module * App lfrfid: new scenes * App lfrfid: write scene * App lfrfid: write hid * App lfrfid: emulate scene * App lfrfid: save name scene * App lfrfid: add missing file
This commit is contained in:
35
applications/lfrfid/helpers/rfid-name-generator.cpp
Normal file
35
applications/lfrfid/helpers/rfid-name-generator.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "rfid-name-generator.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void rfid_generate_random_name(char* name, uint8_t max_name_size) {
|
||||
const uint8_t prefix_size = 9;
|
||||
const char* prefix[prefix_size] = {
|
||||
"good",
|
||||
"nice",
|
||||
"best",
|
||||
"some",
|
||||
"strange",
|
||||
"working",
|
||||
"that",
|
||||
"forgettable",
|
||||
"easy",
|
||||
};
|
||||
|
||||
const uint8_t suffix_size = 7;
|
||||
const char* suffix[suffix_size] = {
|
||||
"pass",
|
||||
"card",
|
||||
"key",
|
||||
"fob",
|
||||
"permit",
|
||||
"pass",
|
||||
"one",
|
||||
};
|
||||
|
||||
sniprintf(
|
||||
name, max_name_size, "%s_%s", prefix[rand() % prefix_size], suffix[rand() % suffix_size]);
|
||||
|
||||
// to upper
|
||||
name[0] = name[0] - ('a' - 'A');
|
||||
}
|
||||
Reference in New Issue
Block a user