42 #ifndef SENSOR_IMPL_HPP 43 #define SENSOR_IMPL_HPP 52 #include "../../../util/error/kallisto_error.hpp" 55 #include "../../../util/executor/executor.hpp" 56 #include "../../../bluetooth/device/bluetooth_dispatcher.hpp" 57 #include "../synchronization/time_synchronizer.hpp" 71 class SensorImpl :
public Sensor {
74 util::Executor& m_event_dispatcher;
76 std::list<SensorEventListener*> m_listeners;
78 std::mutex m_listener_list_mutex;
80 std::map<std::string, const void*> m_parameters;
84 void handleSensorEvent(SensorEvent& event);
103 virtual error::KallistoDetailedResult
start(std::map<std::string, const void*> parameters, InternalSensorEventListener internal_listener) = 0;
113 virtual error::KallistoDetailedResult
update(std::map<std::string, const void*> parameters) = 0;
119 virtual std::map<std::string, const void*>
getParameters() = 0;
127 virtual error::KallistoDetailedResult
stop(
bool link_loss) = 0;
133 SensorImpl(std::string name, std::string address, std::string vendor,
unsigned int version,
SensorType type, std::string string_type,
134 ReportingMode reporting_mode,
unsigned int identifier,
float max_range,
float resolution,
float power, std::chrono::microseconds min_delay,
135 std::chrono::microseconds max_delay, util::Executor& event_dispatcher, bluetooth::BluetoothDispatcher& bluetooth_dispatcher, TimeSynchronizer* sensor_synchronizer);
166 error::KallistoDetailedResult
registerListener(std::map<std::string, const void*> parameters, SensorEventListener& listener);
236 #endif // SENSOR_IMPL_HPP error::KallistoDetailedResult registerListener(std::map< std::string, const void *> parameters, SensorEventListener &listener)
Definition: bluetooth_adapter.hpp:52
bool m_link_loss
Definition: sensor_impl.hpp:87
static unsigned char getTypeFromManufacturerData(unsigned char byte)
TimeSynchronizer * m_sensor_synchronizer
Definition: sensor_impl.hpp:91
SensorType
Definition: sensor.hpp:60
virtual error::KallistoDetailedResult start(std::map< std::string, const void *> parameters, InternalSensorEventListener internal_listener)=0
virtual error::KallistoDetailedResult update(std::map< std::string, const void *> parameters)=0
error::KallistoDetailedResult unregisterListener(SensorEventListener &listener)
static unsigned char getIdFromManufacturerData(unsigned char byte)
virtual std::map< std::string, const void * > getParameters()=0
static unsigned int generateHandle()
static const std::string & KEY_DELAY()
virtual error::KallistoDetailedResult stop(bool link_loss)=0
bluetooth::BluetoothDispatcher & m_bluetooth_dispatcher
Definition: sensor_impl.hpp:89
error::KallistoDetailedResult onLinkRecovered()
SensorImpl(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::function< void(SensorEvent &event)> InternalSensorEventListener
Definition: sensor_impl.hpp:65
ReportingMode
Definition: sensor.hpp:126