#ifndef _CONFIG_H_
#define _CONFIG_H_

#include <stdint.h>
#include <sha256.h>

#define CONFIG_MAGIC 0xdead0008

typedef struct __attribute__((__packed__)) s_configBlock {
    uint32_t configMagic;
    char deviceName[16];
    char ntpServer[48];
    char deviceId[16];
    char sharedSecret[SHA256_BLOCK_SIZE];
    char sinkServer[48];
    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];
} t_configBlock;


void configInit();
t_configBlock* getConfig();

#endif /* _CONFIG_H_ */