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

Capi::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)

Constructor. Registers our App at CAPI and start the communication thread.

debug reference to a ostream object where debug info should be written to
debug_level verbosity level for debug messages
error reference to a ostream object where errors should be written to
DDILength if ISDN interface is in PtP mode, the length of the DDI must be set here. 0 means disabled (PtMP)
DDIBaseLength the base number length w/o extension (and w/o 0) if DDI is used
DDIStopNumbers list of DDIs shorter than DDILength we will accept
maxLogicalConnection max. number of logical connections we will handle
maxBDataBlocks max. number of unconfirmed B3-datablocks, 7 is the maximum supported by CAPI
maxBDataLen max. B3-Datablocksize, 2048 is the maximum supported by CAPI
CapiError Thrown if no ISDN controller is reported by CAPI
CapiMsgError Thrown if registration at CAPI wasn't successful.

Definition at line 35 of file capi.cpp.

References numControllers.

      if (debug_level >= 2)
            debug << prefix() << "Capi object created" << endl;
      readProfile(); // can throw CapiMsgError. Just propagate...

      if (Capi::numControllers==0)
            throw (CapiError("No ISDN-Controller installed","Capi::Capi()"));

      unsigned info = capi20_register(maxLogicalConnection, maxBDataBlocks, maxBDataLen, &applId);
      if (applId == 0 || info!=0)
            throw (CapiMsgError(info,"Error while registering application: "+describeParamInfo(info),"Capi::Capi()"));

      if (DDILength)
            usedInfoMask|=0x80; // enable Called Party Number Info Element for PtP configuration

      for (int i=1;i<=numControllers;i++)
            listen_req(i, usedInfoMask, usedCIPMask); // can throw CapiMsgError

      int erg=pthread_create(&thread_handle, NULL, capi_exec_handler, this); // create a normal thread
      if (erg!=0)
            throw (CapiMsgError(erg,"Error while starting message thread","Capi::Capi()"));

Generated by  Doxygen 1.6.0   Back to index