Motion Master
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Machine Class Referenceabstract

#include <machine.h>

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

Public Member Functions

void add_message (IncomingMachineMessage &incoming_machine_message)
 Add a new incoming machine message to the queue. More...
 
virtual void execute (uint64_t pending_signals)=0
 Execute the machine. More...
 
virtual void abort_client_requests (const std::string &connection_id)=0
 Abort all of the requests a certain client has issues. More...
 
bool command_workers_done ()
 Check if all started Command Workers are done. More...
 
virtual bool done ()=0
 Check if all of the machine started processes are done (including the Command Workers) More...
 

Protected Member Functions

 Machine (VirtualDeviceManager &vdm, ctpl::thread_pool &thread_pool, Notifier &notifier, moodycamel::ReaderWriterQueue< OutgoingMachineMessage > &outgoing_machine_message_queue)
 
virtual ~Machine ()
 
void start_command_worker (IncomingMachineMessage &incoming_machine_message)
 
void process_command_workers (std::function< void(CommandWorker *)> process=nullptr)
 Process all of the available Command Workers. More...
 
void send_response (MachineMessage::Protocol protocol, std::string connection_id, motionmaster::MotionMasterMessage &message)
 Send the response (Status protobuf message) to the proper client. More...
 

Protected Attributes

VirtualDeviceManagervdm_
 
ctpl::thread_pool & thread_pool_
 
std::queue< IncomingMachineMessageincoming_message_queue_
 
Notifiernotifier_
 

Constructor & Destructor Documentation

◆ Machine()

Machine::Machine ( VirtualDeviceManager vdm,
ctpl::thread_pool &  thread_pool,
Notifier notifier,
moodycamel::ReaderWriterQueue< OutgoingMachineMessage > &  outgoing_machine_message_queue 
)
protected

◆ ~Machine()

Machine::~Machine ( )
protectedvirtual

Member Function Documentation

◆ abort_client_requests()

void Machine::abort_client_requests ( const std::string &  connection_id)
pure virtual

Abort all of the requests a certain client has issues.

Parameters
connection_idclient connection ID

Implemented in DeviceProcedureMachine, EncoderCalibrationMachine, FirmwareMachine, FullAutoTuningMachine, MonitorMachine, MotionControlMachine, SignalGeneratorMachine, SystemMachine, UniversalMachine, and WatchdogMachine.

◆ add_message()

void Machine::add_message ( IncomingMachineMessage incoming_machine_message)

Add a new incoming machine message to the queue.

Parameters
incoming_machine_message

◆ command_workers_done()

bool Machine::command_workers_done ( )

Check if all started Command Workers are done.

This function can be called from the outside to check if all of the threads created for Command Workers are done before cleaning up (e.g. stopping VDM - stopping of the VDM before all threads are done may cause them to try to access drives that are no longer available, thus causing segmentation faults).

Returns
true if all Command Worker threads are done, false otherwise

◆ done()

virtual bool Machine::done ( )
pure virtual

Check if all of the machine started processes are done (including the Command Workers)

Returns
true if all of the processes are done, false otherwise

Implemented in DeviceProcedureMachine, EncoderCalibrationMachine, FirmwareMachine, FullAutoTuningMachine, MonitorMachine, MotionControlMachine, SignalGeneratorMachine, SystemMachine, UniversalMachine, and WatchdogMachine.

◆ execute()

virtual void Machine::execute ( uint64_t  pending_signals)
pure virtual

Execute the machine.

Parameters
pending_signalsnumber of time intervals that passed since the last call to this function

Implemented in DeviceProcedureMachine, EncoderCalibrationMachine, FirmwareMachine, FullAutoTuningMachine, MonitorMachine, MotionControlMachine, SignalGeneratorMachine, SystemMachine, UniversalMachine, and WatchdogMachine.

◆ process_command_workers()

void Machine::process_command_workers ( std::function< void(CommandWorker *)>  process = nullptr)
protected

Process all of the available Command Workers.

Parameters
processa function for additional custom processing

◆ send_response()

void Machine::send_response ( MachineMessage::Protocol  protocol,
std::string  connection_id,
motionmaster::MotionMasterMessage &  message 
)
protected

Send the response (Status protobuf message) to the proper client.

Parameters
protocol
connection_id
message

◆ start_command_worker()

void Machine::start_command_worker ( IncomingMachineMessage incoming_machine_message)
protected

\brif Start a Command Worker to process an incoming machine message

Parameters
incoming_machine_message

Member Data Documentation

◆ incoming_message_queue_

std::queue<IncomingMachineMessage> Machine::incoming_message_queue_
protected

◆ notifier_

Notifier& Machine::notifier_
protected

◆ thread_pool_

ctpl::thread_pool& Machine::thread_pool_
protected

◆ vdm_

VirtualDeviceManager& Machine::vdm_
protected

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