Motion Master
Loading...
Searching...
No Matches
command_worker.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <list>
5#include <thread>
6
10
11class Notifier;
12class VirtualDevice;
14
16 public:
18 IncomingMachineMessage& incoming_machine_message);
19
23 void run();
24
32
39 const std::string& get_connection_id() const;
40
46
53 bool is_done();
54
61
63
64 private:
66 Notifier& notifier_;
67
68 IncomingMachineMessage incoming_machine_message_;
69 const motionmaster::MotionMasterMessage::Request& request_;
70
72 outgoing_message_queue_;
73 MotionMasterError error_;
74 // Set in the constructor depending on the request type
75 bool device_address_must_be_supplied_ = true;
76 uint32_t device_address_;
77 VirtualDevice* virtual_device_ = nullptr;
78 bool done_ = false;
79
87 void populate_device_parameter_values_message(
88 const motionmaster::MotionMasterMessage::Request::
89 GetDeviceParameterValues& get_device_parameter_values_request,
90 VirtualDevice* virtual_device,
91 motionmaster::MotionMasterMessage::Status::DeviceParameterValues*
92 parameter_values_msg);
93
101 static void set_device_parameter_values(
102 const motionmaster::MotionMasterMessage::Request::
103 SetDeviceParameterValues& set_device_parameter_values_request,
104 VirtualDevice* virtual_device,
105 motionmaster::MotionMasterMessage::Status::DeviceParameterValues*
106 parameter_values_msg);
107
116 static MotionMasterError sii_restore(const std::vector<uint8_t>& sii_content,
117 int32_t device_position);
118
122 void notify_if_hardware_description_missing();
123
129 void send_status(motionmaster::MotionMasterMessage::Status* status);
130};
void run()
Execute the Command Worker.
Definition command_worker.cc:207
void abort_motion_operations()
Definition command_worker.cc:3007
const std::string & get_connection_id() const
Get the ID of the client that has sent the request (command) Command Worker is working on.
Definition command_worker.cc:2992
MotionMasterError get_error()
Get the current error (if any)
Definition command_worker.cc:3005
mm::core::containers::ThreadSafeQueue< motionmaster::MotionMasterMessage > & get_status_queue()
Get all of the Status messages meant for the client.
Definition command_worker.cc:2997
MachineMessage::Protocol get_protocol() const
Get the protocol of the client that has sent the request (command) Command Worker is working on.
Definition command_worker.cc:2988
bool is_done()
Check if the Command Worker is done processing the request (command)
Definition command_worker.cc:3001
CommandWorker(VirtualDeviceManager &vdm, Notifier &notifier, IncomingMachineMessage &incoming_machine_message)
Definition command_worker.cc:30
Definition incoming_machine_message.h:5
Protocol
Definition machine_message.h:9
Definition motion_master_error.h:6
Definition notifier.h:9
Definition virtual_device_manager.h:16
Definition virtual_device.h:20
Thread-safe FIFO queue with optional capacity limit.
Definition thread_safe_queue.h:23