Output messages

Asset Tracker Template

tags
Asset Tracker Template
  • POWER_MODULE_READY: Published when the module has completed initialization and entered STATE_RUNNING.

  • POWER_BATTERY_PERCENTAGE_SAMPLE_RESPONSE: Contains the latest battery percentage, voltage, charging status and a timestamp.

The power message structure is defined in power.h:

struct power_msg {
    enum power_msg_type type;

    /** Current charge of the battery in percentage. */
    double percentage;

    /** True if the battery is charging, false otherwise. */
    bool charging;

    /** Voltage in volts. */
    double voltage;

    /** Timestamp when the sample was taken in milliseconds.
     *  Either Unix time (if the system clock was synchronized) or uptime.
     *  Only valid for POWER_BATTERY_PERCENTAGE_SAMPLE_RESPONSE messages.
     */
    int64_t timestamp;
};