Class Interface#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public Camera::InterfaceBase

Class Documentation#

class Interface : public Camera::InterfaceBase#

This class defines the interface to the AstroCam controller.

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 publish_status(bool force = false)#
void request_snapshot()#
void handletopic_snapshot(const nlohmann::json &jmessage_in)#
void handletopic_acam(const nlohmann::json &jmessage_in)#
void handletopic_calib(const nlohmann::json &jmessage_in)#
void handletopic_flexure(const nlohmann::json &jmessage_in)#
void handletopic_focus(const nlohmann::json &jmessage_in)#
void handletopic_power(const nlohmann::json &jmessage_in)#
void handletopic_slicecam(const nlohmann::json &jmessage_in)#
void handletopic_slit(const nlohmann::json &jmessage_in)#
void handletopic_targetinfo(const nlohmann::json &jmessage_in)#
void handletopic_tcs(const nlohmann::json &jmessage_in)#
void handletopic_thermal(const nlohmann::json &jmessage_in)#
inline void add_framethread()#
inline void remove_framethread()#
inline int get_framethread_count()#
inline void init_framethread_count()#
inline bool is_camera_idle(int dev)#

is the specified camera idle?

Asking if a camera is idle refers to its activity status &#8212; actively reading out or in frame transfer.

Parameters:

dev[in] device number to check

Returns:

true|false

inline bool is_camera_idle()#
inline bool in_readout() const#
inline bool in_frametransfer() const#
inline void inc_expbuf()#
inline int get_expbuf()#
inline std::vector<int> exposure_pending_list()#

returns the exposure_pending vector

Returns:

std::vector<int>

inline bool exposure_pending()#

Is an exposure pending or can a new exposure be started?

This function is overloaded with a version that allows setting the exposure_pending state.

Returns:

bool { true | false }

inline void exposure_pending(int devnum, bool add)#

Set or clear the exposure pending state for a given controller.

This function is overloaded with an inline version that returns a bool to indicate if there are any controllers with a pending exposure.

Parameters:
  • devnum[in] controller device number

  • add[in] bool true to add, false to remove from pending vector

inline std::vector<int> writes_pending_list(int expbuf)#

returns the writes_pending vector

Parameters:

expbuf[in] the exposure buffer number

Returns:

std::vector<int>, the vector of devnums for this expbuf

inline bool any_writes_pending()#

Is any device still writing frames for any exposure buffer?

Returns:

true if any writes are pending, false otherwise

inline void write_pending(int expbuf, int devnum, bool add)#

Set or clear the write pending state for a given exposure.

This function is overloaded with an inline version that returns a bool to indicate if there are any controllers with a pending write.

Parameters:
  • expbuf[in] exposure buffer number

  • devnum[in] device number

  • add[in] bool true to add, false to remove from pending vector

void get_logical(Controller *pcontroller, int &spat, int &spec, int &osspat, int &osspec, int &binspat, int &binspec)#
long camera_active_state(const std::string &args, std::string &retstring, AstroCam::ActiveState cmd)#
Controller *get_controller(const int dev)#
Controller *get_active_controller(const int dev)#
void exposure_progress()#
void make_image_keywords(int dev)#
long parse_spec_info(std::string args)#
long parse_det_geometry(std::string args)#
long parse_controller_config(std::string args)#
long parse_activate_commands(std::string args)#
int devnum_from_chan(const std::string &chan)#
long extract_dev_chan(std::string args, int &dev, std::string &chan, std::string &retstring)#
long test(std::string args, std::string &retstring)#

test routines

void dothread_test_shutter_timer(long ms)#
long interface(std::string &iface)#

returns the interface

long do_abort()#
long abort()#
long do_bin(std::string args, std::string &retstring)#

set/get binning factor

long bin(std::string args, std::string &retstring)#

set/get binning factor

long do_connect_controller(const std::string devices_in, std::string &retstring)#

opens a connection to the PCI/e device(s)

long connect_controller(std::string devices_in, std::string &help)#

wrapper for do_connect_controller

long is_connected(std::string &retstring)#

are all selected controllers connected?

long do_disconnect_controller(int dev)#

closes the connection to the named PCI/e device

long do_disconnect_controller()#

closes the connection to all PCI/e devices

long disconnect_controller()#

wrapper for do_disconnect_controller

long do_configure_controller()#

perform initial configuration of controller from .cfg file

long configure_controller()#

wrapper for do_configure_controller

long access_useframes(std::string &useframes)#

set or get the state of this->useframes

long access_nframes(std::string valstring)#
int get_driversize()#
long do_load_firmware(std::string &retstring)#

load firmware (.lod) into one or all controller timing boards

long do_load_firmware(std::string timlodfile, std::string &retstring)#
long load_firmware(std::string &retstring)#

wrapper for load_firmware

long load_firmware(std::string timlodfile, std::string &retstring)#

wrapper for load_firmware

long band_of_interest(std::string args, std::string &retstring)#

