libpowermon 1.11
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#include <powermon.h>
27
28
33{
34public:
39 {
40 uint64_t serial;
41 uint64_t address;
42
43 uint32_t time;
44 uint32_t flags;
45
46 float voltage1;
47 float voltage2;
48 float current;
49 float power;
50
51 float coulomb_meter;
52 float power_meter;
53
54 float temperature;
55
56 std::string name;
57
58 uint16_t firmware_version_bcd;
59 uint8_t hardware_revision_bcd;
60
61 Powermon::PowerStatus power_status;
62
63 uint8_t soc;
64 uint16_t runtime;
65
66 int16_t rssi;
67
68 bool isExternalTemperature(void) const;
69 };
70
71
77 virtual ~PowermonScanner();
78
83 virtual void setCallback(const std::function<void(const Advertisement&)> &cb) = 0;
84
88 virtual void startWifiScan(void) = 0;
89
93 virtual void stopWifiScan(void) = 0;
94
98 virtual void startBleScan(void) = 0;
99
103 virtual void stopBleScan(void) = 0;
104};
105
106
107#endif
PowerStatus
PowerStatus is an enumeration of all possible power states.
Definition powermon.h:127
PowermonScanner offers support for scanning for PowerMon advertisements. Both BLE and WiFi PowerMon d...
Definition powermon_scanner.h:33
virtual void stopWifiScan(void)=0
Stops scanning for WiFi device advertisements.
virtual void stopBleScan(void)=0
virtual void startWifiScan(void)=0
Starts scanning for WiFi device advertisements.
static PowermonScanner * createInstance(void)
Creates an instance of the PowermonScanner class.
virtual void startBleScan(void)=0
virtual void setCallback(const std::function< void(const Advertisement &)> &cb)=0
Sets the callback to be called by the Powermon scanner when a new advertisement has been received.
Advertisement is a structure representing an advertisement packet received from the PowerMon device.
Definition powermon_scanner.h:39