This commit is contained in:
2021-02-16 13:08:39 +01:00
20 changed files with 324 additions and 803 deletions

View File

@ -1,9 +0,0 @@
#ifndef _CMDHANDLER_H_
#define _CMDHANDLER_H_
#include <stdint.h>
void cmdHandlerInit();
#endif /* _CMDHANDLER_H_ */

View File

@ -1,23 +0,0 @@
#ifndef _CMDHELPER_H_
#define _CMDHELPER_H_
#include <stdint.h>
#include <stdbool.h>
typedef bool (*cmdFunc_t)(uint8_t argc, char **args);
typedef struct {
char name[24];
char help[512];
cmdFunc_t cmdFunc;
} cmd_t;
void sendString(const char *buf);
bool sendFormatString(const char *format, ...);
const cmd_t *getRegularCommands();
const cmd_t *getAdminCommands();
const cmd_t *getConfigCommands();
#endif /* _CMDHELPER_H_ */

View File

@ -13,8 +13,21 @@ typedef struct __attribute__((__packed__)) s_configBlock {
char deviceId[16];
char sharedSecret[SHA256_BLOCK_SIZE];
char sinkServer[48];
<<<<<<< HEAD
uint8_t macAddress[6];
uint8_t filler[22];
=======
union {
struct {
uint8_t macAddress[6];
} lan;
struct {
char ssid[48];
char key[65]; // the actual key may have up to 64 chars and has to end with a \0
} wifi;
} networkspecific;
uint8_t filler[11];
>>>>>>> network_abstraction_layer
} t_configBlock;

View File

@ -0,0 +1,20 @@
#ifndef _NETWORK_ABSTRACTION_LAYER_H_
#define _NETWORK_ABSTRACTION_LAYER_H_
#include <stdint.h>
#include <stdbool.h>
#include <sinkStruct.h>
typedef struct {
uint64_t seconds;
uint32_t missedUpdates;
bool valid;
} t_seconds;
void networkInit();
t_seconds* networkGetSeconds();
int8_t networkSendMinuteBuffer(t_minuteBuffer *minuteBuffer);
#endif /* _NETWORK_ABSTRACTION_LAYER_H_ */

View File

@ -0,0 +1,10 @@
#ifndef _NETWORK_ABSTRACTION_LAYER_IMPL_H_
#define _NETWORK_ABSTRACTION_LAYER_IMPL_H_
#include <stdint.h>
uint64_t networkSntpQuery();
int8_t networkUdpSend(char *hostname, uint16_t port, uint8_t *buf, uint16_t bufLen);
void networkImplInit();
#endif /* _NETWORK_ABSTRACTION_LAYER_IMPL_H_ */

View File

@ -5,18 +5,12 @@
#include <stdint.h>
typedef struct {
uint64_t seconds;
uint32_t missedUpdates;
bool valid;
} t_seconds;
int wizInit();
bool isNetworkAvailable();
uint8_t* wizGetIPAddress();
bool wizDnsQuery(char *name, uint8_t *ip);
t_seconds* wizGetSeconds();
uint64_t wizSntpQuery();
#endif // _WIZHELPER_H_