libpowermon 1.00
PowerMon Access Library
Loading...
Searching...
No Matches
powermon_scanner.h
1/* Copyright (C) 2020 - 2024, Thornwave Labs Inc
2 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
5 * documentation files (the “Software”), to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
7 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 * Attribution shall be given to Thornwave Labs Inc. and shall be made visible to the final user.
11 *
12 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
13 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16*/
17
18#ifndef _POWERMON_SCANNER_H
19#define _POWERMON_SCANNER_H
20
21
22#include <stdint.h>
23#include <string>
24#include <functional>
25
26
31{
32public:
37 {
38 uint64_t serial;
39 uint64_t address;
40
41 uint32_t time;
42 uint32_t flags;
43
44 float voltage1;
45 float voltage2;
46 float current;
47 float power;
48
49 float coulomb_meter;
50 float power_meter;
51
52 float temperature;
53
54 std::string name;
55
56 uint16_t firmware_version_bcd;
57 uint8_t hardware_revision_bcd;
58
59 Powermon::PowerStatus power_status;
60
61 uint8_t soc;
62 uint16_t runtime;
63
64 int16_t rssi;
65
66 bool isExternalTemperature(void) const;
67 };
68
69
75 virtual ~PowermonScanner();
76
81 virtual void setCallback(const std::function<void(const Advertisment&)> &cb) = 0;
82
86 virtual void startWifiScan(void) = 0;
87
91 virtual void stopWifiScan(void) = 0;
92
96 virtual void startBleScan(void) = 0;
97
101 virtual void stopBleScan(void) = 0;
102};
103
104
105#endif
PowerStatus
PowerStatus is an enumeration of all possible power states.
Definition powermon.h:126
PowermonScanner offers support for scanning for PowerMon advertisments. Both BLE and WiFi PowerMon de...
Definition powermon_scanner.h:31
virtual void stopWifiScan(void)=0
Stops scanning for WiFi device advertisments.
virtual void stopBleScan(void)=0
virtual void startWifiScan(void)=0
Starts scanning for WiFi device advertisments.
static PowermonScanner * createInstance(void)
Creates an instance of the PowermonScanner class.
virtual void startBleScan(void)=0
virtual void setCallback(const std::function< void(const Advertisment &)> &cb)=0
Sets the callback to be called by the Powermon scanner when a new advertisment has been received.
Advertisment is a structure representing an advertisment packet received from the PowerMon device.
Definition powermon_scanner.h:37