![]() |
Data Gator
Hardware and software documentation for the Data Gator project.
|
Singleton used to identify and parse BLE transmissions from KKMK6P BLE Temperature and Humidity sensors. More...
#include <KKM_K6P.hpp>
Public Member Functions | |
bool | advertisedDeviceIsK6P (NimBLEAdvertisedDevice *) |
Check if the advertised device is a KKMK6P sensor. | |
MQTTMail * | parseAdvertisedData (NimBLEAdvertisedDevice *dev) |
Retrieve data advertised by the device and save it if of interest. | |
float | getTemp () |
Convert the uint16_t in HT_Frame to a float temperature value in Celsius. | |
float | getHumidity () |
Convert uint16_t from HT_Frame to a float relative humidity value. | |
int | getVoltage () |
Gets the voltage. | |
uint32_t | timeUp () |
BLEAddress | getMAC () |
std::string | toJSON (double temp, double humidity) |
convert data values to JSON string object | |
std::string | getSensorType () |
get the sensor type as a string | |
Static Public Member Functions | |
static KKMK6P & | getInstance () |
Private Member Functions | ||
struct { | ||
uint8_t id = 0x00 | ||
uint16_t unknown = 0x0000 | ||
uint16_t temp = 0x0000 | ||
uint16_t humidity = 0x0000 | ||
uint8_t address [6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} | ||
} | __attribute__ ((packed)) HT_Frame | |
struct { | ||
uint8_t id = 0x00 | ||
uint16_t unknown = 0x0000 | ||
uint8_t address [6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} | ||
char name [2] = {0x00, 0x00} | ||
} | __attribute__ ((packed)) INFO_Frame | |
struct { | ||
uint8_t frameType = 0x00 | ||
uint8_t version = 0x00 | ||
uint8_t sensor_mask = 0x00 | ||
uint16_t volt = 0x0000 | ||
ufloat88 temp | ||
ufloat88 humidity | ||
ufloat88 accX | ||
ufloat88 accY | ||
ufloat88 accZ | ||
} | __attribute__ ((packed)) TLM_Frame | |
struct { | ||
uint8_t manufacturerID [6] | ||
} | __attribute__ ((packed)) iBeacon_Frame | |
Private Attributes | |
int | serviceCount = 3 |
NimBLEUUID | s1_services [3] |
Additional Inherited Members | |
![]() | |
std::string | name |
Name of the sensor... not unique, generally something generic such as brand and model. | |
std::string | mac_address |
Mac address of sensor BLE for unique ID. | |
Singleton used to identify and parse BLE transmissions from KKMK6P BLE Temperature and Humidity sensors.
bool KKMK6P::advertisedDeviceIsK6P | ( | NimBLEAdvertisedDevice * | dev | ) |
Check if the advertised device is a KKMK6P sensor.
[in] | dev | The advertised data received |
float KKMK6P::getHumidity | ( | ) |
Convert uint16_t from HT_Frame to a float relative humidity value.
|
virtual |
get the sensor type as a string
Returns a string which identifies the sensor. Usually contains both the generic identifier constructed of brand and model, and the unique MAC address.
Implements BLESensor.
float KKMK6P::getTemp | ( | ) |
Convert the uint16_t in HT_Frame to a float temperature value in Celsius.
int KKMK6P::getVoltage | ( | ) |
Gets the voltage.
MQTTMail * KKMK6P::parseAdvertisedData | ( | NimBLEAdvertisedDevice * | dev | ) |
Retrieve data advertised by the device and save it if of interest.
[in] | dev | device and data that were broadcast |
[in] | debug | flag noting whether serial debug summary is desired |
convert data values to JSON string object
Constructs as JSON formatted string from the data types which are available to be read from the sensor. Defaults to temperature and humidity.
[in] | temp | The temperature as a double in Celsius |
[in] | humidity | The humidity as a double in relative humidity |
Implements BLESensor.
|
private |