Motion Master
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MockSlave Class Reference

#include <mock_slave.h>

Inheritance diagram for MockSlave:
Inheritance graph
[legend]
Collaboration diagram for MockSlave:
Collaboration graph
[legend]

Public Member Functions

 MockSlave (uint16_t id)
 
uint16_t get_device_id () const override
 Get the device ID. More...
 
uint16_t get_hardware_id () const override
 Get the hardware ID. More...
 
Protocol get_protocol () const override
 Get the protocol the device uses. More...
 
Type get_device_type () const override
 Get the device type. More...
 
std::list< VirtualParameter * > get_all_virtual_parameters () override
 Get all available configuration parameters on the virtual device. More...
 
VirtualParameterget_virtual_parameter (uint16_t index, uint8_t subindex) override
 Get a configuration parameter. More...
 
std::variant< MotionMasterError, std::list< std::string > > get_file_list () override
 Get the list of available files on the device. More...
 
std::variant< MotionMasterError, std::vector< uint8_t > > read_file (const std::string &file_name) override
 Get the file content from a file from the flash memory. More...
 
MotionMasterError write_file (const std::string &file_name, const std::vector< uint8_t > &content, std::function< void(uint8_t)> progress_callback) override
 Write the file to the flash memory. More...
 
MotionMasterError remove_file (const std::string &file_name) override
 Remove the file from the flash memory. More...
 
bool is_operational () const override
 Check if the device is operational. More...
 
- Public Member Functions inherited from VirtualDevice
virtual ~VirtualDevice ()=default
 
virtual uint16_t get_device_id () const =0
 Get the device ID. More...
 
virtual uint16_t get_hardware_id () const =0
 Get the hardware ID. More...
 
virtual Protocol get_protocol () const
 Get the protocol the device uses. More...
 
virtual Type get_device_type () const
 Get the device type. More...
 
virtual std::list< VirtualParameter * > get_all_virtual_parameters ()=0
 Get all available configuration parameters on the virtual device. More...
 
virtual VirtualParameterget_virtual_parameter (uint16_t index, uint8_t subindex)=0
 Get a configuration parameter. More...
 
virtual std::variant< MotionMasterError, std::list< std::string > > get_file_list ()=0
 Get the list of available files on the device. More...
 
virtual std::variant< MotionMasterError, std::vector< uint8_t > > read_file (const std::string &file_name)=0
 Get the file content from a file from the flash memory. More...
 
virtual MotionMasterError write_file (const std::string &file_name, const std::vector< uint8_t > &content, std::function< void(uint8_t)> progress_callback)=0
 Write the file to the flash memory. More...
 
virtual MotionMasterError remove_file (const std::string &file_name)=0
 Remove the file from the flash memory. More...
 
virtual bool is_operational () const =0
 Check if the device is operational. More...
 

Additional Inherited Members

- Public Types inherited from VirtualDevice
enum class  Protocol { kUnspecified = 0 , kMock , kEcat , kSerial }
 
enum class  Type { kUnspecified = 0 , kCia402Drive , kDigitalIo }
 
- Static Public Attributes inherited from VirtualDevice
static const std::map< std::pair< uint32_t, uint32_t >, Typedevice_type_map_
 

Constructor & Destructor Documentation

◆ MockSlave()

MockSlave::MockSlave ( uint16_t  id)
explicit

Member Function Documentation

◆ get_all_virtual_parameters()

std::list< VirtualParameter * > MockSlave::get_all_virtual_parameters ( )
overridevirtual

Get all available configuration parameters on the virtual device.

Returns
a list of pointers to all available configuration parameters

Implements VirtualDevice.

◆ get_device_id()

uint16_t MockSlave::get_device_id ( ) const
overridevirtual

Get the device ID.

Returns
the device ID

Implements VirtualDevice.

◆ get_device_type()

VirtualDevice::Type MockSlave::get_device_type ( ) const
overridevirtual

Get the device type.

Returns
Type enum

Reimplemented from VirtualDevice.

◆ get_file_list()

std::variant< MotionMasterError, std::list< std::string > > MockSlave::get_file_list ( )
overridevirtual

Get the list of available files on the device.

Returns
MotionMasterError or the list of available files on the device

Implements VirtualDevice.

◆ get_hardware_id()

uint16_t MockSlave::get_hardware_id ( ) const
overridevirtual

Get the hardware ID.

Returns
the hardware ID

Implements VirtualDevice.

◆ get_protocol()

VirtualDevice::Protocol MockSlave::get_protocol ( ) const
overridevirtual

Get the protocol the device uses.

Returns
Protocol enum

Reimplemented from VirtualDevice.

◆ get_virtual_parameter()

VirtualParameter * MockSlave::get_virtual_parameter ( uint16_t  index,
uint8_t  subindex 
)
overridevirtual

Get a configuration parameter.

Parameters
indexconfiguration parameter index
subindexconfiguration parameter index
Returns
a pointer to a configuration parameter

Implements VirtualDevice.

◆ is_operational()

bool MockSlave::is_operational ( ) const
overridevirtual

Check if the device is operational.

Returns
true if operational, false otherwise

Implements VirtualDevice.

◆ read_file()

std::variant< MotionMasterError, std::vector< uint8_t > > MockSlave::read_file ( const std::string &  file_name)
overridevirtual

Get the file content from a file from the flash memory.

Parameters
file_namename of the file in the flash memory
Returns
MotionMasterError or file content

Implements VirtualDevice.

◆ remove_file()

MotionMasterError MockSlave::remove_file ( const std::string &  file_name)
overridevirtual

Remove the file from the flash memory.

Parameters
file_namename of the file in the flash memory
Returns
error

Implements VirtualDevice.

◆ write_file()

MotionMasterError MockSlave::write_file ( const std::string &  file_name,
const std::vector< uint8_t > &  content,
std::function< void(uint8_t)>  progress_callback 
)
overridevirtual

Write the file to the flash memory.

Parameters
file_namethe name of the file to be written
contentthe content of the file to be written
progress_callbackfunction to call for progress changes
Returns
error

Implements VirtualDevice.


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