|
@@ -8,6 +8,8 @@
|
|
|
#include <nrf24.h>
|
|
#include <nrf24.h>
|
|
|
#include <toolbox/stream/file_stream.h>
|
|
#include <toolbox/stream/file_stream.h>
|
|
|
|
|
|
|
|
|
|
+#include "stdstring.h"
|
|
|
|
|
+
|
|
|
#define LOGITECH_MAX_CHANNEL 85
|
|
#define LOGITECH_MAX_CHANNEL 85
|
|
|
#define COUNT_THRESHOLD 2
|
|
#define COUNT_THRESHOLD 2
|
|
|
#define DEFAULT_SAMPLE_TIME 4000
|
|
#define DEFAULT_SAMPLE_TIME 4000
|
|
@@ -159,11 +161,11 @@ static bool save_addr_to_file(
|
|
|
if(target_rate == 8) rate = 2;
|
|
if(target_rate == 8) rate = 2;
|
|
|
snprintf(ending, sizeof(ending), ",%d\n", rate);
|
|
snprintf(ending, sizeof(ending), ",%d\n", rate);
|
|
|
hexlify(data, size, addrline);
|
|
hexlify(data, size, addrline);
|
|
|
- strcat(addrline, ending);
|
|
|
|
|
|
|
+ nrf_strcat(addrline, ending);
|
|
|
linesize = strlen(addrline);
|
|
linesize = strlen(addrline);
|
|
|
strcpy(filepath, NRFSNIFF_APP_PATH_FOLDER);
|
|
strcpy(filepath, NRFSNIFF_APP_PATH_FOLDER);
|
|
|
- strcat(filepath, "/");
|
|
|
|
|
- strcat(filepath, NRFSNIFF_APP_FILENAME);
|
|
|
|
|
|
|
+ nrf_strcat(filepath, "/");
|
|
|
|
|
+ nrf_strcat(filepath, NRFSNIFF_APP_FILENAME);
|
|
|
stream_seek(stream, 0, StreamOffsetFromStart);
|
|
stream_seek(stream, 0, StreamOffsetFromStart);
|
|
|
|
|
|
|
|
// check if address already exists in file
|
|
// check if address already exists in file
|
|
@@ -175,14 +177,14 @@ static bool save_addr_to_file(
|
|
|
file_contents = malloc(file_size + 1);
|
|
file_contents = malloc(file_size + 1);
|
|
|
memset(file_contents, 0, file_size + 1);
|
|
memset(file_contents, 0, file_size + 1);
|
|
|
if(stream_read(stream, file_contents, file_size) > 0) {
|
|
if(stream_read(stream, file_contents, file_size) > 0) {
|
|
|
- char* line = strtok((char*)file_contents, "\n");
|
|
|
|
|
|
|
+ char* line = nrf_strtok((char*)file_contents, "\n");
|
|
|
|
|
|
|
|
while(line != NULL) {
|
|
while(line != NULL) {
|
|
|
if(!memcmp(line, addrline, 12)) {
|
|
if(!memcmp(line, addrline, 12)) {
|
|
|
found = true;
|
|
found = true;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- line = strtok(NULL, "\n");
|
|
|
|
|
|
|
+ line = nrf_strtok(NULL, "\n");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
free(file_contents);
|
|
free(file_contents);
|