set/get interest bands

long parse_boi_pairs(Controller *pcontroller, const std::string &args)#
long load_boi_pairs(Controller *pcontroller, int &spat_total)#
long reset_boi_full(Controller *pcontroller, int dev, const std::string &chan, std::string &retstring)#
long adjust_boi_for_binning(Controller *pcontroller, int nskip, int nread, std::pair<int, int> &adj)#
std::string print_bands_of_interest(Controller *pcontroller)#
long set_camera_mode(std::string mode)#
long exptime(std::string exptime_in, std::string &retstring)#
long do_exptime(std::string exptime_in, std::string &retstring)#
long modify_exptime(std::string exptime_in, std::string &retstring)#
long do_modify_exptime(std::string exptime_in, std::string &retstring)#
long stop_exposure(std::string exptime_in, std::string &retstring)#
long pause_exposure(std::string exptime_in, std::string &retstring)#
long resume_exposure(std::string exptime_in, std::string &retstring)#
long shutter(std::string shutter_in, std::string &shutter_out)#
long frame_transfer_mode(std::string args)#
long frame_transfer_mode(std::string args, std::string &retstring)#
long image_size(std::string args, std::string &retstring)#
long set_image_size(Controller *pcontroller, int spat, int spec, int osspat, int osspec, int binspat, int binspec)#
long geometry(std::string args, std::string &retstring)#
long do_geometry(std::string args, std::string &retstring)#
long bias(std::string args, std::string &retstring)#
long buffer(std::string size_in, std::string &retstring)#
long readout(std::string readout_in, std::string &readout_out)#
long do_readout(std::string readout_in, std::string &readout_out)#
void set_imagesize(int rowsin, int colsin, int *status)#
long expose(std::string nexp_in)#
long do_expose(int nexp_in)#
double get_live_airmass()#

latest airmass from cached tcsd telemetry, or NAN

void get_live_provenance(std::string &githash, std::string &buildtime)#

build provenance of all running daemons

long native(std::string cmdstr)#
long native(std::string cmdstr, std::string &retstring)#
long do_native(std::string cmdstr)#

selected or all open controllers

send 3-letter command to …

long do_native(std::string cmdstr, std::string &retstring)#

selected or all open controllers, return reply

long do_native(std::vector<int> selectdev, std::string cmdstr)#

specified by vector

long do_native(std::vector<int> selectdev, std::string cmdstr, std::string &retstring)#

specified by vector

long do_native(int dev, std::string cmdstr, std::string &retstring)#

specified by devnum

long do_native(int dev, std::string cmdstr)#

specified by devnum

long write_frame(int expbuf, int devnum, const std::string chan, int fpbcount)#
void dothread_native(int dev, std::vector<uint32_t> cmd)#
void handle_queue2(std::string message)#
inline int keytype_string()#
inline int keytype_double()#
inline int keytype_integer()#
inline int fits_bpp16()#
inline int fits_bpp32()#

Public Members

Config config#
Camera::Camera camera#
Camera::Information camera_info#

instantiate a Camera object

std::map<std::string, nlohmann::json> live_telemetry#

this is the main camera_info object

latest JSON snapshot per provider, keyed by Topic

std::mutex live_telemetry_mtx#
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::Broadcaster broadcast = {this->publisher, Daemon::CAMERAD}#
std::vector<std::shared_ptr<Camera::Information>> fitsinfo#
std::mutex frameinfo_mutex#

protects access to frameinfo

std::mutex framecount_mutex#

protects access to frame count

std::atomic<int> framethreadcount#
std::mutex framethreadcount_mutex#
std::atomic<bool> state_monitor_thread_running#
std::condition_variable state_monitor_condition#
std::mutex state_lock#
Status status#
Status last_published_status#
std::mutex publish_mutex#

serializes concurrent callers of publish_status()

std::condition_variable exposure_condition#
std::mutex exposure_lock#
std::condition_variable write_condition#
std::mutex write_lock#
std::map<int, Controller> controller#
bool modeselected#

true if a valid mode has been selected, false otherwise

bool useframes#

Not all firmware supports frames.

std::vector<FITS_file*> pFits#

vector of FITS containers, one for each exposure number for multiple buffering

std::map<std::string, readout_info_t> readout_source#

STL map of readout sources indexed by readout name.

Public Static Functions

static void state_monitor_thread(Interface &interface)#
static void dothread_monitor_exposure_pending(Interface &interface)#
static void dothread_load(Controller &con, std::string timlodfile)#
static void dothread_shutter(int expbuf, Interface &interface)#
static void dothread_read(Camera::Camera &cam, Controller &con, int expbuf)#
static void dothread_expose(Controller &con)#
static void handle_frame(int expbuf, int devnum, uint32_t fpbcount, uint32_t fcount, void *buffer)#
static void handle_queue(std::string message)#
static void FITS_handler(int expbuf, Interface &interface)#
class Controller#

contains information for each controller

