Class Interface

Nested Relationships

Nested Types

Class Documentation

class Interface

interface class for a flexure device

This class defines the interface for each flexure controller and contains the functions used to communicate with it.

Public Functions

inline Interface()
inline long init_pubsub(const std::initializer_list<std::string> &topics = {})
inline void start_subscriber_thread()
inline void stop_subscriber_thread()
void handletopic_snapshot(const nlohmann::json &jmessage)

respond to a snapshot request

void get_status()

refresh status from hardware

void publish_status(bool force = false)

publish flexure state on change (or force)

long initialize_class()
long open()

opens the PI socket connection

long close()

closes the PI socket connection

long is_open(std::string arg, std::string &retstring)

are motor controllers connected?

long set(std::string args, std::string &retstring)

set the slit width and offset

long get(std::string args, std::string &retstring)

get the current width and offset

long compensate(std::string args, std::string &retstring)

perform flexure compensation

long stop()

send the stop-all-motion command to all controllers

long send_command(const std::string &name, std::string cmd)

writes the raw command as received to the master controller, no reply

long send_command(const std::string &name, std::string cmd, std::string &retstring)

writes command?, reads reply

long test(std::string args, std::string &retstring)

test routines

Public Members

std::unique_ptr<Common::PubSub> publisher

publisher object

std::string publisher_address

publish socket endpoint

std::string publisher_topic

my default topic for publishing

std::unique_ptr<Common::PubSub> subscriber

subscriber object

std::string subscriber_address

subscribe socket endpoint

std::vector<std::string> subscriber_topics

list of topics I subscribe to

std::atomic<bool> is_subscriber_thread_running

is my subscriber thread running?

std::atomic<bool> should_subscriber_thread_run

should my subscriber thread run?

std::unordered_map<std::string, std::function<void(const nlohmann::json&)>> topic_handlers

maps a handler function to each topic

Common::Queue async
Physik_Instrumente::Interface<Physik_Instrumente::PiezoInfo> motorinterface
std::mutex pi_mutex

mutex to protect multi-threaded access to PI controller

volatile std::atomic<int> motors_running

number of motors that are running in threads

volatile std::atomic<long> thr_error

error state of threads

std::mutex wait_mtx

mutex object for waiting for threads

std::condition_variable cv

condition variable for waiting for threads