Data Gator
Hardware and software documentation for the Data Gator project.
Loading...
Searching...
No Matches
KKMK6P Class Reference

Singleton used to identify and parse BLE transmissions from KKMK6P BLE Temperature and Humidity sensors. More...

#include <KKM_K6P.hpp>

Inheritance diagram for KKMK6P:
Collaboration diagram for KKMK6P:

Public Member Functions

bool advertisedDeviceIsK6P (NimBLEAdvertisedDevice *)
 Check if the advertised device is a KKMK6P sensor.
 
MQTTMailparseAdvertisedData (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 KKMK6PgetInstance ()
 

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

- Public Attributes inherited from BLESensor
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.
 

Detailed Description

Singleton used to identify and parse BLE transmissions from KKMK6P BLE Temperature and Humidity sensors.

Member Function Documentation

◆ advertisedDeviceIsK6P()

bool KKMK6P::advertisedDeviceIsK6P ( NimBLEAdvertisedDevice dev)

Check if the advertised device is a KKMK6P sensor.

Parameters
[in]devThe advertised data received
Returns
true if the device has a service UUID that is recognized, false otherwise

◆ getHumidity()

float KKMK6P::getHumidity ( )

Convert uint16_t from HT_Frame to a float relative humidity value.

Returns
relative humidity as a float

◆ getSensorType()

std::string KKMK6P::getSensorType ( )
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.

◆ getTemp()

float KKMK6P::getTemp ( )

Convert the uint16_t in HT_Frame to a float temperature value in Celsius.

Returns
temperature in celsius as a float

◆ getVoltage()

int KKMK6P::getVoltage ( )

Gets the voltage.

Returns
the voltage in mV as an integer

◆ parseAdvertisedData()

MQTTMail * KKMK6P::parseAdvertisedData ( NimBLEAdvertisedDevice dev)

Retrieve data advertised by the device and save it if of interest.

Parameters
[in]devdevice and data that were broadcast
[in]debugflag noting whether serial debug summary is desired

◆ toJSON()

std::string KKMK6P::toJSON ( double  temp,
double  humidity 
)
virtual

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.

Parameters
[in]tempThe temperature as a double in Celsius
[in]humidityThe humidity as a double in relative humidity

Implements BLESensor.

Member Data Documentation

◆ s1_services

NimBLEUUID KKMK6P::s1_services[3]
private
Initial value:
= {NimBLEUUID("0000ffe1-0000-1000-8000-00805f9b34fb"),
NimBLEUUID("0000fff1-0000-1000-8000-00805f9b34fb"),
NimBLEUUID("0000feaa-0000-1000-8000-00805f9b34fb")}
int reset_count
number of resets retrieved for NVS
Definition scheduler.hpp:31

The documentation for this class was generated from the following files: