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

Singleton used to identify and parse BLE transmissions from MinewS1 BLE Temperature and Humidity sensors. Inherits from BLESensor.hpp. More...

#include <MinewS1.hpp>

Inheritance diagram for MinewS1:
Collaboration diagram for MinewS1:

Public Member Functions

bool advertisedDeviceIsS1 (NimBLEAdvertisedDevice *dev)
 Check if the advertised device is a Minew S1 sensor.
 
MQTTMailparseAdvertisedData (NimBLEAdvertisedDevice *dev)
 Retrieve data advertised by the device and save it if of interest.
 
float getTemp ()
 Read the temperature from the sensor data packet.
 
float getHumidity ()
 Read the humidity from the sensor data packet.
 
int getVoltage ()
 Read the sensor's battery voltage from the sensor data packet.
 
uint32_t timeUp ()
 Read the time the sensor has been running from the sensor data packet.
 
BLEAddress getMAC ()
 Read the sensor BLE MAC address from the sensor data packet.
 
std::string toJSON (double temp, double humidity)
 Convert temperature and humidity values to a JSON object string.
 
std::string getSensorType ()
 Get the string identifier for the sensor brand and model.
 

Static Public Member Functions

static MinewS1getInstance ()
 

Private Member Functions

struct { 
 
   uint8_t   id = 0x00 
 
   uint16_t   unknown = 0x0000 
 
   int16_t   temp = 0x0000 
 
   uint16_t   humidity = 0x0000 
 
   uint8_t   address [6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 
 
__attribute__ ((packed)) HT_Frame 
 HT data struct.
 
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 
 Info struct.
 
struct { 
 
   uint8_t   frameType = 0x00 
 
   uint8_t   version = 0x00 
 
   uint16_t   volt = 0x0000 
 
   int16_t   temp = 0x0000 
 
   uint32_t   advCount = 0x00000000 
 
   uint32_t   tmil = 0x00000000 
 
__attribute__ ((packed)) TLM_Frame 
 Eddystone struct.
 
struct { 
 
   uint8_t   manufacturerID [6] 
 
__attribute__ ((packed)) iBeacon_Frame 
 iBeacon struct
 

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 MinewS1 BLE Temperature and Humidity sensors. Inherits from BLESensor.hpp.

Member Function Documentation

◆ advertisedDeviceIsS1()

bool MinewS1::advertisedDeviceIsS1 ( NimBLEAdvertisedDevice dev)

Check if the advertised device is a Minew S1 sensor.

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

◆ getHumidity()

float MinewS1::getHumidity ( )

Read the humidity from the sensor data packet.

Convert uint16_t from HT_Frame to a float relative humidity value.

Returns
relative humidity as a float

◆ getSensorType()

std::string MinewS1::getSensorType ( )
virtual

Get the string identifier for the sensor brand and model.

Implements BLESensor.

◆ getTemp()

float MinewS1::getTemp ( )

Read the temperature from the sensor data packet.

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

Returns
temperature in celsius as a float

◆ getVoltage()

int MinewS1::getVoltage ( )

Read the sensor's battery voltage from the sensor data packet.

Gets the voltage.

Returns
the voltage in mV as an integer

◆ parseAdvertisedData()

MQTTMail * MinewS1::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 MinewS1::toJSON ( double  temp,
double  humidity 
)
virtual

Convert temperature and humidity values to a JSON object string.

Implements BLESensor.

Member Data Documentation

◆ s1_services

NimBLEUUID MinewS1::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: