configuration
This commit is contained in:
parent
bc15e23f10
commit
518abe4e1c
@ -18,9 +18,22 @@ typedef struct __attribute__((__packed__)) s_configBlock {
|
|||||||
char statusTopic[64];
|
char statusTopic[64];
|
||||||
char mbusDataTopic[64];
|
char mbusDataTopic[64];
|
||||||
char syslogServerName[64];
|
char syslogServerName[64];
|
||||||
uint8_t filler[2];
|
uint8_t numOfDeviceBlocks;
|
||||||
|
uint8_t filler[1];
|
||||||
} t_configBlock;
|
} t_configBlock;
|
||||||
|
|
||||||
|
|
||||||
|
#define MBUSDEVICE_NAMELENGTH 16
|
||||||
|
#define MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS 4
|
||||||
|
|
||||||
|
typedef struct __attribute__((__packed__)) s_deviceBlock {
|
||||||
|
char deviceName[MBUSDEVICE_NAMELENGTH];
|
||||||
|
uint8_t address;
|
||||||
|
int8_t consideredField[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
||||||
|
int32_t period;
|
||||||
|
uint8_t filler[7];
|
||||||
|
} t_deviceBlock;
|
||||||
|
|
||||||
void configInit();
|
void configInit();
|
||||||
t_configBlock* getConfig();
|
t_configBlock* getConfig();
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@
|
|||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#define MBUSDEVICE_NAMELENGTH 24
|
|
||||||
#define MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS 4
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char deviceName[MBUSDEVICE_NAMELENGTH];
|
char deviceName[MBUSDEVICE_NAMELENGTH];
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
|
@ -16,7 +16,8 @@ t_configBlock defaultConfigBlock = {
|
|||||||
.statusTopic = "IoT/MBGW3/Status",
|
.statusTopic = "IoT/MBGW3/Status",
|
||||||
.mbusDataTopic = "IoT/MBGW3/Measurement",
|
.mbusDataTopic = "IoT/MBGW3/Measurement",
|
||||||
.syslogServerName = "syslogserver",
|
.syslogServerName = "syslogserver",
|
||||||
.filler = { 0, 0 }
|
.numOfDeviceBlocks = 0,
|
||||||
|
.filler = { 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -58,4 +59,5 @@ void configInit() {
|
|||||||
coloredMsg(LOG_BLUE, false, "cfg ci statusTopic: %s", mainConfigBlock.statusTopic);
|
coloredMsg(LOG_BLUE, false, "cfg ci statusTopic: %s", mainConfigBlock.statusTopic);
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci mbusDataTopic: %s", mainConfigBlock.mbusDataTopic);
|
coloredMsg(LOG_BLUE, false, "cfg ci mbusDataTopic: %s", mainConfigBlock.mbusDataTopic);
|
||||||
coloredMsg(LOG_BLUE, false, "cfg ci syslog server: %s", mainConfigBlock.syslogServerName);
|
coloredMsg(LOG_BLUE, false, "cfg ci syslog server: %s", mainConfigBlock.syslogServerName);
|
||||||
|
coloredMsg(LOG_BLUE, false, "cfg ci device block cnt: %d", mainConfigBlock.numOfDeviceBlocks);
|
||||||
}
|
}
|
@ -610,7 +610,7 @@ static e_mbusCommRequestResult mbusCommRequest(t_mbusDevice *mbusDevice) {
|
|||||||
static uint8_t numOfDevices = 8;
|
static uint8_t numOfDevices = 8;
|
||||||
static t_mbusDevice devices[] = {
|
static t_mbusDevice devices[] = {
|
||||||
{
|
{
|
||||||
.deviceName = "TotalPower",
|
.deviceName = "Total",
|
||||||
.address = 80,
|
.address = 80,
|
||||||
.consideredField = { 0, 17, -1, -1 },
|
.consideredField = { 0, 17, -1, -1 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -621,7 +621,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "ComputerPower",
|
.deviceName = "Computer",
|
||||||
.address = 85,
|
.address = 85,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -632,7 +632,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "DryerPower",
|
.deviceName = "Dryer",
|
||||||
.address = 81,
|
.address = 81,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -643,7 +643,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "LaundryPower",
|
.deviceName = "Laundry",
|
||||||
.address = 82,
|
.address = 82,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -654,7 +654,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "DishwasherPower",
|
.deviceName = "Dishwasher",
|
||||||
.address = 83,
|
.address = 83,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -665,7 +665,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "LightPower",
|
.deviceName = "Light",
|
||||||
.address = 84,
|
.address = 84,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -676,7 +676,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "FreezerPower",
|
.deviceName = "Freezer",
|
||||||
.address = 86,
|
.address = 86,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
@ -687,7 +687,7 @@ static t_mbusDevice devices[] = {
|
|||||||
.active = true
|
.active = true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.deviceName = "FridgePower",
|
.deviceName = "Fridge",
|
||||||
.address = 87,
|
.address = 87,
|
||||||
.consideredField = { 0, 4, 2, 3 },
|
.consideredField = { 0, 4, 2, 3 },
|
||||||
.requests = 0,
|
.requests = 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user