- setListenTelephony() and setListenFaxG3 now check if the given controller

supports this service and throw an error otherwise


git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@67 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
gernot 2003-04-04 09:14:02 +00:00
parent a6261ffb65
commit aa9a6d58b1
2 changed files with 47 additions and 35 deletions

View File

@ -2,7 +2,7 @@
@brief Contains Capi - Main Class for communication with CAPI
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.3 $
$Revision: 1.4 $
*/
/***************************************************************************
@ -239,43 +239,39 @@ Capi::facility_req (_cdword address, _cword FacilitySelector, _cstruct FacilityR
void
Capi::setListenFaxG3 (_cdword Controller) throw (CapiMsgError)
Capi::setListenFaxG3 (_cdword controller) throw (CapiMsgError,CapiError)
{
usedCIPMask|=0x00020010;
if (!Controller) {
if (!controller) {
unsigned char buf[64];
for (int i=1;i<=numControllers;i++) {
unsigned info = CAPI20_GET_PROFILE(i, buf);
if (info!=0)
throw (CapiMsgError(info,"Error in CAPI20_GET_PROFILE: "+Capi::describeParamInfo(info),"Capi::setListenFaxG3()"));
if ((buf[8] & 0x10 && buf[12] & 0x10 && buf[16] & 0x10) // is controller able to handle faxG3?
|| (buf[8] & 0x10 && buf[12] & 0x10 && buf[16] & 0x20)) //faxG3ext
for (int i=1;i<=numControllers;i++)
if (profiles[i-1].fax || profiles[i-1].faxExt)
listen_req(i, usedInfoMask, usedCIPMask); // can throw CapiMsgError
}
}
else
listen_req(Controller, usedInfoMask, usedCIPMask); // can throw CapiMsgError
else {
if (profiles[controller-1].fax || profiles[controller-1].faxExt)
listen_req(controller, usedInfoMask, usedCIPMask); // can throw CapiMsgError
else
throw(CapiError("Chosen controller doesn't support fax services","Capi::setListenFaxG3"));
}
}
void
Capi::setListenTelephony (_cdword Controller) throw (CapiMsgError)
Capi::setListenTelephony (_cdword controller) throw (CapiMsgError,CapiError)
{
usedCIPMask|=0x00010012;
if (!Controller) {
if (!controller) {
unsigned char buf[64];
for (int i=1;i<=numControllers;i++) {
unsigned info = CAPI20_GET_PROFILE(i, buf);
if (info!=0)
throw (CapiMsgError(info,"Error in CAPI20_GET_PROFILE: "+Capi::describeParamInfo(info),"Capi::setListenTelephony()"));
if (buf[8] & 0x02 && buf[12] & 0x02 && buf[16] & 0x01) // is controller able to handle transparent?
for (int i=1;i<=numControllers;i++)
if (profiles[i-1].transp)
listen_req(i, usedInfoMask, usedCIPMask); // can throw CapiMsgError
}
}
else
listen_req(Controller, usedInfoMask, usedCIPMask); // can throw CapiMsgError
else {
if (profiles[controller-1].transp)
listen_req(controller, usedInfoMask, usedCIPMask); // can throw CapiMsgError
else
throw(CapiError("Chosen controller doesn't support voice (transparent) services","Capi::setListenTelephony"));
}
}
void
@ -915,6 +911,10 @@ Capi::getInfo(bool verbose)
/* History
$Log: capi.cpp,v $
Revision 1.4 2003/04/04 09:14:02 gernot
- setListenTelephony() and setListenFaxG3 now check if the given controller
supports this service and throw an error otherwise
Revision 1.3 2003/04/03 21:16:03 gernot
- added new readProfile() which stores controller profiles in attributes
- getInfo() only creates the string out of the stored values and doesn't

View File

@ -2,7 +2,7 @@
@brief Contains Capi - Main Class for communication with CAPI
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.2 $
$Revision: 1.3 $
*/
/***************************************************************************
@ -89,25 +89,33 @@ class Capi {
/** @brief Tell capi that we want to _additionally_ listen to Fax G3 calls
This method enables listening to fax calls from the analog network (coded as Bearer Capability 3.1kHz audio and
from ISDN coded as fax group 3. The previously set listen mask is not cleared, so that the application
can call this method after another listen request w/o loosing the other services.
This method enables listening to fax calls from the analog network (coded as Bearer Capability
3.1kHz audio and from ISDN coded as fax group 3. The previously set listen mask is not cleared,
so that the application can call this method after another listen request w/o loosing the other
services.
It will also check if this controller is able to handle this service and throw an error otherwise.
@param Controller Nr. of Controller (0 = all available controllers)
@throw CapiMsgError Thrown by listen_req, see there for details
@throw CapiError Thrown if the given controller can't handle fax group 3
*/
void setListenFaxG3 (_cdword Controller=0) throw (CapiMsgError);
void setListenFaxG3 (_cdword Controller=0) throw (CapiError,CapiMsgError);
/** @brief Tell capi that we want to _additionally_ listen to Telephony calls
This method enables listening to speech calls from the analog network (coded as Bearer Capability 3.1kHz audio) and
from ISDN (coded as Bearer Capability Speech or High Layer Compatibility telephony). The previously set listen mask
is not cleared, so that the application can call this method after another listen request w/o loosing the other services.
This method enables listening to speech calls from the analog network (coded as Bearer Capability
3.1kHz audio) and from ISDN (coded as Bearer Capability Speech or High Layer Compatibility telephony).
The previously set listen mask is not cleared, so that the application can call this method after
another listen request w/o loosing the other services.
It will also check if this controller is able to handle this service and throw an error otherwise.
@param Controller Nr. of Controller (0 = all available controllers)
@throw CapiMsgError Thrown by listen_req, see there for details
@throw CapiError Thrown if the given controller can't handle fax group 3
*/
void setListenTelephony (_cdword Controller=0) throw (CapiMsgError);
void setListenTelephony (_cdword Controller=0) throw (CapiError,CapiMsgError);
/** @brief Static Returns some info about the installed Controllers
@ -364,7 +372,7 @@ class Capi {
/** @brief Thread body - endless loop, will be blocked until message is received and then call readMessage()
*/
virtual void run(void);
/** @brief return a prefix containing this pointer and date for log messages
@return constructed prefix as string
@ -425,6 +433,10 @@ class Capi {
/* History
$Log: capi.h,v $
Revision 1.3 2003/04/04 09:14:02 gernot
- setListenTelephony() and setListenFaxG3 now check if the given controller
supports this service and throw an error otherwise
Revision 1.2 2003/04/03 21:16:03 gernot
- added new readProfile() which stores controller profiles in attributes
- getInfo() only creates the string out of the stored values and doesn't