Class Interface

Nested Relationships

Nested Types

Class Documentation

class Interface

interface class for a focus device

This class defines the interface for each focus 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)
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 home(std::string name_in, std::string &retstring)

home all daisy-chained motors

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

return the home state of the motors

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

set focus motor position

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

get focus motor position

long move_abs(int addr, float pos)

send move-absolute command to specified controller

long move_rel(std::string args)

send move-relative command to specified controller

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

send native command to a PI controller

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

void publish_status(bool force = false)

publish focus state on change (or force)

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

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::StepperInfo> 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

Public Static Functions

static void dothread_move_abs(Focus::Interface &iface, int addr, float pos)

threaded move_abs function