diff --git a/cube/User/Src/cmdHandler.c b/cube/User/Src/cmdHandler.c index 4f3b0e3..6bf45a8 100644 --- a/cube/User/Src/cmdHandler.c +++ b/cube/User/Src/cmdHandler.c @@ -14,7 +14,8 @@ #include #include #include - +#include +#include extern const uint8_t CMD_SOCK; @@ -122,7 +123,42 @@ static bool loopEnableCmd(uint8_t argc, char **args) { static bool showConfigCmd(uint8_t argc, char **args) { bool retCode = true; - sendString("This is the configuration output"); + t_configBlock configBlock; + eepromReadConfigBlock(&configBlock); + sendFormatString("configMagic: %lx\n\r", configBlock.configMagic); + sendFormatString("deviceName: %s\n\r", configBlock.deviceName); + sendFormatString("MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n\r", configBlock.macAddress[0], + configBlock.macAddress[1], + configBlock.macAddress[2], + configBlock.macAddress[3], + configBlock.macAddress[4], + configBlock.macAddress[5]); + sendFormatString("frontend threshold: %ld\n\r", configBlock.frontendThreshold); + sendFormatString("broker: %s\n\r", configBlock.brokerName); + sendFormatString("watchdogTopic: %s\n\r", configBlock.watchdogTopic); + sendFormatString("startupTopic: %s\n\r", configBlock.startupTopic); + sendFormatString("statusTopic: %s\n\r", configBlock.statusTopic); + sendFormatString("mbusDataTopic: %s\n\r", configBlock.mbusDataTopic); + sendFormatString("syslog server: %s\n\r", configBlock.syslogServerName); + sendFormatString("device block cnt: %d\n\r", configBlock.numOfDeviceBlocks); + + for (uint8_t i = 0; i < configBlock.numOfDeviceBlocks; i++) { + t_deviceBlock tmpDeviceBlock; + eepromReadDeviceBlock(i, &tmpDeviceBlock); + if (tmpDeviceBlock.deviceMagic == DEVICE_MAGIC) { + sendFormatString("device %d: \n\r", i); + sendFormatString(" Name: %s, Address: %d, Period: %d\n\r", + tmpDeviceBlock.deviceName, tmpDeviceBlock.address, tmpDeviceBlock.period); + sendFormatString(" Considered Fields: %d %d %d %d\n\r", + tmpDeviceBlock.consideredField[0], + tmpDeviceBlock.consideredField[1], + tmpDeviceBlock.consideredField[2], + tmpDeviceBlock.consideredField[3]); + if (tmpDeviceBlock.deviceMagic != DEVICE_MAGIC) { + sendString(" DEVICE MAGIC DOES NOT MATCH\n\r"); + } + } + } return retCode; }