API
outletController_tests::outletControllerTest Struct Reference
Inheritance diagram for outletController_tests::outletControllerTest:
Inheritance graph
Collaboration diagram for outletController_tests::outletControllerTest:
Collaboration graph

Public Member Functions

 outletControllerTest ()
 
virtual int updateOutletState (int outletNum)
 Get the state of the outlet from the device. More...
 
virtual int turnOutletOn (int outletNum)
 Turn an outlet on. More...
 
virtual int turnOutletOff (int outletNum)
 Turn an outlet off. More...
 
int setupConfig (mx::app::appConfigurator &config)
 Setup an application configurator for an outletController. More...
 
int loadConfig (mx::app::appConfigurator &config)
 Load the [channel] sections from an application configurator. More...
 
int setNumberOfOutlets (int numOuts)
 Sets the number of outlets. This should be called by the derived class constructor. More...
 
int outletState (int outletNum)
 Get the currently stored outlet state, without updating from device. More...
 
virtual int updateOutletStates ()
 Get the states of all outlets from the device. More...
 
size_t numChannels ()
 Get the number of channels. More...
 
std::vector< size_t > channelOutlets (const std::string &channel)
 Get the vector of outlet indices for a channel. More...
 
std::vector< size_t > channelOnOrder (const std::string &channel)
 Get the vector of outlet on orders for a channel. More...
 
std::vector< size_t > channelOffOrder (const std::string &channel)
 Get the vector of outlet off orders for a channel. More...
 
std::vector< unsigned > channelOnDelays (const std::string &channel)
 Get the vector of outlet on delays for a channel. More...
 
std::vector< unsigned > channelOffDelays (const std::string &channel)
 Get the vector of outlet off delays for a channel. More...
 
int channelState (const std::string &channel)
 Get the state of a channel. More...
 
int turnChannelOn (const std::string &channel)
 Turn a channel on. More...
 
int turnChannelOff (const std::string &channel)
 Turn a channel off. More...
 

Public Attributes

std::vector< double > m_timestamps
 
bool m_firstOne
 Flag is true if the first outlet is numbered 1, otherwise assumes starting at 0. More...
 
std::vector< int > m_outletStates
 The current states of each outlet. These MUST be updated by derived classes in the overridden updatedOutletState. More...
 
pcf::IndiProperty m_indiP_outletStates
 Indi Property to show individual outlet states. More...
 
std::unordered_map< std::string, channelSpec > m_channels
 The map of channel specifications, which can be accessed by their names. More...
 
pcf::IndiProperty m_indiP_chOutlets
 An INDI property which publishes the outlets associated with each channel. Useful for GUIs, etc. More...
 
pcf::IndiProperty m_indiP_chOnDelays
 An INDI property which publishes the total on delay for each channel. Useful for GUIs, etc. More...
 
pcf::IndiProperty m_indiP_chOffDelays
 An INDI property which publishes the total off delay for each channel. Useful for GUIs, etc. More...
 

Private Member Functions

outletControllerTestderived ()
 

INDI Setup