The Controller class is a sub-class of Interface and is here to contain the Camera::Information class and FITS_file class objects. There will be a vector of Controller class objects which matches the vector of controller objects.

Public Types

enum Axis#

Values:

enumerator ROW#
enumerator COL#

Public Functions

inline Controller()#
inline ~Controller()#
void logical_to_physical(int spat, int spec, int &rows, int &cols) const#
void physical_to_logical(int rows, int cols, int &spat, int &spec) const#
inline int spat_physical_axis() const#
inline int spec_physical_axis() const#
inline bool has_boi() const#
inline uint32_t get_bufsize()#
inline uint32_t set_bufsize(uint32_t sz)#
long alloc_workbuf()#
inline void init_framecount()#
inline int get_framecount()#
inline void increment_framecount()#
template<class T>
T *deinterlace(int expbuf, T *imbuf)#
template<class T>
void *alloc_workbuf(T *buf)#
template<class T>
void free_workbuf(T *buf)#
long write()#

wrapper for this->pFits->write_image()

long open_file(std::string writekeys)#

wrapper for this->pFits->open_file()

void close_file(std::string writekeys)#

wrapper for this->pFits->close_file()

Public Members

Camera::Information info#

no deconstructor

camera info object for this controller

void *workbuf#

pointer to workspace for performing deinterlacing

std::vector<Camera::Information> expinfo#

vector of Camera::Information class, one for each exposure buffer

This contains the camera information for each exposure buffer. Note that since Camera::Information contains extkeys and prikeys objects, expinfo will contain those objects, but prikeys should not be used. Use only Controller::expinfo.extkeys because keys specific to a given controller will be added to that controller’s extension.

std::mutex pcimtx#

mutex protects talking to this PCI driver

int error#
int cols#

total number of columns read (includes overscan)

int rows#

total number of rows read (includes overscan)

Axis spec_axis#

which physical axis {ROW,COL} is spectral

Axis spat_axis#

which physical axis {ROW,COL} is spatial

int detcols#

number of detector columns (unchanged by binning)

int detrows#

number of detector rows (unchanged by binning)

int oscols0#

requested number of overscan rows

int osrows0#

requested number of overscan columns

int oscols#

realized number of overscan rows (can be modified by binning)

int osrows#

realized number of overscan columns (can be modified by binning)

int skiprows#
int skipcols#
int defcols#

default number of detector columns

int defrows#

default number of detector rows

int defoscols#

default number of overscan rows

int defosrows#

default number of overscan columns

int defbincols#

default number of overscan rows

int defbinrows#

default number of overscan columns

std::string imsize_args#

IMAGE_SIZE arguments read from config file, used to restore default.

arc::gen3::CArcDevice *pArcDev#

arc::CController object pointer &#8212; things pointed to by this are in the ARC API

Callback *pCallback#

Callback class object must be pointer because the API functions are virtual.

bool connected#

true if controller connected (requires successful TDL command)

bool configured#

set false to skip future use of controllers when unable to connect

bool active#

used to disable an otherwise-configured controller

bool is_imsize_set#

has image_size been called after controller connected?

bool firmwareloaded#

true if firmware is loaded, false otherwise

std::string firmware#

name of firmware (.lod) file

std::string channel#

name of spectrographic channel

std::string ccd_id#

CCD identifier (E.G. serial number, name, etc.)

int devnum#

this controller’s devnum

std::string devname#

comes from arc::gen3::CArcPCI::getDeviceStringList()

std::uint32_t retval#

convenient place to hold return values for threaded commands to this controller

std::map<int, frameinfo_t> frameinfo#

STL map of frameinfo structure (see above)

uint32_t readout_arg#
bool have_ft#

Do I have (and am I using) frame transfer?

std::atomic<bool> in_readout#

Is the controller currently reading out/transmitting pixels?

std::atomic<bool> in_frametransfer#

Is the controller currently performing a frame transfer?

std::vector<std::string> activate_commands#

Public Static Functions

template<class T>
static void dothread_deinterlace(DeInterlace<T> &deinterlace, int cols, int rows, int section, int nthreads)#
struct frameinfo_t#

Public Members

int tid#

use fpbcount as the thread ID here

int framenum#

the current frame from ARC_API’s fcount, counts from 1

int rows#

number of rows in this frame

int cols#

number of cols in this frame

void *buf#

pointer to the start of memory holding this frame

bool inuse#

this thread ID is in use, set when thread is spawned, cleared when handle_frame is done

struct readout_info_t#

Public Members

ReadoutType readout_type#

enum for readout type

uint32_t readout_arg#

argument for Arc firmware command

struct Status#

Public Functions

Status() = default#
inline Status(const Status &o)#
inline Status &operator=(const Status &o)#
inline bool operator==(const Status &other) const#

Public Members

bool in_readout = {false}#
std::atomic<bool> can_expose = {true}#
bool is_exposing = {false}#
bool is_paused = {false}#
bool is_shutteropen = {false}#