Kallisto Linux API
Library for interacting with Kallisto devices
bme280_barometer.hpp
Go to the documentation of this file.
1 
42 #ifndef BME280_BAROMETER_HPP
43 #define BME280_BAROMETER_HPP
44 
45 #include <string>
46 #include <vector>
47 #include <memory>
48 #include <chrono>
49 
50 #include "../kallisto_sensor.hpp"
51 
52 namespace kallisto {
53 namespace hardware {
54 
55 class Bme280Barometer : public KallistoSensor {
56 private:
58  static const std::vector<unsigned char> IDENTIFIERS; //Holds the available instances identifiers
60  static const std::vector<std::string> SERVICE_UUIDS; //Holds the service UUIDS that holds the sensor characteristics
62  static const std::vector<std::string> CONFIGURATION_CHAR_UUIDS; //Holds the configuration characteristic UUIDs
64  static const std::vector<std::string> DATA_CHAR_UUIDS; //Holds the data characteristic UUIDs
66  static const unsigned char MANUFACTURER_DATA_TYPE; //Type used in manufacturer data to identify a sensor of this type
68  static const unsigned int BYTES_PER_SAMPLE; //Self explanatory
69 
70  //Constants to populate the sensor data
72  static const std::string NAME;
74  static const std::string VENDOR;
76  static const std::string STRING_TYPE;
78  static const float MAX_RANGE;
80  static const float RESOLUTION;
82  static const float POWER;
84  static const std::chrono::microseconds MIN_DELAY;
86  static const std::chrono::microseconds MAX_DELAY;
87 
88 protected:
92  Bme280Barometer(std::string name, std::string address, std::string vendor, unsigned int version, SensorType type, std::string string_type,
93  ReportingMode reporting_mode, unsigned int identifier, float max_range, float resolution, float power, std::chrono::microseconds min_delay,
94  std::chrono::microseconds max_delay, util::Executor& event_dispatcher, bluetooth::BluetoothDispatcher& bluetooth_dispatcher, TimeSynchronizer* sensor_synchronizer);
95 
103  std::vector<unsigned char> parseConfiguration(bool enable, std::chrono::microseconds delay);
104 
111  std::vector<SensorEvent> parseData(const std::vector<unsigned char>& data);
112 
113 public:
118 
122  Bme280Barometer(Bme280Barometer const&) = delete;
123 
127  void operator=(Bme280Barometer const&) = delete;
128 
135  static bool isAvailable(unsigned int identifier, const std::map<uint16_t, std::vector<uint8_t> >& manufacturer_data);
136 
144  static bool isAvailable(unsigned int identifier, bluetooth::BluetoothDispatcher& bluetooth_dispatcher);
145 
155  static std::vector<std::unique_ptr<SensorImpl> > build(std::string address, util::Executor& event_dispatcher,
156  bluetooth::BluetoothDispatcher& bluetooth_dispatcher,
157  TimeSynchronizer& sensor_synchronizer,
158  const std::map<uint16_t, std::vector<uint8_t> >& manufacturer_data);
159 };
160 
161 } /* namespace hardware */
162 } /* namespace kallisto */
163 
164 #endif // BME280_BAROMETER_HPP
Definition: kallisto_sensor.hpp:58
Definition: time_synchronizer.hpp:56
Definition: bluetooth_adapter.hpp:52
static bool isAvailable(unsigned int identifier, const std::map< uint16_t, std::vector< uint8_t > > &manufacturer_data)
Definition: bme280_barometer.hpp:54
SensorType
Definition: sensor.hpp:60
Definition: bluetooth_dispatcher.hpp:57
static std::vector< std::unique_ptr< SensorImpl > > build(std::string address, util::Executor &event_dispatcher, bluetooth::BluetoothDispatcher &bluetooth_dispatcher, TimeSynchronizer &sensor_synchronizer, const std::map< uint16_t, std::vector< uint8_t > > &manufacturer_data)
Definition: executor.hpp:71
void operator=(Bme280Barometer const &)=delete
Bme280Barometer(std::string name, std::string address, std::string vendor, unsigned int version, SensorType type, std::string string_type, ReportingMode reporting_mode, unsigned int identifier, float max_range, float resolution, float power, std::chrono::microseconds min_delay, std::chrono::microseconds max_delay, util::Executor &event_dispatcher, bluetooth::BluetoothDispatcher &bluetooth_dispatcher, TimeSynchronizer *sensor_synchronizer)
std::vector< unsigned char > parseConfiguration(bool enable, std::chrono::microseconds delay)
std::vector< SensorEvent > parseData(const std::vector< unsigned char > &data)
ReportingMode
Definition: sensor.hpp:126