int newCallBack_channels (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the new request. More...
 
int setupINDI ()
 Setup the INDI properties for this device controller. More...
 
int updateINDI ()
 Update the INDI properties for this device controller. More...
 
static int st_newCallBack_channels (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for the channel properties. More...
 

Detailed Description

Definition at line 13 of file outletController_test.cpp.

Constructor & Destructor Documentation

◆ outletControllerTest()

outletController_tests::outletControllerTest::outletControllerTest ( )
inline

Definition at line 17 of file outletController_test.cpp.

Member Function Documentation

◆ channelOffDelays()

std::vector< unsigned > MagAOX::app::dev::outletController< outletControllerTest >::channelOffDelays ( const std::string &  channel)
inherited

Get the vector of outlet off delays for a channel.

Mainly used for testing.

Returns
the m_offDelays member of the channelSpec specified by its name.
Parameters
[in]channelthe name of the channel

Definition at line 225 of file outletController.hpp.

◆ channelOffOrder()

std::vector< size_t > MagAOX::app::dev::outletController< outletControllerTest >::channelOffOrder ( const std::string &  channel)
inherited

Get the vector of outlet off orders for a channel.

Mainly used for testing.

Returns
the m_offOrder member of the channelSpec specified by its name.
Parameters
[in]channelthe name of the channel

Definition at line 211 of file outletController.hpp.

◆ channelOnDelays()

std::vector< unsigned > MagAOX::app::dev::outletController< outletControllerTest >::channelOnDelays ( const std::string &  channel)
inherited

Get the vector of outlet on delays for a channel.

Mainly used for testing.

Returns
the m_onDelays member of the channelSpec specified by its name.
Parameters
[in]channelthe name of the channel

Definition at line 218 of file outletController.hpp.

◆ channelOnOrder()

std::vector< size_t > MagAOX::app::dev::outletController< outletControllerTest >::channelOnOrder ( const std::string &  channel)
inherited

Get the vector of outlet on orders for a channel.

Mainly used for testing.

Returns
the m_onOrder member of the channelSpec specified by its name.
Parameters
[in]channelthe name of the channel

Definition at line 204 of file outletController.hpp.

◆ channelOutlets()

std::vector< size_t > MagAOX::app::dev::outletController< outletControllerTest >::channelOutlets ( const std::string &  channel)
inherited

Get the vector of outlet indices for a channel.

Mainly used for testing.

Returns
the m_outlets member of the channelSpec specified by its name.
Parameters
[in]channelthe name of the channel

Definition at line 197 of file outletController.hpp.

◆ channelState()

int MagAOX::app::dev::outletController< outletControllerTest >::channelState ( const std::string &  channel)
inherited

Get the state of a channel.

Returns
OUTLET_STATE_UNKNOWN if the state is not known
OUTLET_STATE_OFF if the channel is off (all outlets off)
OUTLET_STATE_INTERMEDIATE if outlets are intermediate or not in the same state
OUTLET_STATE_ON if channel is on (all outlets on)
Parameters
[in]channelthe name of the channel

Definition at line 234 of file outletController.hpp.

◆ derived()

Definition at line 294 of file outletController.hpp.

◆ loadConfig()

int MagAOX::app::dev::outletController< outletControllerTest >::loadConfig ( mx::app::appConfigurator &  config)
inherited

Load the [channel] sections from an application configurator.

Any "unused" section from the config parser is analyzed to determine if it is a channel specification. If it contains the outlet or outlets keyword, then it is considered a channel. outlet and outlets are equivalent, and specify the one or more device outlets included in this channel (i.e. this may be a vector value entry).

This function then looks for onOrder and offOrder keywords, which specify the order outlets are turned on or off by their indices in the vector specified by the outlet/outlets keyword (i.e not the outlet numbers).

Next it looks for onDelays and offDelays, which specify the delays between outlet operations in milliseconds. The first entry is always ignored, then the second entry specifies the delay between the first and second outlet operation, etc.

An example config file section is:

[sue]           #this channel will be named sue
outlets=4,5     #this channel uses outlets 4 and 5
onOrder=1,0     #outlet 5 will be turned on first
offOrder=0,1    #Outlet 4 will be turned off first
onDelays=0,150  #a 150 msec delay between outlet turn on
offDelays=0,345 #a 345 msec delay between outlet turn off
Returns
0 on success
-1 on failure
Todo:
test this error
Todo:
error checking on outlets
Todo:
test this error
Todo:
error checking on offOrder, should complain if not same length
Todo:
error checking on onDelays, should complain if not same length
Todo:
error checking on offDelays, should complain if not same length
Parameters
[in]configan application configuration from which to load values

Definition at line 141 of file outletController.hpp.

◆ newCallBack_channels()

int MagAOX::app::dev::outletController< outletControllerTest >::newCallBack_channels ( const pcf::IndiProperty &  ipRecv)
inherited

The callback called by the static version, to actually process the new request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 271 of file outletController.hpp.

◆ numChannels()

size_t MagAOX::app::dev::outletController< outletControllerTest >::numChannels
inherited

Get the number of channels.

Returns
the number of entries in m_channels.

Definition at line 190 of file outletController.hpp.

◆ outletState()

int MagAOX::app::dev::outletController< outletControllerTest >::outletState ( int  outletNum)
inherited

Get the currently stored outlet state, without updating from device.

Definition at line 151 of file outletController.hpp.

◆ setNumberOfOutlets()

int MagAOX::app::dev::outletController< outletControllerTest >::setNumberOfOutlets ( int  numOuts)
inherited

Sets the number of outlets. This should be called by the derived class constructor.

Returns
0 on success
-1 on failure
Parameters
[in]numOutsthe number of outlets to allocate

Definition at line 148 of file outletController.hpp.

◆ setupConfig()

int MagAOX::app::dev::outletController< outletControllerTest >::setupConfig ( mx::app::appConfigurator &  config)
inherited

Setup an application configurator for an outletController.

This is currently a no-op

Returns
0 on success
-1 on failure
Parameters
[in]configan application configuration to setup

Definition at line 113 of file outletController.hpp.

◆ setupINDI()

Setup the INDI properties for this device controller.

This should be called in the appStartup function of the derived MagAOXApp.

Todo:
change this to be appStartup like other devs.
Returns
0 on success.
-1 on error.

Definition at line 279 of file outletController.hpp.

◆ st_newCallBack_channels()

int MagAOX::app::dev::outletController< outletControllerTest >::st_newCallBack_channels ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
staticinherited

The static callback function to be registered for the channel properties.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to derivedT.
[in]ipRecvthe INDI property sent with the the new property request.

Definition at line 262 of file outletController.hpp.

◆ turnChannelOff()

int MagAOX::app::dev::outletController< outletControllerTest >::turnChannelOff ( const std::string &  channel)
inherited

Turn a channel off.

This implements the outlet order and delay logic.

Returns
0 on success.
-1 on error.
Parameters
[in]channelthe name of the channel to turn on

Definition at line 250 of file outletController.hpp.

◆ turnChannelOn()

int MagAOX::app::dev::outletController< outletControllerTest >::turnChannelOn ( const std::string &  channel)
inherited

Turn a channel on.

This implements the outlet order and delay logic.

Returns
0 on success.
-1 on error.
Parameters
[in]channelthe name of the channel to turn on

Definition at line 242 of file outletController.hpp.

◆ turnOutletOff()

virtual int outletController_tests::outletControllerTest::turnOutletOff ( int  outletNum)
inlinevirtual

Turn an outlet off.

This will be implemented in derived classes to turn an outlet off.

Returns
0 on success.
-1 on error.
Parameters
[in]outletNumthe outlet number to turn off

Implements MagAOX::app::dev::outletController< outletControllerTest >.

Definition at line 42 of file outletController_test.cpp.

Referenced by outletControllerTest().

◆ turnOutletOn()

virtual int outletController_tests::outletControllerTest::turnOutletOn ( int  outletNum)
inlinevirtual

Turn an outlet on.

This will be implemented in derived classes to turn an outlet on.

Returns
0 on success.
-1 on error.
Parameters
[in]outletNumthe outlet number to turn on

Implements MagAOX::app::dev::outletController< outletControllerTest >.

Definition at line 33 of file outletController_test.cpp.

◆ updateINDI()

Update the INDI properties for this device controller.

You should call this after updating the outlet states. It is not called automatically.

Returns
0 on success.
-1 on error.

Definition at line 288 of file outletController.hpp.

◆ updateOutletState()

virtual int outletController_tests::outletControllerTest::updateOutletState ( int  outletNum)
inlinevirtual

Get the state of the outlet from the device.

This will be implemented in derived classes to update the outlet state.

Todo:
this is declared pure virtual, but there is an implementation.
Returns
0 on success.
-1 on error.
Parameters
[in]outletNumthe outlet number to update

Implements MagAOX::app::dev::outletController< outletControllerTest >.

Definition at line 27 of file outletController_test.cpp.

◆ updateOutletStates()

int MagAOX::app::dev::outletController< outletControllerTest >::updateOutletStates
virtualinherited

Get the states of all outlets from the device.

The default implementation for-loops through each outlet, calling updateOutletState. Can be re-implemented in derived classes to update the outlet states.

Returns
0 on success.
-1 on error.

Definition at line 168 of file outletController.hpp.

Member Data Documentation

◆ m_channels

std::unordered_map<std::string, channelSpec> MagAOX::app::dev::outletController< outletControllerTest >::m_channels
inherited

The map of channel specifications, which can be accessed by their names.

Definition at line 95 of file outletController.hpp.

◆ m_firstOne

Flag is true if the first outlet is numbered 1, otherwise assumes starting at 0.

Definition at line 70 of file outletController.hpp.

◆ m_indiP_chOffDelays

pcf::IndiProperty MagAOX::app::dev::outletController< outletControllerTest >::m_indiP_chOffDelays
inherited

An INDI property which publishes the total off delay for each channel. Useful for GUIs, etc.

Definition at line 104 of file outletController.hpp.

◆ m_indiP_chOnDelays

pcf::IndiProperty MagAOX::app::dev::outletController< outletControllerTest >::m_indiP_chOnDelays
inherited

An INDI property which publishes the total on delay for each channel. Useful for GUIs, etc.

Definition at line 101 of file outletController.hpp.

◆ m_indiP_chOutlets

pcf::IndiProperty MagAOX::app::dev::outletController< outletControllerTest >::m_indiP_chOutlets
inherited

An INDI property which publishes the outlets associated with each channel. Useful for GUIs, etc.

Definition at line 98 of file outletController.hpp.

◆ m_indiP_outletStates

pcf::IndiProperty MagAOX::app::dev::outletController< outletControllerTest >::m_indiP_outletStates
inherited

Indi Property to show individual outlet states.

Definition at line 74 of file outletController.hpp.

◆ m_outletStates

std::vector<int> MagAOX::app::dev::outletController< outletControllerTest >::m_outletStates
inherited

The current states of each outlet. These MUST be updated by derived classes in the overridden updatedOutletState.

Definition at line 72 of file outletController.hpp.

◆ m_timestamps

std::vector<double> outletController_tests::outletControllerTest::m_timestamps

The documentation for this struct was generated from the following file: