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

const char* ost::Libexec::getEnv ( const char *  id  ) 

Get a header record item.

Parameters:
id of header or sys env item.
Returns:
string value of requested item or NULL.

const char* ost::Libexec::getArg ( const char *  id  ) 

Get a named libexec command line argument.

Parameters:
id of libexec argument.
Returns:
string value of requested argument or NULL.

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:
filename path to evaluate.
buffer to save into.
size of buffer.

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:
filename path to evaluate.

void ost::Libexec::setVoice ( const char *  voice  )  [inline]

Set the effective voice library to use.

Parameters:
voice to set or NULL for default.

void ost::Libexec::setLevel ( Audio::Level  level  )  [inline]

Set the effective audio level for tones.

..

Parameters:
level to set.

void ost::Libexec::hangupSession ( void   ) 

Hangup running session.

..

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

Resume server session, libexec continues detached.

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:
command to send.
optional query buffer.
optional query size.

result_t ost::Libexec::sendResult ( const char *  text  ) 

Send a result to the server.

Returns:
result code from server.
Parameters:
result to send.

void ost::Libexec::sendError ( const char *  msg  ) 

Send an error to the server.

Parameters:
error msg to send.

result_t ost::Libexec::xferCall ( const char *  dest  ) 

Transfer a call.

Returns:
result code from server.
Parameters:
destination to transfer.

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

Replay an audio file.

Returns:
result code.
Parameters:
name of 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:
name of file to play.
offset to play from.

result_t ost::Libexec::recordFile ( const char *  file,
timeout_t  duration,
timeout_t  silence = 0 
)

Record an audio file.

Returns:
result code.
Parameters:
name of file to record.
total duration of file.
optional silence detect.

result_t ost::Libexec::speak ( const char *  format,
  ... 
)

Play a phrase.

Returns:
result code.
Parameters:
text of phrase to play.

result_t ost::Libexec::playTone ( const char *  name,
timeout_t  duration = 0,
unsigned  level = 0 
)

Play a tone.

Returns:
result code.
Parameters:
name of tone to play.
duration for tone.
audio level of tone.

result_t ost::Libexec::playSingleTone ( short  f1,
timeout_t  duration,
unsigned  level = 0 
)

result_t ost::Libexec::playDualTone ( short  f1,
short  f2,
timeout_t  duration,
unsigned  level = 0 
)

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:
name of file to record.
offset to record info.
total duration of file.
optional silence detect.

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

Erase an audio file.

Returns:
result code.
Parameters:
name of file to erase.

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

Move an audio file.

Returns:
result code.
Parameters:
name of file to move.
destination of move.

result_t ost::Libexec::clearInput ( void   ) 

Flush input.

bool ost::Libexec::waitInput ( timeout_t  timeout  ) 

Wait for input.

Returns:
true if input waiting.

result_t ost::Libexec::readInput ( char *  buffer,
unsigned  size,
timeout_t  timeout 
)

Read a line of input.

Returns:
result code.
Parameters:
input buffer.
size of input buffer.
timeout for input.

char ost::Libexec::readKey ( timeout_t  timeout  ) 

Read a single key of input.

Returns:
key input or 0.
Parameters:
timeout for read.

result_t ost::Libexec::sizeSym ( const char *  id,
unsigned  size 
)

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

result_t ost::Libexec::setSym ( const char *  id,
const char *  value 
)

result_t ost::Libexec::getSym ( const char *  id,
char *  buf,
unsigned  size 
)

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:
id of symbol to post.
value of symbol.


Member Data Documentation

Keydata ost::Libexec::head [protected]

Keydata ost::Libexec::args [protected]

const char* ost::Libexec::tsid [protected]

const char* ost::Libexec::voice [protected]

Audio::Level ost::Libexec::level [protected]


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

Generated on Sat Aug 2 01:04:50 2008 for Bayonne by  doxygen 1.5.6