drop location
This commit is contained in:
parent
eb87009b60
commit
89444476b8
@ -4,7 +4,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sha256.h>
|
#include <sha256.h>
|
||||||
|
|
||||||
#define CONFIG_MAGIC 0xdead0006
|
#define CONFIG_MAGIC 0xdead0007
|
||||||
|
|
||||||
typedef struct __attribute__((__packed__)) s_configBlock {
|
typedef struct __attribute__((__packed__)) s_configBlock {
|
||||||
uint32_t configMagic;
|
uint32_t configMagic;
|
||||||
@ -13,7 +13,6 @@ typedef struct __attribute__((__packed__)) s_configBlock {
|
|||||||
char ntpServer[48];
|
char ntpServer[48];
|
||||||
char deviceId[16];
|
char deviceId[16];
|
||||||
char sharedSecret[SHA256_BLOCK_SIZE];
|
char sharedSecret[SHA256_BLOCK_SIZE];
|
||||||
char location[48];
|
|
||||||
char sinkServer[48];
|
char sinkServer[48];
|
||||||
uint8_t filler[6];
|
uint8_t filler[6];
|
||||||
} t_configBlock;
|
} t_configBlock;
|
||||||
|
@ -13,7 +13,6 @@ typedef struct __attribute__((__packed__)) {
|
|||||||
#define SECONDS_PER_MINUTE 60
|
#define SECONDS_PER_MINUTE 60
|
||||||
typedef struct __attribute__((__packed__)) {
|
typedef struct __attribute__((__packed__)) {
|
||||||
char deviceId[sizeof(((t_configBlock*)0)->deviceId)];
|
char deviceId[sizeof(((t_configBlock*)0)->deviceId)];
|
||||||
char location[sizeof(((t_configBlock*)0)->location)];
|
|
||||||
uint8_t hash[SHA256_BLOCK_SIZE];
|
uint8_t hash[SHA256_BLOCK_SIZE];
|
||||||
uint8_t done;
|
uint8_t done;
|
||||||
t_event events[SECONDS_PER_MINUTE];
|
t_event events[SECONDS_PER_MINUTE];
|
||||||
|
@ -14,7 +14,6 @@ t_configBlock defaultConfigBlock = {
|
|||||||
.ntpServer = "0.de.pool.ntp.org",
|
.ntpServer = "0.de.pool.ntp.org",
|
||||||
.deviceId = "MainsCnt01",
|
.deviceId = "MainsCnt01",
|
||||||
.sharedSecret = "sharedSecretGanzGeheim",
|
.sharedSecret = "sharedSecretGanzGeheim",
|
||||||
.location = "Essen, DE",
|
|
||||||
.sinkServer = "laborpc",
|
.sinkServer = "laborpc",
|
||||||
.filler = { 0 }
|
.filler = { 0 }
|
||||||
};
|
};
|
||||||
@ -54,6 +53,5 @@ void configInit() {
|
|||||||
coloredMsg(LOG_BLUE, "cfg ci ntp server: %s", mainConfigBlock.ntpServer);
|
coloredMsg(LOG_BLUE, "cfg ci ntp server: %s", mainConfigBlock.ntpServer);
|
||||||
coloredMsg(LOG_BLUE, "cfg ci deviceId: %s", mainConfigBlock.deviceId);
|
coloredMsg(LOG_BLUE, "cfg ci deviceId: %s", mainConfigBlock.deviceId);
|
||||||
coloredMsg(LOG_BLUE, "cfg ci sharedSecret: %s", mainConfigBlock.sharedSecret);
|
coloredMsg(LOG_BLUE, "cfg ci sharedSecret: %s", mainConfigBlock.sharedSecret);
|
||||||
coloredMsg(LOG_BLUE, "cfg ci location: %s", mainConfigBlock.location);
|
|
||||||
coloredMsg(LOG_BLUE, "cfg ci sink server: %s", mainConfigBlock.sinkServer);
|
coloredMsg(LOG_BLUE, "cfg ci sink server: %s", mainConfigBlock.sinkServer);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ static bool showConfigCmd(uint8_t argc, char **args) {
|
|||||||
sendFormatString("NTP Server: %s\n\r", configBlock.ntpServer);
|
sendFormatString("NTP Server: %s\n\r", configBlock.ntpServer);
|
||||||
sendFormatString("deviceId: %s\n\r", configBlock.deviceId);
|
sendFormatString("deviceId: %s\n\r", configBlock.deviceId);
|
||||||
sendFormatString("sharedSecret: (will not be displayed)\n\r");
|
sendFormatString("sharedSecret: (will not be displayed)\n\r");
|
||||||
sendFormatString("Location: %s\n\r", configBlock.location);
|
|
||||||
|
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
@ -102,12 +101,6 @@ static bool setSharedSecretCmd(uint8_t argc, char **args) {
|
|||||||
sizeof(((t_configBlock*)0)->sharedSecret));
|
sizeof(((t_configBlock*)0)->sharedSecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool setLocationCmd(uint8_t argc, char **args) {
|
|
||||||
return setStringParameterCmd(argc, args,
|
|
||||||
offsetof(t_configBlock, location),
|
|
||||||
sizeof(((t_configBlock*)0)->location));
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool setSinkServerCmd(uint8_t argc, char **args) {
|
static bool setSinkServerCmd(uint8_t argc, char **args) {
|
||||||
return setStringParameterCmd(argc, args,
|
return setStringParameterCmd(argc, args,
|
||||||
offsetof(t_configBlock, sinkServer),
|
offsetof(t_configBlock, sinkServer),
|
||||||
@ -132,10 +125,6 @@ const static cmd_t SET_COMMANDS[] = {
|
|||||||
.help = \
|
.help = \
|
||||||
"sharedsecret ......................... Shared secret\n\r"
|
"sharedsecret ......................... Shared secret\n\r"
|
||||||
},
|
},
|
||||||
{ .name = "location", .cmdFunc = setLocationCmd,
|
|
||||||
.help = \
|
|
||||||
"location ............................. Location of this device\n\r"
|
|
||||||
},
|
|
||||||
{ .name = "sinkserver", .cmdFunc = setSinkServerCmd,
|
{ .name = "sinkserver", .cmdFunc = setSinkServerCmd,
|
||||||
.help = \
|
.help = \
|
||||||
"sinkserver ........................... Name of the sink server\n\r"
|
"sinkserver ........................... Name of the sink server\n\r"
|
||||||
|
@ -70,8 +70,6 @@ void counterMinuteTick(void *handle) {
|
|||||||
coloredMsg(LOG_BLUE, "cmt, buffer %d is done, handle it", minuteBufferIdx);
|
coloredMsg(LOG_BLUE, "cmt, buffer %d is done, handle it", minuteBufferIdx);
|
||||||
memset(minuteBuffer->s.deviceId, 0, sizeof(minuteBuffer->s.deviceId));
|
memset(minuteBuffer->s.deviceId, 0, sizeof(minuteBuffer->s.deviceId));
|
||||||
strcpy(minuteBuffer->s.deviceId, config->deviceId);
|
strcpy(minuteBuffer->s.deviceId, config->deviceId);
|
||||||
memset(minuteBuffer->s.location, 0, sizeof(minuteBuffer->s.location));
|
|
||||||
strcpy(minuteBuffer->s.location, config->location);
|
|
||||||
|
|
||||||
memcpy(minuteBuffer->s.hash, config->sharedSecret, SHA256_BLOCK_SIZE);
|
memcpy(minuteBuffer->s.hash, config->sharedSecret, SHA256_BLOCK_SIZE);
|
||||||
SHA256_CTX ctx;
|
SHA256_CTX ctx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user