15#include <../../include/BLESensor.hpp>
16#include <NimBLEAdvertisedDevice.h>
17#include <MQTTMailer.hpp>
19#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))
20#define ENDIAN_CHANGE_U32(x) ((((x)&0xFF000000)>>24) + (((x)&0x00FF0000)>>8)) + ((((x)&0xFF00)<<8) + (((x)&0xFF)<<24))
67 std::string
toJSON(
double temp,
double humidity);
78 NimBLEUUID(
"0000fff1-0000-1000-8000-00805f9b34fb"),
79 NimBLEUUID(
"0000feaa-0000-1000-8000-00805f9b34fb")};
89 uint8_t address[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
110 uint8_t address[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
111 char name[2] = {0x00, 0x00};
118 snprintf(
res,
size,
"%02x:%02x:%02x:%02x:%02x:%02x", address[5], address[4], address[3], address[2], address[1], address[0]);
121 std::stringstream
ss;
122 ss <<
"MAC: " <<
ret <<
", "
123 <<
"Name: "<< name[0] << name[1];
143 std::stringstream
ss;
144 ss <<
"V" << (
int)version <<
".0, "
148 << ENDIAN_CHANGE_U32(tmil) <<
" seconds";
std::string toString()
Convert struct members upper and lower to a string double value.
Definition KKM_K6P.hpp:8
#define ENDIAN_CHANGE_U16(x)
< Converts endianess for 16 bit integers
Definition KKM_K6P.hpp:20
const bool USB_DEBUG
USB serial debugging enabled.
Definition main.cpp:62
Defines a bluetooth low energy (BLE) interface for integrating new sensors into the DG firmware.
Definition BLESensor.hpp:20
An object that stores data from which a topic and message can be extracted for publishing to an MQTT ...
Definition MQTTMailer.hpp:37
Singleton used to identify and parse BLE transmissions from MinewS1 BLE Temperature and Humidity sens...
Definition MinewS1.hpp:27
float getTemp()
Read the temperature from the sensor data packet.
Definition MinewS1.cpp:131
std::string getSensorType()
Get the string identifier for the sensor brand and model.
Definition MinewS1.cpp:171
BLEAddress getMAC()
Read the sensor BLE MAC address from the sensor data packet.
Definition MinewS1.cpp:161
MQTTMail * parseAdvertisedData(NimBLEAdvertisedDevice *dev)
Retrieve data advertised by the device and save it if of interest.
Definition MinewS1.cpp:33
int getVoltage()
Read the sensor's battery voltage from the sensor data packet.
Definition MinewS1.cpp:152
float getHumidity()
Read the humidity from the sensor data packet.
Definition MinewS1.cpp:143
std::string toJSON(double temp, double humidity)
Convert temperature and humidity values to a JSON object string.
Definition MinewS1.cpp:175
struct MinewS1::@4 __attribute__((packed)) HT_Frame
HT data struct.
bool advertisedDeviceIsS1(NimBLEAdvertisedDevice *dev)
Check if the advertised device is a Minew S1 sensor.
Definition MinewS1.cpp:11
uint32_t timeUp()
Read the time the sensor has been running from the sensor data packet.
Definition MinewS1.cpp:156
int reset_count
number of resets retrieved for NVS
Definition scheduler.hpp:31