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

capi.h

Go to the documentation of this file.
00001 
00008 /***************************************************************************
00009 *                                                                         *
00010 *   This program is free software; you can redistribute it and/or modify  *
00011 *   it under the terms of the GNU General Public License as published by  *
00012 *   the Free Software Foundation; either version 2 of the License, or     *
00013 *   (at your option) any later version.                                   *
00014 *                                                                         *
00015 ***************************************************************************/
00016 
00017 #ifndef CAPI_H
00018 #define CAPI_H
00019 
00020 #include <capi20.h>
00021 #include <string>
00022 #include <map>  
00023 #include <vector>
00024 #include "capiexception.h"
00025 
00026 class Connection;
00027 class ApplicationInterface;
00028 
00033 void* capi_exec_handler(void* args);
00034 
00060 class Capi {
00061         friend class Connection; 
00062         friend void* capi_exec_handler(void*);
00063 
00064         public:
00079                 Capi (ostream &debug, unsigned short debug_level, ostream &error, unsigned short DDILength=0, unsigned short DDIBaseLength=0, vector<string> DDIStopNumbers=vector<string>(), unsigned maxLogicalConnection=2, unsigned maxBDataBlocks=7,unsigned maxBDataLen=2048) throw (CapiError, CapiMsgError);
00080 
00085                 ~Capi();
00086 
00091                 void registerApplicationInterface(ApplicationInterface* application_in);
00092 
00106                 void setListenFaxG3 (_cdword Controller=0) throw (CapiMsgError,CapiError);
00107 
00121                 void setListenTelephony (_cdword Controller=0) throw (CapiMsgError,CapiError);
00122 
00142                 string getInfo(bool verbose=false);
00143 
00144         private:
00145 
00150                 void unregisterConnection (_cdword plci);  
00151 
00157                 void readProfile() throw (CapiMsgError);
00158 
00159 
00160                 /********************************************************************************/
00161                 /*          methods to send CAPI messages - called by the Connection class      */
00162                 /********************************************************************************/
00163 
00164                 /*************************** REQUESTS *******************************************/
00165 
00173                 void listen_req (_cdword Controller, _cdword InfoMask=0x03FF, _cdword CIPMask=0x1FFF03FF) throw (CapiMsgError);
00174 
00180                 void alert_req (_cdword plci) throw (CapiMsgError);
00181 
00201                 void connect_req (Connection *conn, _cdword Controller, _cword CIPvalue, _cstruct calledPartyNumber, _cstruct callingPartyNumber, _cword B1protocol, _cword B2protocol, _cword B3protocol, _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration) throw (CapiMsgError);
00202 
00214                 void select_b_protocol_req (_cdword plci, _cword B1protocol, _cword B2protocol, _cword B3protocol, _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration) throw (CapiMsgError);
00215 
00221                 void connect_b3_req (_cdword plci) throw (CapiMsgError);
00222 
00232                 void data_b3_req (_cdword ncci, void* Data, _cword DataLength,_cword DataHandle,_cword Flags) throw (CapiMsgError);
00233 
00240                 void disconnect_b3_req (_cdword ncci, _cstruct ncpi=NULL) throw (CapiMsgError);
00241 
00250                 void disconnect_req (_cdword plci, _cstruct Keypadfacility=NULL, _cstruct Useruserdata=NULL, _cstruct Facilitydataarray=NULL) throw (CapiMsgError);
00251 
00259                 void facility_req (_cdword address, _cword FacilitySelector, _cstruct FacilityRequestParameter) throw (CapiMsgError);
00260 
00261                 /*************************** RESPONSES *******************************************/
00262 
00276                 void connect_resp (_cword messageNumber, _cdword plci, _cword reject, _cword B1protocol, _cword B2protocol, _cword B3protocol, _cstruct B1configuration, _cstruct B2configuration, _cstruct B3configuration) throw (CapiMsgError);
00277 
00284                 void connect_active_resp (_cword messageNumber, _cdword plci) throw (CapiMsgError);
00285 
00294                 void connect_b3_resp (_cword messageNumber, _cdword ncci, _cword reject, _cstruct ncpi) throw (CapiMsgError);
00295 
00302                 void connect_b3_active_resp (_cword messageNumber, _cdword ncci) throw (CapiMsgError);
00303 
00311                 void data_b3_resp (_cword messageNumber, _cdword ncci, _cword dataHandle) throw (CapiMsgError);
00312 
00321                 void facility_resp (_cword messageNumber, _cdword address, _cword facilitySelector, _cstruct facilityResponseParameter=NULL) throw (CapiMsgError);
00322 
00329                 void info_resp (_cword messageNumber, _cdword address) throw (CapiMsgError);
00330 
00337                 void disconnect_resp (_cword messageNumber, _cdword plci) throw (CapiMsgError);
00338 
00345                 void disconnect_b3_resp (_cword messageNumber, _cdword ncci) throw (CapiMsgError);
00346 
00347                 /********************************************************************************/
00348                 /*   main message handling method for incoming msgs                             */
00349                 /********************************************************************************/
00350 
00361                 void readMessage (void) throw (CapiMsgError, CapiError, CapiWrongState, CapiExternalError);
00362 
00363                 /********************************************************************************/
00364                 /*                      methods for internal use                                */
00365                 /********************************************************************************/
00366 
00375                 static string describeParamInfo (unsigned int info);
00376 
00381                 unsigned short getApplId(void) {return applId;}
00382 
00385                 virtual void run(void);
00386 
00391                 string prefix();
00392 
00393                 /********************************************************************************/
00394                 /*                              attributes                                      */
00395                 /********************************************************************************/
00396 
00399                 class CardProfileT
00400                 {
00401                         public:
00404                         CardProfileT()
00405                         :manufacturer(""),version(""),bChannels(0),fax(false),faxExt(false),dtmf(false)
00406                         {}
00407 
00408                         string manufacturer; 
00409                         string version; 
00410                         int bChannels; 
00411                         bool transp; 
00412                         bool fax; 
00413                         bool faxExt; 
00414                         bool dtmf; 
00415                         bool suppServ; 
00416                 };
00417 
00418                 short numControllers;  
00419                 string capiManufacturer, 
00420                        capiVersion; 
00421 
00422                 unsigned short DDILength; 
00423                 unsigned short DDIBaseLength; 
00424                 vector<string> DDIStopNumbers; 
00425                 
00426                 vector <CardProfileT> profiles; 
00427 
00428 
00429                 map <_cdword,Connection*> connections; 
00430 
00431 
00432                 _cword messageNumber;  
00433                 _cdword usedInfoMask;  
00434                 _cdword usedCIPMask;   
00435 
00436                 unsigned applId;  
00437 
00438                 ApplicationInterface *application; 
00439                 ostream &debug, 
00440                         &error; 
00441                 unsigned short debug_level; 
00442 
00443                 pthread_t thread_handle; 
00444 };
00445 
00446 #endif
00447 
00448 /*  History
00449 
00450 $Log: capi.h,v $
00451 Revision 1.5.2.3  2003/11/06 18:32:15  gernot
00452 - implemented DDIStopNumbers
00453 
00454 Revision 1.5.2.2  2003/11/02 14:58:16  gernot
00455 - use DDI_base_length instead of DDI_base
00456 - added DDI_stop_numbers option
00457 - use DDI_* options in the Connection class
00458 - call the Python script if number is complete
00459 
00460 Revision 1.5.2.1  2003/10/26 16:51:55  gernot
00461 - begin implementation of DDI, get DDI Info Elements
00462 
00463 Revision 1.5  2003/04/17 10:39:42  gernot
00464 - support ALERTING notification (to know when it's ringing on the other side)
00465 - cosmetical fixes in capi.cpp
00466 
00467 Revision 1.4  2003/04/08 07:50:48  gernot
00468 - fix wrong exception order which gcc-2.95 doesn't like...
00469 
00470 Revision 1.3  2003/04/04 09:14:02  gernot
00471 - setListenTelephony() and setListenFaxG3 now check if the given controller
00472   supports this service and throw an error otherwise
00473 
00474 Revision 1.2  2003/04/03 21:16:03  gernot
00475 - added new readProfile() which stores controller profiles in attributes
00476 - getInfo() only creates the string out of the stored values and doesn't
00477   do the real inquiry any more
00478 - getInfo() and numControllers aren't static any more
00479 
00480 Revision 1.1.1.1  2003/02/19 08:19:53  gernot
00481 initial checkin of 0.4
00482 
00483 Revision 1.22  2003/02/10 14:20:52  ghillie
00484 merged from NATIVE_PTHREADS to HEAD
00485 
00486 Revision 1.21.2.1  2003/02/09 15:05:36  ghillie
00487 - rewritten to use native pthread_* calls instead of CommonC++ Thread
00488 
00489 Revision 1.21  2003/01/06 16:29:52  ghillie
00490 - destructor doesn't throw any exceptions any more
00491 
00492 Revision 1.20  2003/01/04 16:07:42  ghillie
00493 - log improvements: log_level, timestamp
00494 
00495 Revision 1.19  2002/12/18 14:40:44  ghillie
00496 - removed this nasty listen_state. Made nothing than problems
00497 
00498 Revision 1.18  2002/12/11 13:05:34  ghillie
00499 - minor comment improvements
00500 
00501 Revision 1.17  2002/12/09 15:33:23  ghillie
00502 - debug and error stream now given in constructor
00503 
00504 Revision 1.16  2002/12/05 15:02:36  ghillie
00505 - constructor: removed param application (pointer to ApplicationInterface, now given by registerApplInterface()), added param debug giving debug stream
00506 - new methods registerApplicationInterface(), unregisterConnection()
00507 - connect_req gets COnnection* now
00508 
00509 Revision 1.15  2002/11/29 11:38:13  ghillie
00510 - missed some changes because CapiCommThread was deleted
00511 
00512 Revision 1.14  2002/11/29 11:11:12  ghillie
00513 - moved communication thread from own class (CapiCommThread) to Capi class
00514 
00515 Revision 1.13  2002/11/29 10:23:07  ghillie
00516 - updated comments, use doxygen format now
00517 
00518 Revision 1.12  2002/11/27 15:58:13  ghillie
00519 updated comments for doxygen
00520 
00521 Revision 1.11  2002/11/25 20:58:47  ghillie
00522 - improved documentation, is now readable by doxygen
00523 - setListen* can now set listen state for all available controllers
00524 
00525 Revision 1.10  2002/11/22 15:08:22  ghillie
00526 - new method select_b_protocol_req()
00527 - added SELECT_B_PROTOCOL_CONF case in readMessage()
00528 
00529 Revision 1.9  2002/11/19 15:57:18  ghillie
00530 - Added missing throw() declarations
00531 - phew. Added error handling. All exceptions are caught now.
00532 
00533 Revision 1.8  2002/11/18 14:24:09  ghillie
00534 - moved global severity_t to CapiError::severity_t
00535 - added throw() declarations
00536 
00537 Revision 1.7  2002/11/17 14:39:23  ghillie
00538 removed CapiError from this header -> exceptions are now defined in capiexception.h
00539 
00540 Revision 1.6  2002/11/15 15:25:53  ghillie
00541 added ALERT_REQ so we don't loose a call when we wait before connection establishment
00542 
00543 Revision 1.5  2002/11/13 08:34:54  ghillie
00544 moved history to the bottom
00545 
00546 Revision 1.4  2002/11/08 07:57:07  ghillie
00547 added functions to initiate a call
00548 corrected FACILITY calls to use PLCI instead of NCCI in DTMF processing as told by Mr. Ortmann on comp.dcom.isdn.capi
00549 
00550 Revision 1.3  2002/10/31 15:39:04  ghillie
00551 added missing FACILITY_RESP message (oops...)
00552 
00553 Revision 1.2  2002/10/31 12:37:35  ghillie
00554 added DTMF support
00555 
00556 Revision 1.1  2002/10/25 13:29:38  ghillie
00557 grouped files into subdirectories
00558 
00559 Revision 1.8  2002/10/09 14:36:22  gernot
00560 added CallModule base class for all call handling modules
00561 
00562 Revision 1.7  2002/10/09 11:18:59  gernot
00563 cosmetic changes (again...) and changed info function of CAPI class
00564 
00565 Revision 1.6  2002/10/08 12:01:26  gernot
00566 cosmetic... (indentation)
00567 
00568 Revision 1.5  2002/10/01 09:02:04  gernot
00569 changes for compilation with gcc3.2
00570 
00571 Revision 1.4  2002/09/22 14:22:53  gernot
00572 some cosmetic comment improvements ;-)
00573 
00574 Revision 1.3  2002/09/19 12:08:19  gernot
00575 added magic CVS strings
00576 
00577 * Sun Sep 15 2002 - gernot@hillier.de
00578 - put under CVS, cvs changelog follows above
00579 
00580 * Sun May 19 2002 - gernot@hillier.de
00581 - changed to not using QT libs any more
00582 - modified to conform to CAPI20-Spec, 4th edition (parameter names, ...)
00583 
00584 * Sun Apr 1 2002 - gernot@hillier.de
00585 - first version
00586 
00587 */

Generated on Sun Jan 18 11:12:46 2004 for CapiSuite by doxygen 1.3.2