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

ReadDTMF Class Reference

Call Module for waiting for DTMF signals. More...

#include <readDTMF.h>

Inheritance diagram for ReadDTMF:

CallModule CallInterface List of all members.

Public Methods

 ReadDTMF (Connection *conn, int timeout, int min_digits, int max_digits) throw (CapiWrongState)
 Constructor. Create Object and read the current digit count from Connection.

void mainLoop () throw ()
 mainLoop: Waits until the given conditions (see constructor) have been fulfilled

void gotDTMF ()
 finish if max_digits is reached, otherwise restart timeout when DTMF signal is received

void callDisconnectedLogical ()
 set call_finished

void callDisconnectedPhysical ()
 set call_finished


Private Attributes

int digit_count
 save the current number of digits in receive buffer

int min_digits
 save min_digits parameter

int max_digits
 save max_digits parameter

bool call_finished
 set additionally at disconnect as CallModule::finish is used otherwise here


Detailed Description

Call Module for waiting for DTMF signals.

This module allows the user to specify how much DTMF digits he wants to read and how long to wait for them. It doesn't do the actual read, just waits for the given conditions to be fulfilled.

To use it, create an object and call mainLoop(). After mainLoop() finished, call Connection::getDTMF() to read the received signals.

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

ReadDTMF::ReadDTMF Connection   conn,
int    timeout,
int    min_digits,
int    max_digits
throw (CapiWrongState)
 

Constructor. Create Object and read the current digit count from Connection.

Parameters:
conn  reference to Connection object
timeout  timeout in seconds after which reading is terminated (only terminates when min_digits are reached!), restarts after each digit
min_digits  minimum number of digits which must be read in ANY case without respect to timout. Only set to value >0 if you're sure the user will input a digit.
max_digits  maximum number of digits to read, we abort immediately if this number is reached (0=infinite, only timeout counts)
Exceptions:
CapiWrongState  Thrown if connection not up (thrown by base class)


Member Function Documentation

void ReadDTMF::callDisconnectedLogical   [virtual]
 

set call_finished

This method overwrites CallModule::callDisconnectedLogical and sets the flag call_finished in addition to the other one. This is needed for our mainLoop to differ between a received DTMF (then we should continue) and a disconnect (then we should really finish)

Reimplemented from CallModule.

void ReadDTMF::callDisconnectedPhysical   [virtual]
 

set call_finished

This method overwrites CallModule::callDisconnectedPhysical and sets the flag call_finished in addition to the other one. This is needed for our mainLoop to differ between a received DTMF (then we should continue) and a disconnect (then we should really finish)

Reimplemented from CallModule.

void ReadDTMF::gotDTMF   [virtual]
 

finish if max_digits is reached, otherwise restart timeout when DTMF signal is received

Reimplemented from CallModule.

void ReadDTMF::mainLoop   throw () [virtual]
 

mainLoop: Waits until the given conditions (see constructor) have been fulfilled

The module will finish if one of these conditions are true:

  • max_digits is fulfilled
  • timeout was reached AND min_digits is fulfilled

Reimplemented from CallModule.


Member Data Documentation

bool ReadDTMF::call_finished [private]
 

set additionally at disconnect as CallModule::finish is used otherwise here

int ReadDTMF::digit_count [private]
 

save the current number of digits in receive buffer

int ReadDTMF::max_digits [private]
 

save max_digits parameter

int ReadDTMF::min_digits [private]
 

save min_digits parameter


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