Motion Master
Loading...
Searching...
No Matches
command_worker.h
Go to the documentation of this file.
1#pragma once
2
3#include <readerwriterqueue/readerwriterqueue.h>
4
5#include <chrono>
6#include <list>
7#include <thread>
8
10#include "motion_master_error.h"
11
12class Notifier;
13class VirtualDevice;
15
17 public:
19 IncomingMachineMessage &incoming_machine_message);
20
24 void run();
25
33
40 const std::string &get_connection_id() const;
41
47 moodycamel::ReaderWriterQueue<motionmaster::MotionMasterMessage> &
49
56 bool is_done();
57
64
66
67 private:
69 Notifier &notifier_;
70
71 IncomingMachineMessage incoming_machine_message_;
72 const motionmaster::MotionMasterMessage::Request &request_;
73
74 moodycamel::ReaderWriterQueue<motionmaster::MotionMasterMessage>
75 outgoing_message_queue_;
76 MotionMasterError error_;
77 // Set in the constructor depending on the request type
78 bool device_address_must_be_supplied_ = true;
79 uint32_t device_address_;
80 VirtualDevice *virtual_device_ = nullptr;
81 bool done_ = false;
82
90 void populate_device_parameter_values_message(
91 const motionmaster::MotionMasterMessage::Request::GetDeviceParameterValues
92 &get_device_parameter_values_request,
93 VirtualDevice *virtual_device,
94 motionmaster::MotionMasterMessage::Status::DeviceParameterValues
95 *parameter_values_msg);
96
104 static void set_device_parameter_values(
105 const motionmaster::MotionMasterMessage::Request::SetDeviceParameterValues
106 &set_device_parameter_values_request,
107 VirtualDevice *virtual_device,
108 motionmaster::MotionMasterMessage::Status::DeviceParameterValues
109 *parameter_values_msg);
110
119 static MotionMasterError sii_restore(const std::vector<uint8_t> &sii_content,
120 int32_t device_position);
121
125 void notify_if_hardware_description_missing();
126
132 void send_status(motionmaster::MotionMasterMessage::Status *status);
133};
Definition: command_worker.h:16
void run()
Execute the Command Worker.
Definition: command_worker.cc:208
moodycamel::ReaderWriterQueue< motionmaster::MotionMasterMessage > & get_status_queue()
Get all of the Status messages meant for the client.
Definition: command_worker.cc:3003
void abort_motion_operations()
Definition: command_worker.cc:3013
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:2998
MotionMasterError get_error()
Get the current error (if any)
Definition: command_worker.cc:3011
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:2994
bool is_done()
Check if the Command Worker is done processing the request (command)
Definition: command_worker.cc:3007
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