Logo Search packages:      
Sourcecode: capisuite version File versions  Download package

Connection Class Reference

#include <connection.h>

List of all members.

Detailed Description

Encapsulates a CAPI connection with all its states and methods.

This class encapsulates one ISDN connection (physical and logical). It has two groups of methods: methods which are supposed to be called from the application (declared public) which serve to access the connection, send data, clear it etc. Also there are many message handlers implemented (declared as private) which are called by Capi::readMessage() and do the most message handling stuff.

Only one logical connection per physical connection is supported.

To communicate with the application by callback functions, the application must implement the CallInterface. The methods of this class are called if different events occur like call completion or a finished data transfer.

There are two ways how Connection objects are created:

Gernot Hillier

Definition at line 49 of file connection.h.

Public Types

enum  connection_state_t { DOWN, WAITING, UP, OTHER_STATE }
 Represents the current connection state in an easy way. More...
enum  disconnect_mode_t { ALL, PHYSICAL_ONLY, LOGICAL_ONLY }
 Tells disconnectCall() method how to disconnect. More...
enum  service_t { VOICE, FAXG3, OTHER }
 Type for describing the service of incoming and outgoing calls. More...

Public Member Functions

void acceptWaiting () throw (CapiMsgError, CapiWrongState)
 disable timeout for a pending call (i.e. send ALERT)
void changeProtocol (service_t desired_service, string faxStationID, string faxHeadline) throw (CapiMsgError, CapiExternalError, CapiWrongState)
 Change the used B protcols (e.g. switch from speech to faxG3).
void clearDTMF ()
 Delete the saved DTMF characters.
 Connection (Capi *capi, _cdword controller, string call_from, bool clir, string call_to, service_t service, string faxStationID, string faxHeadline) throw (CapiExternalError, CapiMsgError)
 Constructor. Create an object to initiate an outgoing call.
void connectWaiting (service_t desired_service, string faxStationID="", string faxHeadline="") throw (CapiWrongState,CapiExternalError,CapiMsgError)
 Accept a waiting incoming call.
void debugMessage (string message, unsigned short level)
 Output debug message.
void disableDTMF () throw (CapiWrongState, CapiMsgError)
 Disable indication for DTMF signals.
void disconnectCall (disconnect_mode_t disconnect_mode=ALL) throw (CapiMsgError)
 Terminate this connection.
void enableDTMF () throw (CapiWrongState, CapiMsgError)
 Enable indication for DTMF signals.
void errorMessage (string message)
 Output error message.
string getCalledPartyNumber ()
 Return number of the called party (the source of the call).
string getCallingPartyNumber ()
 Return number of calling party (the destination of the call).
_cword getCause ()
 Return disconnection cause given by the CAPI.
_cword getCauseB3 ()
 Return disconnection cause given by the CAPI.
string getDTMF ()
 read the saved DTMF characters
fax_info_tgetFaxInfo ()
 Return fax information.
service_t getService ()
 Return currently used service mode.
connection_state_t getState ()
 Return the connection state.
void registerCallInterface (CallInterface *call_if)
 Register the instance implementing the CallInterface.
void rejectWaiting (_cword reject) throw (CapiWrongState, CapiMsgError, CapiExternalError)
 Reject a waiting incoming call.
void start_file_reception (string filename) throw (CapiWrongState, CapiExternalError)
 called to activate receive mode
void start_file_transmission (string filename) throw (CapiError,CapiWrongState,CapiExternalError,CapiMsgError)
 called to start sending of a file
void stop_file_reception ()
 called to stop receive mode
void stop_file_transmission ()
 called to stop sending of the current file, will block until file is really finished
 ~Connection ()
 . Destructor. Deletes the connection object.

Protected Types

