TwiceAsNice  2019-02-18
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Basda::UniModLCDevice Class Reference

#include <LCDevice.h>

Inheritance diagram for Basda::UniModLCDevice:
Inheritance graph
Collaboration diagram for Basda::UniModLCDevice:
Collaboration graph

Public Member Functions

 UniModLCDevice (const Nice::JointPtr &_config)
 
virtual ~UniModLCDevice ()
 
std::string createConnectionID (const std::string &_address, const unsigned int _cardNo, const unsigned int _moduleNo)
 This method creates an ID based on the connection address, card number and module number separated by a colon to identify the module/card object in a map. More...
 
virtual void open ()
 This method might be called when the service goes in the INIT state. More...
 
virtual void close ()
 This method might be called when the service goes in the OFFLINE state. More...
 
virtual void reset (Basda::DeviceAsync &=Basda::Device::s_async)
 This method might be called when the service will be reseted. More...
 
virtual void version ()
 This method returns the version string of the device. More...
 
virtual void init (DeviceAsync &=Basda::Device::s_async)
 This method initialize the device and set the state to INIT. More...
 
virtual void deinit (DeviceAsync &=Basda::Device::s_async)
 This method deinitialize the device and set the state to OFFLINE. More...
 
virtual void activate (DeviceAsync &=Basda::Device::s_async)
 activate something More...
 
virtual void deactivate (DeviceAsync &=Basda::Device::s_async)
 deactivate something More...
 
void setLinkTimeout (Nice::Time _tcpConnectionTimeout)
 
virtual Nice::SeqTime getLinkTimeout ()
 
virtual bool isReachable ()
 
virtual Nice::BitSet read ()
 read from the device all ports. More...
 
virtual void write (Nice::BitSet _collision)
 
virtual enum Basda::DigitalIODevice::PortState readOutputPort (int index)
 
virtual void setOutputPort (int portIndex, enum PortState desiredState)
 
virtual void setIntensity (std::string _lightSource, unsigned int _intensity)
 
virtual Nice::MapStringInt getIntensity ()
 
virtual void switchOn (unsigned int _intensity)
 
virtual void switchOff ()
 
virtual Nice::JointPtrVector description ()
 read description More...
 
void setChatType (std::map< std::string, Nice::ChatLinePtr > _chat)
 
 UniModLCDevice (const Nice::JointPtr &_config)
 
virtual ~UniModLCDevice ()
 
std::string createConnectionID (const std::string &_address, const unsigned int _cardNo, const unsigned int _moduleNo)
 This method creates an ID based on the connection address, card number and module number separated by a colon to identify the module/card object in a map. More...
 
virtual void open ()
 This method might be called when the service goes in the INIT state. More...
 
virtual void close ()
 This method might be called when the service goes in the OFFLINE state. More...
 
virtual void reset (Basda::DeviceAsync &=Basda::Device::s_async)
 This method might be called when the service will be reseted. More...
 
virtual void version ()
 This method returns the version string of the device. More...
 
virtual void init (DeviceAsync &=Basda::Device::s_async)
 This method initialize the device and set the state to INIT. More...
 
virtual void deinit (DeviceAsync &=Basda::Device::s_async)
 This method deinitialize the device and set the state to OFFLINE. More...
 
virtual void activate (DeviceAsync &=Basda::Device::s_async)
 activate something More...
 
virtual void deactivate (DeviceAsync &=Basda::Device::s_async)
 deactivate something More...
 
void setLinkTimeout (Nice::Time _tcpConnectionTimeout)
 
virtual Nice::SeqTime getLinkTimeout ()
 
virtual bool isReachable ()
 
virtual Nice::BitSet read ()
 read from the device all ports. More...
 
virtual void write (Nice::BitSet _collision)
 
virtual enum Basda::DigitalIODevice::PortState readOutputPort (int index)
 
virtual void setOutputPort (int portIndex, enum PortState desiredState)
 
virtual void setIntensity (std::string _lightSource, unsigned int _intensity)
 
virtual Nice::MapStringInt getIntensity ()
 
virtual void switchOn (unsigned int _intensity)
 
virtual void switchOff ()
 
virtual Nice::JointPtrVector description ()
 read description More...
 
void setChatType (std::map< std::string, Nice::ChatLinePtr > _chat)
 
- Public Member Functions inherited from Basda::MoccaLCDevice
 MoccaLCDevice (const Nice::JointPtr &_config)
 Constructor. More...
 
virtual ~MoccaLCDevice ()
 Constructor. More...
 
 MoccaLCDevice (const Nice::JointPtr &_config)
 Constructor. More...
 
virtual ~MoccaLCDevice ()
 Constructor. More...
 
 MoccaLCDevice (const Nice::JointPtr &_config)
 Constructor. More...
 
virtual ~MoccaLCDevice ()
 Constructor. More...
 
- Public Member Functions inherited from Basda::DigitalIODevice
 DigitalIODevice (const Nice::JointPtr &_config)
 
 DigitalIODevice (const Nice::JointPtr &_config)
 
 DigitalIODevice (const Nice::JointPtr &_config)
 
- Public Member Functions inherited from Basda::Device
 Device (const Nice::JointPtr &_config)
 constructor. This is an elementary (lazy) action which stores the name and gets configuration. More...
 
virtual ~Device ()
 destructor Does nothing More...
 
virtual void setConfig (const Nice::JointPtr &_config)
 init with config tree ptr More...
 
Nice::JointPtrconfig ()
 retrieve the property tree More...
 
std::string & name ()
 retrieve the name set at ctor time. More...
 
 Device (const Nice::JointPtr &_config)
 constructor. This is an elementary (lazy) action which stores the name and gets configuration. More...
 
virtual ~Device ()
 destructor Does nothing More...
 
virtual void setConfig (const Nice::JointPtr &_config)
 init with config tree ptr More...
 
Nice::JointPtrconfig ()
 retrieve the property tree More...
 
std::string & name ()
 retrieve the name set at ctor time. More...
 

Private Member Functions

void createInstances ()
 
void addProperties ()
 
void setIsReachable (const bool _isReachable)
 
void createInstances ()
 
void addProperties ()
 
void setIsReachable (const bool _isReachable)
 

Private Attributes

std::map< std::string, MPIACoreProtocolPtrm_protocol
 This member keeps all connection to the UniMod. More...
 
std::map< std::string, UniModCardPtrm_card
 This member keeps all card objects. More...
 
std::map< std::string, UniModModuleLightSourcePtrm_module
 This member keeps all module objects. More...
 
std::map< std::string, Nice::ChatLinePtrm_chat
 This member keeps all chat objects. More...
 
bool m_isReachable
 
Nice::Mutex m_mutex
 
Nice::Completion m_completion
 

Additional Inherited Members

- Public Types inherited from Basda::DigitalIODevice
enum  PortState {
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1, PORT_STATE_OFF = 0, PORT_STATE_ON = 1,
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1
}
 
enum  PortState {
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1, PORT_STATE_OFF = 0, PORT_STATE_ON = 1,
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1
}
 
enum  PortState {
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1, PORT_STATE_OFF = 0, PORT_STATE_ON = 1,
  PORT_STATE_OFF = 0, PORT_STATE_ON = 1
}
 
- Static Public Attributes inherited from Basda::Device
static DeviceAsyncImpl s_async
 
- Protected Types inherited from Basda::MoccaLCDevice
enum  CMDS {
  OPEN, CLOSE, RESET, INIT,
  DEINIT, ACTIVATE, DEACTIVATE, READ,
  WRITE, READOUTPUTPORT, SETOUTPUTPORT, OPEN,
  CLOSE, RESET, INIT, DEINIT,
  ACTIVATE, DEACTIVATE, READ, WRITE,
  READOUTPUTPORT, SETOUTPUTPORT, OPEN, CLOSE,
  RESET, INIT, DEINIT, ACTIVATE,
  DEACTIVATE, READ, WRITE, READOUTPUTPORT,
  SETOUTPUTPORT
}
 
enum  CMDS {
  OPEN, CLOSE, RESET, INIT,
  DEINIT, ACTIVATE, DEACTIVATE, READ,
  WRITE, READOUTPUTPORT, SETOUTPUTPORT, OPEN,
  CLOSE, RESET, INIT, DEINIT,
  ACTIVATE, DEACTIVATE, READ, WRITE,
  READOUTPUTPORT, SETOUTPUTPORT, OPEN, CLOSE,
  RESET, INIT, DEINIT, ACTIVATE,
  DEACTIVATE, READ, WRITE, READOUTPUTPORT,
  SETOUTPUTPORT
}
 
enum  CMDS {
  OPEN, CLOSE, RESET, INIT,
  DEINIT, ACTIVATE, DEACTIVATE, READ,
  WRITE, READOUTPUTPORT, SETOUTPUTPORT, OPEN,
  CLOSE, RESET, INIT, DEINIT,
  ACTIVATE, DEACTIVATE, READ, WRITE,
  READOUTPUTPORT, SETOUTPUTPORT, OPEN, CLOSE,
  RESET, INIT, DEINIT, ACTIVATE,
  DEACTIVATE, READ, WRITE, READOUTPUTPORT,
  SETOUTPUTPORT
}
 
- Protected Attributes inherited from Basda::MoccaLCDevice
Nice::Completion m_completion
 
- Protected Attributes inherited from Basda::Device
Nice::JointPtr m_config
 
Nice::JointPtr m_cfg
 
Nice::JointPtr m_var
 
std::string m_name
 

Constructor & Destructor Documentation

◆ UniModLCDevice() [1/2]

Basda::UniModLCDevice::UniModLCDevice ( const Nice::JointPtr _config)

◆ ~UniModLCDevice() [1/2]

Basda::UniModLCDevice::~UniModLCDevice ( )
virtual

◆ UniModLCDevice() [2/2]

Basda::UniModLCDevice::UniModLCDevice ( const Nice::JointPtr _config)

◆ ~UniModLCDevice() [2/2]

virtual Basda::UniModLCDevice::~UniModLCDevice ( )
virtual

Member Function Documentation

◆ activate() [1/2]

void Basda::UniModLCDevice::activate ( DeviceAsync _async = Basda::Device::s_async)
virtual

activate something

Parameters
_asynchthe call back object
Todo:
implementation of the service activation

Implements Basda::Device.

◆ activate() [2/2]

virtual void Basda::UniModLCDevice::activate ( DeviceAsync = Basda::Device::s_async)
virtual

activate something

Parameters
_asynchthe call back object
Todo:
implementation of the service activation

Implements Basda::Device.

◆ addProperties() [1/2]

void Basda::UniModLCDevice::addProperties ( )
private

◆ addProperties() [2/2]

void Basda::UniModLCDevice::addProperties ( )
private

◆ close() [1/2]

void Basda::UniModLCDevice::close ( void  )
virtual

This method might be called when the service goes in the OFFLINE state.

The connection to the collision controller will be closed.

Todo:
implementation of the OFFLINE state

Implements Basda::Device.

◆ close() [2/2]

virtual void Basda::UniModLCDevice::close ( )
virtual

This method might be called when the service goes in the OFFLINE state.

The connection to the collision controller will be closed.

Todo:
implementation of the OFFLINE state

Implements Basda::Device.

◆ createConnectionID() [1/2]

std::string Basda::UniModLCDevice::createConnectionID ( const std::string &  _address,
const unsigned int  _cardNo,
const unsigned int  _moduleNo 
)

This method creates an ID based on the connection address, card number and module number separated by a colon to identify the module/card object in a map.

Parameters
_addressthe connection string
_cardNothe card number
_moduleNothe module number

◆ createConnectionID() [2/2]

std::string Basda::UniModLCDevice::createConnectionID ( const std::string &  _address,
const unsigned int  _cardNo,
const unsigned int  _moduleNo 
)

This method creates an ID based on the connection address, card number and module number separated by a colon to identify the module/card object in a map.

Parameters
_addressthe connection string
_cardNothe card number
_moduleNothe module number

◆ createInstances() [1/2]

void Basda::UniModLCDevice::createInstances ( )
private

◆ createInstances() [2/2]

void Basda::UniModLCDevice::createInstances ( )
private

◆ deactivate() [1/2]

void Basda::UniModLCDevice::deactivate ( DeviceAsync _async = Basda::Device::s_async)
virtual

deactivate something

Parameters
_asynchthe call back object
Todo:
implementation of the service deactivation

Implements Basda::Device.

◆ deactivate() [2/2]

virtual void Basda::UniModLCDevice::deactivate ( DeviceAsync = Basda::Device::s_async)
virtual

deactivate something

Parameters
_asynchthe call back object
Todo:
implementation of the service deactivation

Implements Basda::Device.

◆ deinit() [1/2]

virtual void Basda::UniModLCDevice::deinit ( DeviceAsync = Basda::Device::s_async)
virtual

This method deinitialize the device and set the state to OFFLINE.

Parameters
_asynchthe call back object
Todo:
implementation of the OFFLINE state

Implements Basda::Device.

◆ deinit() [2/2]

void Basda::UniModLCDevice::deinit ( DeviceAsync _async = Basda::Device::s_async)
virtual

This method deinitialize the device and set the state to OFFLINE.

Parameters
_asynchthe call back object
Todo:
implementation of the OFFLINE state

Implements Basda::Device.

◆ description() [1/2]

virtual Nice::JointPtrVector Basda::UniModLCDevice::description ( )
inlinevirtual

read description

Implements Basda::DigitalIODevice.

◆ description() [2/2]

virtual Nice::JointPtrVector Basda::UniModLCDevice::description ( )
inlinevirtual

read description

Implements Basda::DigitalIODevice.

◆ getIntensity() [1/2]

Nice::MapStringInt Basda::UniModLCDevice::getIntensity ( )
virtual

Implements Basda::MoccaLCDevice.

◆ getIntensity() [2/2]

virtual Nice::MapStringInt Basda::UniModLCDevice::getIntensity ( )
virtual

Implements Basda::MoccaLCDevice.

◆ getLinkTimeout() [1/2]

virtual Nice::SeqTime Basda::UniModLCDevice::getLinkTimeout ( )
virtual

Implements Basda::MoccaLCDevice.

◆ getLinkTimeout() [2/2]

Nice::SeqTime Basda::UniModLCDevice::getLinkTimeout ( )
virtual

Implements Basda::MoccaLCDevice.

◆ init() [1/2]

void Basda::UniModLCDevice::init ( DeviceAsync = Basda::Device::s_async)
virtual

This method initialize the device and set the state to INIT.

Parameters
_asynchthe call back object
Todo:
implementation of the INIT state

Implements Basda::Device.

◆ init() [2/2]

virtual void Basda::UniModLCDevice::init ( DeviceAsync = Basda::Device::s_async)
virtual

This method initialize the device and set the state to INIT.

Parameters
_asynchthe call back object
Todo:
implementation of the INIT state

Implements Basda::Device.

◆ isReachable() [1/2]

virtual bool Basda::UniModLCDevice::isReachable ( )
virtual

Implements Basda::MoccaLCDevice.

◆ isReachable() [2/2]

bool Basda::UniModLCDevice::isReachable ( )
virtual

Implements Basda::MoccaLCDevice.

◆ open() [1/2]

void Basda::UniModLCDevice::open ( void  )
virtual

This method might be called when the service goes in the INIT state.

It connects to the collision controller.

Todo:
implementation of the INIT state

Implements Basda::Device.

◆ open() [2/2]

virtual void Basda::UniModLCDevice::open ( )
virtual

This method might be called when the service goes in the INIT state.

It connects to the collision controller.

Todo:
implementation of the INIT state

Implements Basda::Device.

◆ read() [1/2]

virtual Nice::BitSet Basda::UniModLCDevice::read ( )
virtual

read from the device all ports.

Implements Basda::DigitalIODevice.

◆ read() [2/2]

Nice::BitSet Basda::UniModLCDevice::read ( )
virtual

read from the device all ports.

Implements Basda::DigitalIODevice.

◆ readOutputPort() [1/2]

virtual enum Basda::DigitalIODevice::PortState Basda::UniModLCDevice::readOutputPort ( int  index)
virtual

◆ readOutputPort() [2/2]

enum Basda::DigitalIODevice::PortState Basda::UniModLCDevice::readOutputPort ( int  index)
virtual

◆ reset() [1/2]

void Basda::UniModLCDevice::reset ( Basda::DeviceAsync _async = Basda::Device::s_async)
virtual

This method might be called when the service will be reseted.

The connection to the UniMod will be closed and opened again.

Parameters
_asynchthe call back object
Todo:
implementation to reset the service

Implements Basda::Device.

◆ reset() [2/2]

virtual void Basda::UniModLCDevice::reset ( Basda::DeviceAsync = Basda::Device::s_async)
virtual

This method might be called when the service will be reseted.

The connection to the UniMod will be closed and opened again.

Parameters
_asynchthe call back object
Todo:
implementation to reset the service

Implements Basda::Device.

◆ setChatType() [1/2]

void Basda::UniModLCDevice::setChatType ( std::map< std::string, Nice::ChatLinePtr _chat)

◆ setChatType() [2/2]

void Basda::UniModLCDevice::setChatType ( std::map< std::string, Nice::ChatLinePtr _chat)

◆ setIntensity() [1/2]

virtual void Basda::UniModLCDevice::setIntensity ( std::string  _lightSource,
unsigned int  _intensity 
)
virtual

Implements Basda::MoccaLCDevice.

◆ setIntensity() [2/2]

void Basda::UniModLCDevice::setIntensity ( std::string  _lightSource,
unsigned int  _intensity 
)
virtual

Implements Basda::MoccaLCDevice.

◆ setIsReachable() [1/2]

void Basda::UniModLCDevice::setIsReachable ( const bool  _isReachable)
private

◆ setIsReachable() [2/2]

void Basda::UniModLCDevice::setIsReachable ( const bool  _isReachable)
private

◆ setLinkTimeout() [1/2]

void Basda::UniModLCDevice::setLinkTimeout ( Nice::Time  _tcpConnectionTimeout)
virtual

Implements Basda::MoccaLCDevice.

◆ setLinkTimeout() [2/2]

void Basda::UniModLCDevice::setLinkTimeout ( Nice::Time  _tcpConnectionTimeout)
virtual

Implements Basda::MoccaLCDevice.

◆ setOutputPort() [1/2]

void Basda::UniModLCDevice::setOutputPort ( int  portIndex,
enum PortState  desiredState 
)
virtual

◆ setOutputPort() [2/2]

virtual void Basda::UniModLCDevice::setOutputPort ( int  portIndex,
enum PortState  desiredState 
)
virtual

◆ switchOff() [1/2]

void Basda::UniModLCDevice::switchOff ( )
virtual

Implements Basda::MoccaLCDevice.

◆ switchOff() [2/2]

virtual void Basda::UniModLCDevice::switchOff ( )
virtual

Implements Basda::MoccaLCDevice.

◆ switchOn() [1/2]

void Basda::UniModLCDevice::switchOn ( unsigned int  _intensity)
virtual

Implements Basda::MoccaLCDevice.

◆ switchOn() [2/2]

virtual void Basda::UniModLCDevice::switchOn ( unsigned int  _intensity)
virtual

Implements Basda::MoccaLCDevice.

◆ version() [1/2]

virtual void Basda::UniModLCDevice::version ( )
virtual

This method returns the version string of the device.

Todo:
implementation of the version string

Implements Basda::Device.

◆ version() [2/2]

void Basda::UniModLCDevice::version ( void  )
virtual

This method returns the version string of the device.

Todo:
implementation of the version string

Implements Basda::Device.

◆ write() [1/2]

void Basda::UniModLCDevice::write ( Nice::BitSet  _collision)
virtual

◆ write() [2/2]

virtual void Basda::UniModLCDevice::write ( Nice::BitSet  _collision)
virtual

Member Data Documentation

◆ m_card

std::map< std::string, UniModCardPtr > Basda::UniModLCDevice::m_card
private

This member keeps all card objects.

The key is the connection ID which is composed by the connection address, the card number and the module number.

◆ m_chat

std::map< std::string, Nice::ChatLinePtr > Basda::UniModLCDevice::m_chat
private

This member keeps all chat objects.

The original Nice::Chat::Line object can be exchanged with a Chat::LineMock object to simulate the UniMod behavior.

◆ m_completion

Nice::Completion Basda::UniModLCDevice::m_completion
private

◆ m_isReachable

bool Basda::UniModLCDevice::m_isReachable
private

◆ m_module

std::map< std::string, UniModModuleLightSourcePtr > Basda::UniModLCDevice::m_module
private

This member keeps all module objects.

The key is the connection ID which is composed by the connection address, the card number and the module number.

◆ m_mutex

Nice::Mutex Basda::UniModLCDevice::m_mutex
private

◆ m_protocol

std::map< std::string, MPIACoreProtocolPtr > Basda::UniModLCDevice::m_protocol
private

This member keeps all connection to the UniMod.

The key is the connection address.


The documentation for this class was generated from the following files: