diff --git a/inc/powermon.h b/inc/powermon.h index 3ba963e..91a4d13 100644 --- a/inc/powermon.h +++ b/inc/powermon.h @@ -39,7 +39,7 @@ #define ENCRYPTION_KEY_SIZE 32 #define MAX_BLE_NAME_LENGTH 8 -#define MAX_NAME_LENGTH 32 +#define MAX_NAME_LENGTH 32 #define MAX_TIMER_NAME_LENGTH 16 #define MAX_TIMER_COUNT 16 @@ -193,6 +193,7 @@ { uint8_t ssid_length; uint8_t ssid[MAX_WIFI_SSID_SIZE]; + uint8_t mac[6]; uint8_t channel; struct diff --git a/inc/powermon_log.h b/inc/powermon_log.h index 1598638..b3b230b 100644 --- a/inc/powermon_log.h +++ b/inc/powermon_log.h @@ -32,12 +32,6 @@ class PowermonLogFile { public: - enum Version - { - VER_FAMILY_MASK = 0xF0, - VER_POWERMON_WIFI_5W = 0x00, - }; - struct Sample { uint32_t time; @@ -50,70 +44,15 @@ uint8_t ps; }; - static uint32_t decode(const std::vector &data, std::vector &samples); - -private: - enum Flags - { - POWER_VOLTAGE_SOURCE = (1 << 0) - }; - - enum Mask - { - V1 = (1 << 0), - V2 = (1 << 1), - V3 = (1 << 2), - V4 = (1 << 3), - V5 = (1 << 4), - V6 = (1 << 5), - - I1 = (1 << 6), - I2 = (1 << 7), - - P1 = (1 << 8), - P2 = (1 << 9), - - T1 = (1 << 10), - T2 = (1 << 11), - - SOC1 = (1 << 12), - SOC2 = (1 << 13), - - PS1 = (1 << 14), - PS2 = (1 << 15), - - VOLTAGE_SOURCE = (1 << 31) - }; - - struct Header - { - uint8_t magic[4]; - - uint8_t version; - uint8_t mode; - uint16_t reserved0; - - uint32_t time; - - uint32_t mask; - uint32_t flags; - }; - - static uint32_t getSamplePeriodInSeconds(uint8_t mode) - { - switch(mode) - { - case PowermonConfig::LOG_MODE_1_SEC: return 1; - case PowermonConfig::LOG_MODE_2_SEC: return 2; - case PowermonConfig::LOG_MODE_5_SEC: return 5; - case PowermonConfig::LOG_MODE_10_SEC: return 10; - case PowermonConfig::LOG_MODE_20_SEC: return 20; - case PowermonConfig::LOG_MODE_30_SEC: return 30; - case PowermonConfig::LOG_MODE_60_SEC: return 60; - } - - return 0; - } + /** + * \brief Decode a log file + * \param data Vector of uint8_t containing the raw log data file + * \param samples Vector of Sample where the data decoded from the log file will be appended + * \param tz_index The time zone index as stored in the device configuration + + * \return Number of samples successfully decoded. + */ + static uint32_t decode(const std::vector &data, std::vector &samples, int32_t tz_index); }; #endif diff --git a/inc/powermon_schedule.h b/inc/powermon_schedule.h index 614bc01..138a381 100644 --- a/inc/powermon_schedule.h +++ b/inc/powermon_schedule.h @@ -57,8 +57,8 @@ bool isRepeatDOM(void) const; void setRepeatDOM(void); - uint8_t getRepeat(void) const; - void setRepeat(uint8_t value); + uint32_t getRepeat(void) const; + void setRepeat(uint32_t value); private: uint8_t mRawSchedule[24]; diff --git a/powermon_lib.a b/powermon_lib.a index 54487aa..e9c1bbf 100644 --- a/powermon_lib.a +++ b/powermon_lib.a Binary files differ diff --git a/powermon_lib.lib b/powermon_lib.lib index cf1be75..dd8d005 100644 --- a/powermon_lib.lib +++ b/powermon_lib.lib Binary files differ diff --git a/powermon_lib_pic.a b/powermon_lib_pic.a index fc8fc41..ced2962 100644 --- a/powermon_lib_pic.a +++ b/powermon_lib_pic.a Binary files differ diff --git a/powermon_lib_rpi64.a b/powermon_lib_rpi64.a index acca91b..648ee0f 100644 --- a/powermon_lib_rpi64.a +++ b/powermon_lib_rpi64.a Binary files differ diff --git a/powermon_lib_rpi64_pic.a b/powermon_lib_rpi64_pic.a index 9dac950..4c06cb7 100644 --- a/powermon_lib_rpi64_pic.a +++ b/powermon_lib_rpi64_pic.a Binary files differ diff --git a/powermon_libd.lib b/powermon_libd.lib index 10f2b2a..2aa2568 100644 --- a/powermon_libd.lib +++ b/powermon_libd.lib Binary files differ