enum  ncci_state_t {
  N0, N01, N1, N2,
  N3, N4, N5, NACT
 State for logical connection as defined in the CAPI spec. More...
enum  plci_state_t {
  P0, P01, P1, P2,
  P3, P4, P5, P6,
 State for the physical connection as defined in the CAPI spec. More...

Protected Member Functions

void alert_conf (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get ALERT_CONF from CAPI
void buildBconfiguration (_cdword controller, service_t service, string faxStationID, string faxHeadline, _cword &B1proto, _cword &B2proto, _cword &B3proto, _cstruct &B1config, _cstruct &B2config, _cstruct &B3config) throw (CapiExternalError)
 called to build the B Configuration info elements out of given service
void connect_active_ind (_cmsg &message) throw (CapiWrongState, CapiMsgError)
 Called when we get CONNECT_ACTIVE_IND from CAPI.
void connect_b3_active_ind (_cmsg &message) throw (CapiError,CapiWrongState,CapiExternalError)
 called when we get CONNECT_B3_ACTIVE_IND from CAPI
void connect_b3_conf (_cmsg &message) throw (CapiWrongState, CapiMsgError)
 called when we get CONNECT_B3_CONF from CAPI
void connect_b3_ind (_cmsg &message) throw (CapiWrongState, CapiMsgError)
 called when we get CONNECT_B3_IND from CAPI
void connect_conf (_cmsg &message) throw (CapiWrongState, CapiMsgError)
 called when we get CONNECT_CONF from CAPI
 Connection (_cmsg &message, Capi *capi, unsigned short DDILength=0, unsigned short DDIBaseLength=0, std::vector< std::string > DDIStopNumbers=std::vector< std::string >())
 Constructor. Create an object for an incoming call.
void convertToCP437 (string &text)
 convert a String from ISO8859-1 to CP437 (IBM PC-DOS charset)
void data_b3_conf (_cmsg &message) throw (CapiError,CapiWrongState, CapiMsgError, CapiExternalError)
 called when we get DATA_B3_CONF from CAPI
void data_b3_ind (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get DATA_B3_IND from CAPI
void disconnect_b3_conf (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get DISCONNECT_B3_CONF from CAPI
void disconnect_b3_ind (_cmsg &message) throw (CapiError,CapiWrongState)
 called when we get DISCONNECT_B3_IND from CAPI
void disconnect_conf (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get DISCONNECT_CONF from CAPI
void disconnect_ind (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get DISCONNECT_IND from CAPI
void facility_conf_DTMF (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get FACILITY_CONF from CAPI with facility selector saying it's DTMF
void facility_ind_DTMF (_cmsg &message) throw (CapiError,CapiWrongState)
 called when we get FACILITY_IND from CAPI with facility selector saying it's DTMF
string getNumber (_cstruct capi_input, bool isCallingNr)
 format the CallingPartyNr or CalledPartyNr to readable string
void info_ind_alerting (_cmsg &message) throw (CapiError,CapiWrongState)
 called when we get INFO_IND from CAPI with Info number saying it's ALERTING
bool info_ind_called_party_nr (_cmsg &message) throw (CapiError,CapiWrongState)
 called when we get INFO_IND from CAPI with Info number saying it's ALERTING
string prefix ()
 return a prefix containing this pointer and date for log messages
void select_b_protocol_conf (_cmsg &message) throw (CapiError,CapiWrongState,CapiMsgError)
 called when we get SELECT_B_PROTOCOL_CONF from CAPI
void send_block () throw (CapiError,CapiWrongState,CapiExternalError,CapiMsgError)
 called to send next block (2048 bytes) of file

Protected Attributes

unsigned short buffer_start
 holds the index for the first buffer currently used
unsigned short buffers_used
 holds the number of currently used buffers
string call_from
 CallingPartyNumber, formatted as string with leading '0' or '+' prefix.
 pointer to the object implementing CallInterface
string call_to
 CalledPartyNumber, formatted as string.
 pointer to the Capi object
_cword connect_ind_msg_nr
 this is needed as connect_resp is given in another function as connect_ind
unsigned short DDIBaseLength
 the length of the base number for a PtP interface
unsigned short DDILength
 the length of DDI extension numbers. 0 means DDI disabled
vector< string > DDIStopNumbers
 list of complete DDI extensions shorter than DDILength
ostream & debug
 debug stream
unsigned short debug_level
 debug level
_cword disconnect_cause
 the disconnect cause as given by the CAPI in DISCONNECT_IND
_cword disconnect_cause_b3
 the disconnect cause as given by the CAPI in DISCONNECT_B3_IND
ostream & error
 stream for error messages
 holds some data about fax connections
ofstream * file_for_reception
 NULL if no file is received, pointer to the file otherwise.
ifstream * file_to_send
 NULL if no file is sent, pointer to the file otherwise.
bool keepPhysicalConnection
 set to true to disable auto-physical disconnect after logical disconnect for one time
_cdword ncci
 id for logical connection
enum Connection::ncci_state_t ncci_state
 State for logical connection as defined in the CAPI spec.
bool our_call
 set to true if we initiated the call (needed to know as some messages must be sent if we initiated the call)
_cdword plci
 CAPI id for call.
enum Connection::plci_state_t plci_state
 State for the physical connection as defined in the CAPI spec.
pthread_mutex_t receive_mutex
 to realize critical sections in reception code
string received_dtmf
 accumulates the received DTMF data, see readDTMF()
char send_buffer [7][2048]
 ring buffer for sending
pthread_mutex_t send_mutex
 to realize critical sections in transmission code
service_t service
 as described in Connection::service_t, set to the last known service (either got from ISDN or set explicitly)


class Capi


struct  fax_info_t
 several parameters describing fax protocol details for incoming faxes More...

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

Generated by  Doxygen 1.6.0   Back to index