Bayonne
Public Member Functions | Public Attributes | Protected Attributes

ost::Libexec Class Reference

Container class for applications implimenting the libexec process method of Bayonne interfacing. More...

#include <libexec.h>

Inheritance diagram for ost::Libexec:
ost::Bayonne

List of all members.

Public Member Functions

 Libexec ()
 Initialize libexec.
const char * getEnv (const char *id)
 Get a header record item.
const char * getArg (const char *id)
 Get a named libexec command line argument.
const char * getPath (const char *filename, char *buffer, unsigned size)
 Get a fully qualified and resolved pathname.
const char * getFile (const char *filename)
 Get and verify partial pathname for file oriented libexec commands.
void setVoice (const char *voice)
 Set the effective voice library to use.
void setLevel (Audio::Level level)
 Set the effective audio level for tones...
void hangupSession (void)
 Hangup running session...
void detachSession (unsigned code)
 Resume server session, libexec continues detached.
result_t sendCommand (const char *text, char *buffer=NULL, unsigned size=0)
 Send a command through to server and capture result.
result_t sendResult (const char *text)
 Send a result to the server.
void sendError (const char *msg)
 Send an error to the server.
result_t xferCall (const char *dest)
 Transfer a call.
result_t replayFile (const char *file)
 Replay an audio file.
result_t replayOffset (const char *file, const char *offset)
 Replay an audio file from a specified offset.
result_t recordFile (const char *file, timeout_t duration, timeout_t silence=0)
 Record an audio file.
result_t speak (const char *format,...)
 Play a phrase.
result_t playTone (const char *name, timeout_t duration=0, unsigned level=0)
 Play a tone.
result_t playSingleTone (short f1, timeout_t duration, unsigned level=0)
result_t playDualTone (short f1, short f2, timeout_t duration, unsigned level=0)
result_t recordOffset (const char *file, const char *offset, timeout_t duration, timeout_t silence=0)
 Record an audio file to a specified offset.
result_t eraseFile (const char *file)
 Erase an audio file.
result_t moveFile (const char *file1, const char *file2)
 Move an audio file.
result_t clearInput (void)
 Flush input.
bool waitInput (timeout_t timeout)
 Wait for input.
result_t readInput (char *buffer, unsigned size, timeout_t timeout)
 Read a line of input.
char readKey (timeout_t timeout)
 Read a single key of input.
result_t sizeSym (const char *id, unsigned size)
result_t addSym (const char *id, const char *value)
result_t setSym (const char *id, const char *value)
result_t getSym (const char *id, char *buf, unsigned size)
void postSym (const char *id, const char *value)
 Post a symbol asychrononous event to server.

Public Attributes

result_t result
char digits [64]
char query [512]
char position [32]
unsigned exitcode
unsigned reply

Protected Attributes

Keydata head
Keydata args
const char * tsid
const char * voice
Audio::Level level

Detailed Description

Container class for applications implimenting the libexec process method of Bayonne interfacing.

This is intended for writing external apps and is neatly tucked away into libbayonne as well.

Author:
David Sugar <dyfet@gnutelephony.org> Libexec process interface class.

Constructor & Destructor Documentation

ost::Libexec::Libexec ( )

Initialize libexec.


Member Function Documentation

result_t ost::Libexec::addSym ( const char *  id,
const char *  value 
)
result_t ost::Libexec::clearInput ( void  )

Flush input.

void ost::Libexec::detachSession ( unsigned  code)

Resume server session, libexec continues detached.

result_t ost::Libexec::eraseFile ( const char *  file)

Erase an audio file.

Returns:
result code.
Parameters:
nameof file to erase.
const char* ost::Libexec::getArg ( const char *  id)

Get a named libexec command line argument.

Parameters:
idof libexec argument.
Returns:
string value of requested argument or NULL.
const char* ost::Libexec::getEnv ( const char *  id)

Get a header record item.

Parameters:
idof header or sys env item.
Returns:
string value of requested item or NULL.
const char* ost::Libexec::getFile ( const char *  filename)

Get and verify partial pathname for file oriented libexec commands.

Returns:
pointer to buffer or NULL if invalid.
Parameters:
filenamepath to evaluate.
const char* ost::Libexec::getPath ( const char *  filename,
char *  buffer,
unsigned  size 
)

