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]channel[in] the name of the channel

Definition at line 458 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]channel[in] the name of the channel

Definition at line 446 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]channel[in] the name of the channel

Definition at line 452 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]channel[in] the name of the channel

Definition at line 440 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]channel[in] the name of the channel

Definition at line 434 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]channel[in] the name of the channel

Definition at line 464 of file outletController.hpp.

◆ derived()

Definition at line 280 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]config[in] an application configuration from which to load values

Definition at line 295 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]ipRecv[in] the INDI property sent with the the new property request.

Definition at line 628 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 428 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 410 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]numOuts[in] the number of outlets to allocate

Definition at line 403 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]config[in] an application configuration to setup

Definition at line 287 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 673 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]app[in] a pointer to this, will be static_cast-ed to derivedT.
[in]ipRecv[in] the INDI property sent with the the new property request.

Definition at line 620 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]channel[in] the name of the channel to turn on

Definition at line 550 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]channel[in] the name of the channel to turn on

Definition at line 477 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]outletNum[in] the 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]outletNum[in] the 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 790 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]outletNum[in] the 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 416 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 81 of file outletController.hpp.

◆ m_firstOne

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

Definition at line 56 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 90 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 87 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 84 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 60 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 58 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: