tcsSELF_CMD
Section: Devices and Network Interfaces (4)
Updated: 2012-04-23 10:08
Index
Return to man pages list
NAME
tcsSELF_CMD - send command to own process
SYNOPSIS
#include <tcsSELF_CMD.h>
tcsSELF_CMD selfCmd();
PARENT CLASS
evhCOMMAND
DESCRIPTION
In complex modules it is often the case that there are low level commands,
providing some basic functionality and high level commands, executing by
using sequences of low level commands. One way to implement this is to let
high level command handlers send low level commands to the own process.
This class provides an easy way to send a command to the own process and
handle the replies.
The self-command may complete whith either a normal reply or an error
reply. A timeout makes no sense for a self-command, because the low level
command already has one and returns an error reply on expiration.
The class offers two ways how to process the replies to the self-command:
1. The user specifies a callback which shall be invoked.
2. The user provides a command handler thru which the class sends a default
reply. This is for the case where the only action of the self-command
reply handler is to send a reply to its (high level command) originator.
The default reply is tcsOK_MSG for a normal reply to a self-command and
an tcsERR_SEND_COMMAND for an error reply to a self-command.
PUBLIC METHODS
tcsSELF_CMD();
~tcsSELF_CMD();
ccsCOMPL_STAT SetCmdHandler(tcsCMD_HANDLER *handler, const char * description);
Specify a command handler which shall be used to send default replies
if no user reply callbacks are installed. On sending an error reply the
given description is built into the error message to describe what
failed.
ccsCOMPL_STAT SetReplyHandler(evhCALLBACK &cd);
ccsCOMPL_STAT SetErrorHandler(evhCALLBACK &cd);
Defines the user installable callbacks to be
run when the normal or error replies for self
commands are received.
void Send(const msgCMD cmdName, const char *format, ...);
Build a parameter buffer from the given format and parameters (like in
printf) and send it with the given command to the own process.
ccsCOMPL_STAT Reset();
Resets the command if it is active by de-installing the reply handlers,
i.e. replies to that command are simply ignored. After that the object
is ready to send a new command.
vltLOGICAL IsActive();
Returns ccsTRUE if a command is currently active, i.e. replies are
pending.
const char *Command() const;
Access method to get the command name
PROTECTED METHODS
evhCB_COMPL_STAT ReplyCB(msgMESSAGE &msg, void *);
evhCB_COMPL_STAT ErrorCB(msgMESSAGE &msg, void *);
Handlers for normal and error replies to the self-command. If user
reply callbacks are installed they are invoked by these handlers,
otherwise a normal or error reply is passed on to the given command
handler.
PRIVATE DATA MEMBERS
fndSTRING description; // description of purpose for error logging
tcsCMD_HANDLER *cmdHandler; // command handler to be used for replies
evhCALLBACK *userReplyCB; // user's reply handler
evhCALLBACK *userErrorCB; // user's error reply handler
SEE ALSO
evhCOMMAND
Index
- NAME
-
- SYNOPSIS
-
- PARENT CLASS
-
- DESCRIPTION
-
- PUBLIC METHODS
-
- PROTECTED METHODS
-
- PRIVATE DATA MEMBERS
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 10:08:47 GMT, April 23, 2012