MotionLib  1.0.0
SamBuCa motion library
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
smc::DeviceBase Class Referenceabstract
Inheritance diagram for smc::DeviceBase:
Inheritance graph
[legend]
Collaboration diagram for smc::DeviceBase:
Collaboration graph
[legend]

Public Types

typedef smc::DeviceType DeviceType
 
typedef std::shared_ptr< DeviceBaseShared
 

Public Member Functions

virtual DeviceType type () const =0
 
DeviceId uid () const
 Get the address of device. More...
 
virtual std::future< std::set< std::string > > listConfig () const
 list device configuration options
 
virtual std::future< std::string > getConfig (const std::string &name) const
 get device configuration value More...
 
virtual std::future< void > setConfig (const std::string &name, const std::string &value) const
 set device configuration value More...
 
virtual bool canConvert (const units::Value &value, units::unit_t unit) const
 Check if unit conversion is possible in a manner specific to this device. More...
 
virtual bool convert (units::Value &value, units::unit_t unit) const
 Convert value in a manner specific to this device. More...
 
std::string toString () const
 debug and logging operation
 

Public Attributes

ccut::Signal< const DeviceBase::Shared & > updateSignal
 device update signal More...
 

Protected Member Functions

 DeviceBase (const std::string &uid)
 Construct a new ABaseDevice, linking pointer to platform object. More...
 

Protected Attributes

const std::string m_uid
 

Detailed Description

Definition at line 88 of file DeviceBase.hpp.

Constructor & Destructor Documentation

◆ DeviceBase()

DeviceBase::DeviceBase ( const std::string &  uid)
protected

Construct a new ABaseDevice, linking pointer to platform object.

Parameters
addressAddress of the device.

Definition at line 74 of file DeviceBase.cpp.

Member Function Documentation

◆ canConvert()

bool DeviceBase::canConvert ( const units::Value value,
units::unit_t  unit 
) const
virtual

Check if unit conversion is possible in a manner specific to this device.

Parameters
valueValue to check
unitUnit to check
Returns
true If conversion is possible
false If conversion is not possible

Reimplemented in smc::internal::MGrblAxis, smc::internal::MFEPositionSensor, and smc::internal::GrblAxis.

Definition at line 81 of file DeviceBase.cpp.

◆ convert()

bool DeviceBase::convert ( units::Value value,
units::unit_t  unit 
) const
virtual

Convert value in a manner specific to this device.

Parameters
valueValue to convert
unitUnit to convert to
Returns
true If conversion was successful
false If conversion is not possible

Reimplemented in smc::internal::MGrblAxis, smc::internal::MFEPositionSensor, and smc::internal::GrblAxis.

Definition at line 86 of file DeviceBase.cpp.

◆ getConfig()

std::future< std::string > DeviceBase::getConfig ( const std::string &  name) const
virtual

get device configuration value

Parameters
namevalue to retrieve
Returns
the current value (yml encoded)

Reimplemented in smc::internal::MGrblPlatformDevice, smc::internal::MGrblAxis, smc::internal::MFEPositionSensor, smc::internal::MFEAxisPositionMonitor, smc::internal::GrblPlatformDevice, and smc::internal::GrblAxis.

Definition at line 98 of file DeviceBase.cpp.

◆ setConfig()

std::future< void > DeviceBase::setConfig ( const std::string &  name,
const std::string &  value 
) const
virtual

set device configuration value

Parameters
namename of the configuration value to set
valuevalue to set

Reimplemented in smc::internal::MGrblPlatformDevice, smc::internal::MGrblAxis, smc::internal::MFEPositionSensor, smc::internal::MFEAxisPositionMonitor, smc::internal::GrblPlatformDevice, and smc::internal::GrblAxis.

Definition at line 104 of file DeviceBase.cpp.

◆ uid()

std::string DeviceBase::uid ( ) const

Get the address of device.

Returns
std::string Address of device

Definition at line 76 of file DeviceBase.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ updateSignal

ccut::Signal<const DeviceBase::Shared &> smc::DeviceBase::updateSignal

device update signal

this signal is emitted whenever device's cached state is updated

Definition at line 155 of file DeviceBase.hpp.


The documentation for this class was generated from the following files: