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

This class implements the communication protocol to the MPIA in-house electronic boxes like MoCon, CoCon, UniMod and RoCon. More...

#include <Protocol.h>

Inheritance diagram for Basda::MPIACoreProtocol:
Inheritance graph
Collaboration diagram for Basda::MPIACoreProtocol:
Collaboration graph

Public Member Functions

 MPIACoreProtocol (std::string _name, std::string _versionDeviceName, double _cosNumberRequired, double _controllerNumberRequired, Nice::JointPtr _config, const Nice::ChatLinePtr &_myDevice=new Nice::ChatLine())
 Constructor. More...
 
 ~MPIACoreProtocol ()
 Destructor. More...
 
std::string name ()
 
void open ()
 This method opens the connection to the MPIA in-house electronic and reserve the module and card. More...
 
void close ()
 This method close the connection to the MPIA in-house electronic. More...
 
bool isConnected ()
 This method return true if a connection is established. More...
 
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...
 
void addEventHandle (const unsigned int _cardNo, const unsigned int _moduleNo, Basda::Handler *_eventHandle)
 Adds the event handler to the internal list. More...
 
void checkVersion ()
 
void get (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const std::string &_paramter="", const unsigned int _numberOfLines=-1)
 Send the request to the MPIA in-house electronic box and read the response. More...
 
void receiveData (const unsigned int _commandID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const unsigned int _numberOfLines=-1)
 Read the rest response of the last request. More...
 
void receiveDataRaw (const unsigned int _commandID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const unsigned int _numberOfLines=-1)
 This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012) More...
 
void set (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const std::string &_parameter="")
 Send a string to the MPIA in-house electronic box. More...
 
template<typename T >
void set (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const T _parameter)
 Send a number to the MPIA in-house electronic box. More...
 
void waitForEvent (Nice::Time _time)
 This methods waits until an event is received or the time is expired. More...
 
void chat (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const std::string _parameter, const int _numberOfLines)
 This method send the command string to the electronic. More...
 
void dontParse (std::string &_ret)
 This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012) More...
 
void setChatType (Nice::ChatLinePtr _chat)
 
 MPIACoreProtocol (std::string _name, std::string _versionDeviceName, double _cosNumberRequired, double _controllerNumberRequired, Nice::JointPtr _config, const Nice::ChatLinePtr &_myDevice=new Nice::ChatLine())
 Constructor. More...
 
 ~MPIACoreProtocol ()
 Destructor. More...
 
std::string name ()
 
void open ()
 This method opens the connection to the MPIA in-house electronic and reserve the module and card. More...
 
void close ()
 This method close the connection to the MPIA in-house electronic. More...
 
bool isConnected ()
 This method return true if a connection is established. More...
 
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...
 
void addEventHandle (const unsigned int _cardNo, const unsigned int _moduleNo, Basda::Handler *_eventHandle)
 Adds the event handler to the internal list. More...
 
void checkVersion ()
 
void get (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const std::string &_paramter="", const unsigned int _numberOfLines=-1)
 Send the request to the MPIA in-house electronic box and read the response. More...
 
void receiveData (const unsigned int _commandID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const unsigned int _numberOfLines=-1)
 Read the rest response of the last request. More...
 
void receiveDataRaw (const unsigned int _commandID, const unsigned int _cardNo, const unsigned int _moduleNo, std::string &_ret, const unsigned int _numberOfLines=-1)
 This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012) More...
 
void set (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const std::string &_parameter="")
 Send a string to the MPIA in-house electronic box. More...
 
template<typename T >
void set (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const T _parameter)
 Send a number to the MPIA in-house electronic box. More...
 
void waitForEvent (Nice::Time _time)
 This methods waits until an event is received or the time is expired. More...
 
void chat (const unsigned int _commandID, const unsigned int _selectID, const unsigned int _cardNo, const unsigned int _moduleNo, const std::string _parameter, const int _numberOfLines)
 This method send the command string to the electronic. More...
 
void dontParse (std::string &_ret)
 This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012) More...
 
void setChatType (Nice::ChatLinePtr _chat)
 

Private Member Functions

void parse (std::string &_ret)
 This method parse the command response to the method caller. More...
 
void parse (std::string &_ret)
 This method parse the command response to the method caller. More...
 

Private Attributes

std::string m_name
 
Nice::ChatLinePtr m_chat
 member of a MPIA in-house electronic device. More...
 
std::map< std::string, Handler * > m_eventHandler
 member of the event handling map. More...
 
Nice::Mutex m_mutex
 
std::string m_address
 member of the connection address More...
 
unsigned int m_cardNo
 member of the card number More...
 
unsigned int m_moduleNo
 member of the module number More...
 
unsigned int m_masterCardNo
 member of the master card at the MPIA in-house electronic. More...
 
std::string m_version
 member of the MPIA in-house electronic version string. More...
 
std::string m_versionModuleName
 this is the name of the device inside the version string. More...
 
double m_cosNumberRequired
 this is the version number of the chipset. More...
 
double m_controllerNumberRequired
 this is the version number of the firmware. More...
 
Nice::JointPtr m_config
 member of the root of the configuration tree More...
 

Detailed Description

This class implements the communication protocol to the MPIA in-house electronic boxes like MoCon, CoCon, UniMod and RoCon.

The MPIA in-house electronic provides a serial communication via the serial interface (RS232) and via the Ethernet. The communication protocol is according to ASCII. The commands consist of a sequence of numbers. The command syntax is as followed:

< cardNo > < commandID > < moduleNo > [ < select > ] [ < values > ]

where < cardNo > and < moduleNo > are the IDs of the card and the module. The < commandId > is the command number. The < select > parameter is provided by some commands to specify which option is defined via the < values >. The < values > can be on or more parameter separated by a space. A more detailed description can be found in the CommandIDs.h file.

This file implements the communication protocol for the MPIA in-house electronic. It generates the command string, initialize the connection, handles the communication and returns the command response.

This protocol supports also the handling of event messages coming from the MPIA in-house electronic. Each client of this class has to implement the event handler of the MPIACore class and has to pass the pointer to that handler to the method addEventHandle of this class. This class will be call back automatically if an event arrives. Error messages of the MPIA in-house electronic will be converted in exception and will be throw to the caller immediately.

At the current implementation only one connection will be created per card. Clients that are using different modules on the same card have to share the protocol object.

Author
Frank Kittmann
Version
09.06.16
Date
2009.06.16

Constructor & Destructor Documentation

◆ MPIACoreProtocol() [1/2]

Basda::MPIACoreProtocol::MPIACoreProtocol ( std::string  _name,
std::string  _versionDeviceName,
double  _cosNumberRequired,
double  _controllerNumberRequired,
Nice::JointPtr  _config,
const Nice::ChatLinePtr _myDevice = new Nice::ChatLine() 
)

Constructor.

◆ ~MPIACoreProtocol() [1/2]

Basda::MPIACoreProtocol::~MPIACoreProtocol ( )

Destructor.

◆ MPIACoreProtocol() [2/2]

Basda::MPIACoreProtocol::MPIACoreProtocol ( std::string  _name,
std::string  _versionDeviceName,
double  _cosNumberRequired,
double  _controllerNumberRequired,
Nice::JointPtr  _config,
const Nice::ChatLinePtr _myDevice = new Nice::ChatLine() 
)

Constructor.

◆ ~MPIACoreProtocol() [2/2]

Basda::MPIACoreProtocol::~MPIACoreProtocol ( )

Destructor.

Member Function Documentation

◆ addEventHandle() [1/2]

void Basda::MPIACoreProtocol::addEventHandle ( const unsigned int  _cardNo,
const unsigned int  _moduleNo,
Basda::Handler _eventHandle 
)

Adds the event handler to the internal list.

This procedure add an event handler for the current module / card to the internal call back list.

Parameters
_cardNothe card number
_moduleNothe module number (Is the module number is equal to 0, the card itself is selected.)
_eventHandlePtrthe pointer to the module / card object for the call back

◆ addEventHandle() [2/2]

void Basda::MPIACoreProtocol::addEventHandle ( const unsigned int  _cardNo,
const unsigned int  _moduleNo,
Basda::Handler _eventHandle 
)

Adds the event handler to the internal list.

This procedure add an event handler for the current module / card to the internal call back list.

Parameters
_cardNothe card number
_moduleNothe module number (Is the module number is equal to 0, the card itself is selected.)
_eventHandlePtrthe pointer to the module / card object for the call back

◆ chat() [1/2]

void Basda::MPIACoreProtocol::chat ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const std::string  _parameter,
const int  _numberOfLines 
)

This method send the command string to the electronic.

This method is set to public due to requests from Lorenzo Busoni. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Parameters
_commandIDthe command ID
_selectIDthe sub command ID
_cardNothe ID of the MPIA electronic card
_moduleNothe ID of the device module
_parameterthe parameter as string
_numberOfLinesthe number of lines that might be read
See also
dontParse*PWC00532

◆ chat() [2/2]

void Basda::MPIACoreProtocol::chat ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const std::string  _parameter,
const int  _numberOfLines 
)

This method send the command string to the electronic.

This method is set to public due to requests from Lorenzo Busoni. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Parameters
_commandIDthe command ID
_selectIDthe sub command ID
_cardNothe ID of the MPIA electronic card
_moduleNothe ID of the device module
_parameterthe parameter as string
_numberOfLinesthe number of lines that might be read
See also
dontParse*PWC00532

◆ checkVersion() [1/2]

void Basda::MPIACoreProtocol::checkVersion ( )

◆ checkVersion() [2/2]

void Basda::MPIACoreProtocol::checkVersion ( )

◆ close() [1/2]

void Basda::MPIACoreProtocol::close ( )

This method close the connection to the MPIA in-house electronic.

◆ close() [2/2]

void Basda::MPIACoreProtocol::close ( )

This method close the connection to the MPIA in-house electronic.

◆ createConnectionID() [1/2]

std::string Basda::MPIACoreProtocol::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::MPIACoreProtocol::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

◆ dontParse() [1/2]

void Basda::MPIACoreProtocol::dontParse ( std::string &  _ret)

This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012)

It supports a direct communication with the MoCon. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Hi Martin,

that's exactly what I was thinking: The use case is (real example from our experience): we discover at the telescope that we need to continuously monitor a given property (PropA) of the MoCon (obviously because of a malfunctioning in the hardware!). Without this monitor, we will be stuck. You can add the required functionality in the Mocca adding the function getPropA: this requires 4 hours and the day is lost. The day after you are stuck because you discover that you miss PropB, and the day is lost again. As an alternative, one can add the 2 lines below in the code (with a comment: "1 10 0 = getPropA") and this requires 5 minutes. The day after one can add a similar line with 1 11 0. When you're back in Europe you implement getPropA and getPropB in Mocca and you cleanup the code removing the receiveResponseForComment

Generally speaking I think it is a safe idea to have a generic interface to access EVERY possible functionality of a device, because soon or later you'll need it. In the case of the Mocon it is quite easy, a good compromise between living dangerously and wasting too much time in the effort of a complete implementation of all the MoCon commands.

Lorenzo Busoni

Parameters
_retthe allocated memory for the command response

◆ dontParse() [2/2]

void Basda::MPIACoreProtocol::dontParse ( std::string &  _ret)

This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012)

It supports a direct communication with the MoCon. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Hi Martin,

that's exactly what I was thinking: The use case is (real example from our experience): we discover at the telescope that we need to continuously monitor a given property (PropA) of the MoCon (obviously because of a malfunctioning in the hardware!). Without this monitor, we will be stuck. You can add the required functionality in the Mocca adding the function getPropA: this requires 4 hours and the day is lost. The day after you are stuck because you discover that you miss PropB, and the day is lost again. As an alternative, one can add the 2 lines below in the code (with a comment: "1 10 0 = getPropA") and this requires 5 minutes. The day after one can add a similar line with 1 11 0. When you're back in Europe you implement getPropA and getPropB in Mocca and you cleanup the code removing the receiveResponseForComment

Generally speaking I think it is a safe idea to have a generic interface to access EVERY possible functionality of a device, because soon or later you'll need it. In the case of the Mocon it is quite easy, a good compromise between living dangerously and wasting too much time in the effort of a complete implementation of all the MoCon commands.

Lorenzo Busoni

Parameters
_retthe allocated memory for the command response

◆ get() [1/2]

void Basda::MPIACoreProtocol::get ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const std::string &  _paramter = "",
const unsigned int  _numberOfLines = -1 
)

Send the request to the MPIA in-house electronic box and read the response.

This method send the request to the electronic box. The response are received and written back in the properties.

Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_selectIDthe select ID of the command, which is also defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_paramteroptional: the parameter which sent along. The default value is a empty string (nothing will be send additional).
_numberOfLinesoptional: This parameter limitates how many data should be read from the Ethernet line. Is the readout of the data is limitated by that parameter, the rest data might be read using the method receiveData. All data are read if the value is -1. In the default case all data will be read.
Returns
the return parameter is stored in _ret parameter.
See also
CommandIDs.h
Exceptions
Basda::MPIA::WrongCardNrException
Basda::MPIA::WrongCmdNrException
Basda::MPIA::WrongModuleNrException
Basda::MPIA::BadParamException
Basda::MPIA::ModuleAlreadyRegisteredException
Basda::MPIA::CmdBufOverflowException
Basda::MPIA::CANBusOverflowException
Basda::MPIA::SerialBusOverflowException
Basda::MPIA::MemoryOverflowException
Basda::MPIA::MaxClientsReachedException
Basda::MPIA::WrongPWException
Basda::MPIA::LoginNeededException
Basda::MPIA::UserKickedException
Basda::MPIA::PortIsInUseException
Basda::MPIA::ModuleIsInUseException
Basda::MPIA::ModuleNotReservedException
Basda::MPIA::HugeDataInUseException
Basda::MPIA::HugeDataTransportException
Basda::MPIA::SmallFragmentSizeException
Basda::MPIA::FatalErrorException

◆ get() [2/2]

void Basda::MPIACoreProtocol::get ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const std::string &  _paramter = "",
const unsigned int  _numberOfLines = -1 
)

Send the request to the MPIA in-house electronic box and read the response.

This method send the request to the electronic box. The response are received and written back in the properties.

Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_selectIDthe select ID of the command, which is also defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_paramteroptional: the parameter which sent along. The default value is a empty string (nothing will be send additional).
_numberOfLinesoptional: This parameter limitates how many data should be read from the Ethernet line. Is the readout of the data is limitated by that parameter, the rest data might be read using the method receiveData. All data are read if the value is -1. In the default case all data will be read.
Returns
the return parameter is stored in _ret parameter.
See also
CommandIDs.h
Exceptions
Basda::MPIA::WrongCardNrException
Basda::MPIA::WrongCmdNrException
Basda::MPIA::WrongModuleNrException
Basda::MPIA::BadParamException
Basda::MPIA::ModuleAlreadyRegisteredException
Basda::MPIA::CmdBufOverflowException
Basda::MPIA::CANBusOverflowException
Basda::MPIA::SerialBusOverflowException
Basda::MPIA::MemoryOverflowException
Basda::MPIA::MaxClientsReachedException
Basda::MPIA::WrongPWException
Basda::MPIA::LoginNeededException
Basda::MPIA::UserKickedException
Basda::MPIA::PortIsInUseException
Basda::MPIA::ModuleIsInUseException
Basda::MPIA::ModuleNotReservedException
Basda::MPIA::HugeDataInUseException
Basda::MPIA::HugeDataTransportException
Basda::MPIA::SmallFragmentSizeException
Basda::MPIA::FatalErrorException

◆ isConnected() [1/2]

bool Basda::MPIACoreProtocol::isConnected ( )

This method return true if a connection is established.

Returns
true if a connection is established

◆ isConnected() [2/2]

bool Basda::MPIACoreProtocol::isConnected ( )

This method return true if a connection is established.

Returns
true if a connection is established

◆ name() [1/2]

std::string Basda::MPIACoreProtocol::name ( )
inline

◆ name() [2/2]

std::string Basda::MPIACoreProtocol::name ( )
inline

◆ open() [1/2]

void Basda::MPIACoreProtocol::open ( )

This method opens the connection to the MPIA in-house electronic and reserve the module and card.

It enables/disables the event mode and the info mode as it is defined.

Exceptions
Basda::MPIA::FatalErrorException
Basda::MPIA::ConnectionFormatException

◆ open() [2/2]

void Basda::MPIACoreProtocol::open ( )

This method opens the connection to the MPIA in-house electronic and reserve the module and card.

It enables/disables the event mode and the info mode as it is defined.

Exceptions
Basda::MPIA::FatalErrorException
Basda::MPIA::ConnectionFormatException

◆ parse() [1/2]

void Basda::MPIACoreProtocol::parse ( std::string &  _ret)
private

◆ parse() [2/2]

void Basda::MPIACoreProtocol::parse ( std::string &  _ret)
private

◆ receiveData() [1/2]

void Basda::MPIACoreProtocol::receiveData ( const unsigned int  _commandID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const unsigned int  _numberOfLines = -1 
)

Read the rest response of the last request.

This method will not send any command to the MPIA in-house electronic. It reads the rest data of the last request. Like the get() method is it also possible to read just certain number of data to increase a completion bar in the meantime.

Note
: The response with all data is still at the Ethernet buffer and have be read first before the acknowledge of a new command can be received.
Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_numberOfLinesoptional: This parameter limitates how many data should be read from the Ethernet buffer. All data are read if the value is -1.
Returns
the return parameter is stored in _ret parameter.
See also
CommandIDs.h
Exceptions
Basda::MPIA::WrongCardNrException
Basda::MPIA::WrongCmdNrException
Basda::MPIA::WrongModuleNrException
Basda::MPIA::BadParamException
Basda::MPIA::ModuleAlreadyRegisteredException
Basda::MPIA::CmdBufOverflowException
Basda::MPIA::CANBusOverflowException
Basda::MPIA::SerialBusOverflowException
Basda::MPIA::MemoryOverflowException
Basda::MPIA::MaxClientsReachedException
Basda::MPIA::WrongPWException
Basda::MPIA::LoginNeededException
Basda::MPIA::UserKickedException
Basda::MPIA::PortIsInUseException
Basda::MPIA::ModuleIsInUseException
Basda::MPIA::ModuleNotReservedException
Basda::MPIA::HugeDataInUseException
Basda::MPIA::HugeDataTransportException
Basda::MPIA::SmallFragmentSizeException
Basda::MPIA::FatalErrorException

◆ receiveData() [2/2]

void Basda::MPIACoreProtocol::receiveData ( const unsigned int  _commandID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const unsigned int  _numberOfLines = -1 
)

Read the rest response of the last request.

This method will not send any command to the MPIA in-house electronic. It reads the rest data of the last request. Like the get() method is it also possible to read just certain number of data to increase a completion bar in the meantime.

Note
: The response with all data is still at the Ethernet buffer and have be read first before the acknowledge of a new command can be received.
Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_numberOfLinesoptional: This parameter limitates how many data should be read from the Ethernet buffer. All data are read if the value is -1.
Returns
the return parameter is stored in _ret parameter.
See also
CommandIDs.h
Exceptions
Basda::MPIA::WrongCardNrException
Basda::MPIA::WrongCmdNrException
Basda::MPIA::WrongModuleNrException
Basda::MPIA::BadParamException
Basda::MPIA::ModuleAlreadyRegisteredException
Basda::MPIA::CmdBufOverflowException
Basda::MPIA::CANBusOverflowException
Basda::MPIA::SerialBusOverflowException
Basda::MPIA::MemoryOverflowException
Basda::MPIA::MaxClientsReachedException
Basda::MPIA::WrongPWException
Basda::MPIA::LoginNeededException
Basda::MPIA::UserKickedException
Basda::MPIA::PortIsInUseException
Basda::MPIA::ModuleIsInUseException
Basda::MPIA::ModuleNotReservedException
Basda::MPIA::HugeDataInUseException
Basda::MPIA::HugeDataTransportException
Basda::MPIA::SmallFragmentSizeException
Basda::MPIA::FatalErrorException

◆ receiveDataRaw() [1/2]

void Basda::MPIACoreProtocol::receiveDataRaw ( const unsigned int  _commandID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const unsigned int  _numberOfLines = -1 
)

This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012)

It supports a direct communication with the MoCon without to parse the response. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Hi Martin,

that's exactly what I was thinking: The use case is (real example from our experience): we discover at the telescope that we need to continuously monitor a given property (PropA) of the MoCon (obviously because of a malfunctioning in the hardware!). Without this monitor, we will be stuck. You can add the required functionality in the Mocca adding the function getPropA: this requires 4 hours and the day is lost. The day after you are stuck because you discover that you miss PropB, and the day is lost again. As an alternative, one can add the 2 lines below in the code (with a comment: "1 10 0 = getPropA") and this requires 5 minutes. The day after one can add a similar line with 1 11 0. When you're back in Europe you implement getPropA and getPropB in Mocca and you cleanup the code removing the receiveResponseForComment

Generally speaking I think it is a safe idea to have a generic interface to access EVERY possible functionality of a device, because soon or later you'll need it. In the case of the Mocon it is quite easy, a good compromise between living dangerously and waisting too much time in the effort of a complete implementation of all the MoCon commands.

Lorenzo Busoni

Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_numberOfLinesThis parameter limitates how many data should be read from the Ethernet buffer. All data are read if the value is -1.
Returns
the return parameter is stored in _ret parameter.

◆ receiveDataRaw() [2/2]

void Basda::MPIACoreProtocol::receiveDataRaw ( const unsigned int  _commandID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
std::string &  _ret,
const unsigned int  _numberOfLines = -1 
)

This method was requested by Lorenzo Busoni (lbuso.nosp@m.ni@a.nosp@m.rcetr.nosp@m.i.as.nosp@m.tro.i.nosp@m.t 02.03.2012)

