#include <FeeClientLibInterface.hpp>
Inheritance diagram for dcs::fee::FeeClientLibInterface:
It has to be derived in an child class and the pure virtual functions have to be implemented in order to use the interface. In addition the user has to provide a handler routine for each FeeService, he subscribes to. This handler gives updated service values to the user. And the names of the FeeServers have to be given to the library. After this registration the user can start the FeeClient and send commands to a dedicated FeeServer.
registerServiceName for more information about registering FeeServices
startFeeClient for more information about starting the FeeClient
messageHandler for more information on how to receive messages.
acknowledgeHandler for more information on how to receive ACK data.
sendCommand for more information about sending commands.
stopFeeClient for more information about stopping the FeeClient.
clearFeeClient for more information about cleaning up.
Public Member Functions | |
FeeClientLibInterface () | |
virtual | ~FeeClientLibInterface () |
virtual void | acknowledgeHandler (char *serverName, unsigned int size, char *data, unsigned int id, FlagBits flags, short errorCode, short ackState)=0 |
virtual void | messageHandler (const MessageStruct msg)=0 |
bool | registerFeeServerName (const char *serverName) |
bool | registerServiceName (const char *serviceName, void(*serviceHandler)(float fVal)) |
int | startFeeClient () |
unsigned int | sendCommand (char *serverName, unsigned int size, char *data, FlagBits flags) |
bool | stopFeeClient () |
int | clearFeeClient () |
bool | deactivateIDinList (int id) |
bool | checkIDinList (int id) |
Private Member Functions | |
bool | isNewFeeServerName (const char *feeServerName) |
bool | isNewServiceName (const char *feeServiceName) |
void | insertIDtoList (int id) |
void | lockListMutex () |
void | unlockListMutex () |
void | clearFeeServerVector () |
void | clearServiceVector () |
Private Attributes | |
FeeClientCore * | mpFeeClient |
std::vector< char * > | mServerNames |
std::vector< FeeServiceStruct * > | mServiceNames |
std::map< int, bool > | mIDList |
pthread_mutex_t | mListMutex |
|
Constructor for the client interface.
|
|
Destructor for the client interface.
|
|
This handler routine informs about new acknowledge from a FeeServer and offers the received data.
It has to be implemented in the derived classes to get the ACK.
Implemented in dcs::fee::FeeClientLibImp. |
|
Removes an ACK ID from the pending ID map.
If its value is false, the ACK is already regarded as lost. In that case only a message will be written to the message channel and the ACK shall be discarded.
|
|
Function to clear all registered FeeServers and FeeServices. This can only to executed, if the FeeClient is not in the running state.
|
|
Clears the local vector of FeeServer names.
|
|
Clears the local vector of FeeService structs.
|
|
Sets a pending ACK ID to false -> timeout, ACK no longer expected.
|
|
Function to insert an ID in the map of pending ACK IDs. If this ID already exists, its value is set to true, which indicates that it will be accepted when an ACK with the corresponding ID arrives. If the value has been false before, the ACK has been regarded as lost; if the value has been true before, a message will be written to the message channel (possible reasons: the FeeClientLib has not been notified about a timeout for this ID, or a collision might occur, when the mssing ACK arrives in between). If an ACK arrives with an ID corresponding to a false value, a message will be send to the message channel as well.
|
|
Checks, if a given FeeServer name is already in the local vector.
|
|
Checks, if a given FeeService name is already in the local vector.
|
|
Function to lock the ID list mutex.
|
|
This handler routine informs about new received log message (remote and local).
It has to be implemented in the derived classes, the message can be retrieved via the parameter msg.
Implemented in dcs::fee::FeeClientLibImp. |
|
This function registers a FeeServer name to which the FeeClient should connect to. This is only possible during init state, registering afterwards will return an error. If the name already exists in the local vector, no additional copy is included.
|
|
This function registers a FeeService to which the FeeClient should connect to. It needs the name of the desired service and has to register the corresponding handler function. This is only possible during init state, registering afterwards will return an error. If the name already exists in the local vector, no additional copy is included.
|
|
Function to send a command to a specified FeeServer.
If no FlagBits for FeeServer (core) commands are set, this data is delivered to the ControlEngine and executed there. Commands to the FeeServer core (see FlagBits) never reach the ControlEngine and have a defined structure (see below).
|
|
Starts the FeeClient.
It subscibes to all registered FeeServers and their registered service. The amount of subscribed services is returned.
|
|
Function to stop the FeeClient.
Only the subscribed channels are deregistered, but the corresponding container are NOT cleared. A new call of startFeeClient() will result in the same connections. It is possible to register additional FeeServices and FeeServer before restarting the FeeClient.
|
|
Function to unlock the ID list mutex.
|
|
List of pending packet IDs. This container contains a list of IDs for which an ACK is expected. |
|
Mutex variable to protect the map from concurrent access.
|
|
The pointer to the FeeClientCore.
|
|
Vector of FeeServer names for subscribing to at the end of init process.
|
|
Vector of FeeServiceStructs for subscribing to at the end of init process. The FeeServiceStruct contains the FeeService name and the pointer to its handler function. |