Kallisto Linux API
Library for interacting with Kallisto devices
kallisto_sensor.hpp
Go to the documentation of this file.
1 
42 #ifndef KALLISTO_SENSOR_HPP
43 #define KALLISTO_SENSOR_HPP
44 
45 #include <string>
46 #include <chrono>
47 
48 #include "../../../../bluetooth/device/bluetooth_dispatcher.hpp"
49 #include "../sensor.hpp"
50 #include "../sensor_impl.hpp"
51 
52 namespace kallisto {
53 namespace hardware {
54 
59 class KallistoSensor : public SensorImpl, public bluetooth::BluetoothDispatcher::NotificationListener {
60 protected:
62  std::string m_service_uuid; //Holds the service UUID that holds the sensor characteristics
64  std::string m_configuration_char_uuid; //Holds the configuration characteristic UUID
66  std::string m_data_char_uuid; //Holds the data characteristic UUID
68  std::chrono::microseconds m_delay = std::chrono::microseconds(0);
70  InternalSensorEventListener m_listener; //Holder for the sensor callback
71 
75  KallistoSensor(std::string name, std::string address, std::string vendor, unsigned int version, SensorType type, std::string string_type,
76  ReportingMode reporting_mode, unsigned int identifier, float max_range, float resolution, float power, std::chrono::microseconds min_delay,
77  std::chrono::microseconds max_delay, util::Executor& event_dispatcher, bluetooth::BluetoothDispatcher& bluetooth_dispatcher, TimeSynchronizer* sensor_synchronizer,
78  std::string service_uuid, std::string configuration_char_uuid, std::string data_char_uuid);
79 
89  error::KallistoDetailedResult start(std::map<std::string, const void*> parameters, InternalSensorEventListener internal_listener);
90 
99  error::KallistoDetailedResult update(std::map<std::string, const void*> parameters);
100 
105  std::map<std::string, const void*> getParameters();
106 
113  error::KallistoDetailedResult stop(bool link_loss);
114 
123  void onNotification(std::string address, std::string service_uuid, std::string characteristic_uuid, const std::vector<unsigned char>& values);
124 
134  virtual std::vector<unsigned char> parseConfiguration(bool enable, std::chrono::microseconds delay) = 0;
135 
142  virtual std::vector<SensorEvent> parseData(const std::vector<unsigned char>& data) = 0;
143 
144 public:
148  virtual ~KallistoSensor();
149 
153  KallistoSensor(KallistoSensor const&) = delete;
154 
158  void operator=(KallistoSensor const&) = delete;
159 
160 };
161 
162 } /* namespace hardware */
163 } /* namespace kallisto */
164 
165 #endif // KALLISTO_MOTION_SENSOR_HPP
error::KallistoDetailedResult start(std::map< std::string, const void *> parameters, InternalSensorEventListener internal_listener)
Definition: bluetooth_adapter.hpp:52
std::string m_configuration_char_uuid
Definition: kallisto_sensor.hpp:63
std::string m_data_char_uuid
Definition: kallisto_sensor.hpp:65
virtual std::vector< unsigned char > parseConfiguration(bool enable, std::chrono::microseconds delay)=0
SensorType
Definition: sensor.hpp:60
std::chrono::microseconds m_delay
Definition: kallisto_sensor.hpp:67
void onNotification(std::string address, std::string service_uuid, std::string characteristic_uuid, const std::vector< unsigned char > &values)
error::KallistoDetailedResult stop(bool link_loss)
std::map< std::string, const void * > getParameters()
virtual std::vector< SensorEvent > parseData(const std::vector< unsigned char > &data)=0
KallistoSensor(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::string service_uuid, std::string configuration_char_uuid, std::string data_char_uuid)
void operator=(KallistoSensor const &)=delete
InternalSensorEventListener m_listener
Definition: kallisto_sensor.hpp:69
std::function< void(SensorEvent &event)> InternalSensorEventListener
Definition: sensor_impl.hpp:65
std::string m_service_uuid
Definition: kallisto_sensor.hpp:61
error::KallistoDetailedResult update(std::map< std::string, const void *> parameters)
ReportingMode
Definition: sensor.hpp:126