It supports a direct communication with the MoCon without to parse the response. BUT THE USER OF THIS METHOD TAKE OVER THE RESPONSIBILITY OF THE CORRECT ERROR HANDLING. THE DRIVER DOES NOT HAVE THE CONTROL OVER THAT DEVICE ANY MORE.

Hi Martin,

that's exactly what I was thinking: The use case is (real example from our experience): we discover at the telescope that we need to continuously monitor a given property (PropA) of the MoCon (obviously because of a malfunctioning in the hardware!). Without this monitor, we will be stuck. You can add the required functionality in the Mocca adding the function getPropA: this requires 4 hours and the day is lost. The day after you are stuck because you discover that you miss PropB, and the day is lost again. As an alternative, one can add the 2 lines below in the code (with a comment: "1 10 0 = getPropA") and this requires 5 minutes. The day after one can add a similar line with 1 11 0. When you're back in Europe you implement getPropA and getPropB in Mocca and you cleanup the code removing the receiveResponseForComment

Generally speaking I think it is a safe idea to have a generic interface to access EVERY possible functionality of a device, because soon or later you'll need it. In the case of the Mocon it is quite easy, a good compromise between living dangerously and waisting too much time in the effort of a complete implementation of all the MoCon commands.

Lorenzo Busoni

Parameters
_commandIDthe command ID which is defined in the CommandIDs.h
_cardNothe card number
_moduleNothe module number
_retthe allocated space for the returned data
_numberOfLinesThis parameter limitates how many data should be read from the Ethernet buffer. All data are read if the value is -1.
Returns
the return parameter is stored in _ret parameter.

◆ set() [1/4]

void Basda::MPIACoreProtocol::set ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const std::string &  _parameter = "" 
)

◆ set() [2/4]

void Basda::MPIACoreProtocol::set ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const std::string &  _parameter = "" 
)

◆ set() [3/4]

template<typename T >
void Basda::MPIACoreProtocol::set ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const _parameter 
)

◆ set() [4/4]

template<typename T >
void Basda::MPIACoreProtocol::set ( const unsigned int  _commandID,
const unsigned int  _selectID,
const unsigned int  _cardNo,
const unsigned int  _moduleNo,
const _parameter 
)

◆ setChatType() [1/2]

void Basda::MPIACoreProtocol::setChatType ( Nice::ChatLinePtr  _chat)
inline

◆ setChatType() [2/2]

void Basda::MPIACoreProtocol::setChatType ( Nice::ChatLinePtr  _chat)
inline

◆ waitForEvent() [1/2]

void Basda::MPIACoreProtocol::waitForEvent ( Nice::Time  _time)

This methods waits until an event is received or the time is expired.

Returns
true if an event arrived; false otherwise

◆ waitForEvent() [2/2]

void Basda::MPIACoreProtocol::waitForEvent ( Nice::Time  _time)

This methods waits until an event is received or the time is expired.

Returns
true if an event arrived; false otherwise

Member Data Documentation

◆ m_address

std::string Basda::MPIACoreProtocol::m_address
private

member of the connection address

◆ m_cardNo

unsigned int Basda::MPIACoreProtocol::m_cardNo
private

member of the card number

◆ m_chat

Nice::ChatLinePtr Basda::MPIACoreProtocol::m_chat
private

member of a MPIA in-house electronic device.

◆ m_config

Nice::JointPtr Basda::MPIACoreProtocol::m_config
private

member of the root of the configuration tree

◆ m_controllerNumberRequired

double Basda::MPIACoreProtocol::m_controllerNumberRequired
private

this is the version number of the firmware.

◆ m_cosNumberRequired

double Basda::MPIACoreProtocol::m_cosNumberRequired
private

this is the version number of the chipset.

◆ m_eventHandler

std::map< std::string, Handler * > Basda::MPIACoreProtocol::m_eventHandler
private

member of the event handling map.

◆ m_masterCardNo

unsigned int Basda::MPIACoreProtocol::m_masterCardNo
private

member of the master card at the MPIA in-house electronic.

◆ m_moduleNo

unsigned int Basda::MPIACoreProtocol::m_moduleNo
private

member of the module number

◆ m_mutex

Nice::Mutex Basda::MPIACoreProtocol::m_mutex
private

◆ m_name

std::string Basda::MPIACoreProtocol::m_name
private

◆ m_version

std::string Basda::MPIACoreProtocol::m_version
private

member of the MPIA in-house electronic version string.

◆ m_versionModuleName

std::string Basda::MPIACoreProtocol::m_versionModuleName
private

this is the name of the device inside the version string.


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