Get a fully qualified and resolved pathname.

Returns:
pointer to buffer or NULL if invalid.
Parameters:
filenamepath to evaluate.
bufferto save into.
sizeof buffer.
result_t ost::Libexec::getSym ( const char *  id,
char *  buf,
unsigned  size 
)
void ost::Libexec::hangupSession ( void  )

Hangup running session...

result_t ost::Libexec::moveFile ( const char *  file1,
const char *  file2 
)

Move an audio file.

Returns:
result code.
Parameters:
nameof file to move.
destinationof move.
result_t ost::Libexec::playDualTone ( short  f1,
short  f2,
timeout_t  duration,
unsigned  level = 0 
)
result_t ost::Libexec::playSingleTone ( short  f1,
timeout_t  duration,
unsigned  level = 0 
)
result_t ost::Libexec::playTone ( const char *  name,
timeout_t  duration = 0,
unsigned  level = 0 
)

Play a tone.

Returns:
result code.
Parameters:
nameof tone to play.
durationfor tone.
audiolevel of tone.
void ost::Libexec::postSym ( const char *  id,
const char *  value 
)

Post a symbol asychrononous event to server.

This sets the symbol value, and also generates a :symname event.

Parameters:
idof symbol to post.
valueof symbol.
result_t ost::Libexec::readInput ( char *  buffer,
unsigned  size,
timeout_t  timeout 
)

Read a line of input.

Returns:
result code.
Parameters:
inputbuffer.
sizeof input buffer.
timeoutfor input.
char ost::Libexec::readKey ( timeout_t  timeout)

Read a single key of input.

Returns:
key input or 0.
Parameters:
timeoutfor read.
result_t ost::Libexec::recordFile ( const char *  file,
timeout_t  duration,
timeout_t  silence = 0 
)

Record an audio file.

Returns:
result code.
Parameters:
nameof file to record.
totalduration of file.
optionalsilence detect.
result_t ost::Libexec::recordOffset ( const char *  file,
const char *  offset,
timeout_t  duration,
timeout_t  silence = 0 
)

Record an audio file to a specified offset.

Returns:
result code.
Parameters:
nameof file to record.
offsetto record info.
totalduration of file.
optionalsilence detect.
result_t ost::Libexec::replayFile ( const char *  file)

Replay an audio file.

Returns:
result code.
Parameters:
nameof file to play.
result_t ost::Libexec::replayOffset ( const char *  file,
const char *  offset 
)

Replay an audio file from a specified offset.

Returns:
result code.
Parameters:
nameof file to play.
offsetto play from.
result_t ost::Libexec::sendCommand ( const char *  text,
char *  buffer = NULL,
unsigned  size = 0 
)

Send a command through to server and capture result.

Returns:
result code.
Parameters:
commandto send.
optionalquery buffer.
optionalquery size.
void ost::Libexec::sendError ( const char *  msg)

Send an error to the server.

Parameters:
errormsg to send.
result_t ost::Libexec::sendResult ( const char *  text)

Send a result to the server.

Returns:
result code from server.
Parameters:
resultto send.
void ost::Libexec::setLevel ( Audio::Level  level) [inline]

Set the effective audio level for tones...

Parameters:
levelto set.
result_t ost::Libexec::setSym ( const char *  id,
const char *  value 
)
void ost::Libexec::setVoice ( const char *  voice) [inline]

Set the effective voice library to use.

Parameters:
voiceto set or NULL for default.
result_t ost::Libexec::sizeSym ( const char *  id,
unsigned  size 
)
result_t ost::Libexec::speak ( const char *  format,
  ... 
)

Play a phrase.

Returns:
result code.
Parameters:
textof phrase to play.
bool ost::Libexec::waitInput ( timeout_t  timeout)

Wait for input.

Returns:
true if input waiting.
result_t ost::Libexec::xferCall ( const char *  dest)

Transfer a call.

Returns:
result code from server.
Parameters:
destinationto transfer.

Member Data Documentation

Keydata ost::Libexec::args [protected]
Keydata ost::Libexec::head [protected]
Audio::Level ost::Libexec::level [protected]
const char* ost::Libexec::tsid [protected]
const char* ost::Libexec::voice [protected]

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