Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AudioSend Class Reference

Call Module for sending an A-Law file. More...

#include <audiosend.h>

Inheritance diagram for AudioSend:

CallModule CallInterface List of all members.

Public Methods

 AudioSend (Connection *conn, string file, bool DTMF_exit) throw (CapiWrongState,CapiExternalError)
 Constructor. Test if we are in speech mode and create an object.

void mainLoop () throw (CapiWrongState,CapiExternalError,CapiMsgError)
 Start file transmission, wait for the end of the file or the connection, stop file transmission.

void transmissionComplete ()
 finish main loop if file is completely received

long duration ()
 Return the time in seconds since start of mainLoop().


Private Attributes

string file
 name of the file to send

long start_time
 time in seconds since the epoch when the module was started


Detailed Description

Call Module for sending an A-Law file.

This module handles the sending of an audio file. The audio file must be in bit-inversed A-Law format. It can be created for example with sox using the suffix ".la". It supports abortion if DTMF signal is received.

If DTMF abort is enabled, the module will abort immediately if the DTMF receiving buffer (see Connection::getDTMF) isn't empty when it is created. That allows the user to abort subsequent audio receive and send commands with one DTMF signal w/o needing to check for received DTMF after each command.

The connction must be in audio mode (by connecting with service VOICE), otherwise an exception will be caused.

CapiWrongState will only be thrown if connection is not up at startup, not later on. We see a later disconnect as normal event, no error.

Author:
Gernot Hillier


Constructor & Destructor Documentation

AudioSend::AudioSend Connection   conn,
string    file,
bool    DTMF_exit
throw (CapiWrongState,CapiExternalError)
 

Constructor. Test if we are in speech mode and create an object.

Parameters:
conn  reference to Connection object
file  name of file to send
DTMF_exit  set to true, if you want to finish when DTMF signal is received
Exceptions:
CapiExternalError  Thrown if speech mode isn't established before.
CapiWrongState  Thrown if connection is not up (thrown by base class constructor)


Member Function Documentation

long AudioSend::duration  
 

Return the time in seconds since start of mainLoop().

Returns:
time in seconds since start of mainLoop()

void AudioSend::mainLoop   throw (CapiWrongState,CapiExternalError,CapiMsgError) [virtual]
 

Start file transmission, wait for the end of the file or the connection, stop file transmission.

Exceptions:
CapiExternalError  Thrown by Connection::start_file_transmission, see there for explanation.
CapiMsgError  Thrown by Connection::start_file_transmission, see there for explanation.
CapiWrongState  Thrown if connection is not up at start of transfer (thrown by Connection::start_file_transmission)

Reimplemented from CallModule.

void AudioSend::transmissionComplete   [virtual]
 

finish main loop if file is completely received

Reimplemented from CallModule.


Member Data Documentation

string AudioSend::file [private]
 

name of the file to send

long AudioSend::start_time [private]
 

time in seconds since the epoch when the module was started


The documentation for this class was generated from the following files:
Generated on Mon Jan 5 12:20:00 2004 for CapiSuite by doxygen1.2.18