102
edits
No edit summary |
|||
Line 82: | Line 82: | ||
=== Add constructor method === | === Add constructor method === | ||
The constructor method receives the sensor settings parameter. These settings include the device_filename, which refers to the bus where the sensor is mounted. | |||
<syntaxhighlight lang=c++> | <syntaxhighlight lang=c++> | ||
class NewSensorExample : public ISensor { | class NewSensorExample : public ISensor { | ||
Line 93: | Line 96: | ||
=== Extend the | === Extend the Sensors enumeration === | ||
To enable the ISensor interface to create an instance of the new sensor, it must be added to the Sensors enumeration. | |||
<syntaxhighlight lang=c++> | <syntaxhighlight lang=c++> | ||
enum class Sensors { | enum class Sensors { | ||
Line 105: | Line 110: | ||
=== Add New Sensor to ISensor Build method=== | === Add New Sensor to ISensor Build method=== | ||
Finally, the new sensor case must be added to the ISensor build method to allow the interface to instantiate the sensor. | |||
<syntaxhighlight lang=c++> | <syntaxhighlight lang=c++> |
edits