Motion Master
Loading...
Searching...
No Matches
watchdog_machine.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <future>
5#include <map>
6
8#include "ethercat_slave.h"
9#include "machine.h"
10
11class WatchdogMachine : public Machine {
12 public:
13 WatchdogMachine(VirtualDeviceManager& vdm, ctpl::thread_pool& thread_pool,
14 Notifier& notifier,
16 outgoing_machine_message_queue);
17
18 void execute(uint64_t pending_signals) override;
19 void start();
20 void stop();
21 void abort_client_requests(const std::string& connection_id) override;
22 bool done() override;
23
24 private:
25 uint64_t elapsed_milliseconds_ = 0;
26 uint64_t counter_ = 0;
27 std::future<void> future_;
28 bool running_ = true;
29
30 std::map<uint16_t, EthercatSlave::State> ecat_slave_states_;
31
32 void check_drives();
33 void send_connection_warning(uint16_t device_id);
34};
Machine(VirtualDeviceManager &vdm, ctpl::thread_pool &thread_pool, Notifier &notifier, mm::core::containers::ThreadSafeQueue< OutgoingMachineMessage > &outgoing_machine_message_queue)
Definition machine.cc:7
Definition notifier.h:9
Definition virtual_device_manager.h:16
bool done() override
Check if all of the machine started processes are done (including the Command Workers)
Definition watchdog_machine.cc:161
WatchdogMachine(VirtualDeviceManager &vdm, ctpl::thread_pool &thread_pool, Notifier &notifier, mm::core::containers::ThreadSafeQueue< OutgoingMachineMessage > &outgoing_machine_message_queue)
Definition watchdog_machine.cc:24
void abort_client_requests(const std::string &connection_id) override
Abort all of the requests a certain client has issues.
Definition watchdog_machine.cc:155
void execute(uint64_t pending_signals) override
Execute the machine.
Definition watchdog_machine.cc:31
void start()
Definition watchdog_machine.cc:141
void stop()
Definition watchdog_machine.cc:149
Thread-safe FIFO queue with optional capacity limit.
Definition thread_safe_queue.h:23