Class TcsInfo#

Class Documentation#

class TcsInfo#

holds the most recently published tcsd telemetry

One member for each key published by TCS::Interface::publish_snapshot. Written by the subscriber thread, read by the sequence threads; the caller serializes all access under Sequence::tcsd_mtx.

Public Functions

inline TcsInfo()#
inline void init()#

initialize all class member variables to “non-values”

inline void store(const nlohmann::json &jmessage)#

store a received tcsd telemetry message

Erase first, because a snapshot is all or nothing; a key missing from this message must not leave the value from an earlier one behind. extract_telemetry_value leaves its out-param alone on a missing key, wrong type, or null (how a NAN arrives), so the init() non-values survive those.

Parameters:

jmessage[in] subscribed-received JSON message

inline bool is_fresh() const#

was this read from the TCS recently enough to act on?

Both halves are needed. tcsd publishes every second while connected, so the age means something, but it also answers a snapshot request while closed and timestamps that message like any other. ISOPEN separates the two. A poll can still fail while connected, so a caller must treat a non-value as unknown no matter what this returns.

Returns:

true|false

inline int domelamp_state(const std::string &name) const#

cached state of the named dome lamp

Parameters:

name[in] Lamp::Dome name

Returns:

1=on 0=off -1=undefined or unknown lamp

Public Members

bool isopen#

is tcsd’s connection to the TCS open?

std::string tcsname#

name of connected TCS { real sim }

std::string motion#

one of the TCS_MOTION*_STRs from tcs_constants.h

std::string ha#

hh:mm:ss.s

std::string ra_hms#

hh:mm:ss.ss

std::string dec_dms#

dd:mm:ss.ss

std::string domeshutters#

{ open closed }

double ra_h#

h.hhhhh (decimal hours)

double dec_d#

d.ddddd (decimal degrees)

double azimuth#
double alt#
double zenithangle#
double domeazimuth#
double airmass#
double focus#
double offsetra#
double offsetdec#
double cassangle#
double pa#
int64_t pubtime#

time (usec) that tcsd published this state

std::map<std::string, int> domelamp#

1=on 0=off -1=undefined, indexed by Lamp::Dome name