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

void Connection::buildBconfiguration ( _cdword  controller,
service_t  service,
string  faxStationID,
string  faxHeadline,
_cword &  B1proto,
_cword &  B2proto,
_cword &  B3proto,
_cstruct &  B1config,
_cstruct &  B2config,
_cstruct &  B3config 
) throw (CapiExternalError) [protected]

called to build the B Configuration info elements out of given service

This is a convenience function to do the quite annoying enconding stuff for the 6 B configuration parameters.

It also checks if the requested controller really has this abilities and throws an exception otherwise.

Parameters:
controller number of controller to use - necessary to check available services
service value indicating service to be used as described in service_t
faxStationID my fax station ID
faxHeadline the fax headline, encoded in ISO8859-1
B1proto return value: B1protocol value for CAPI, see CAPI spec
B2proto return value: B2protocol value for CAPI, see CAPI spec
B3proto return value: B3protocol value for CAPI, see CAPI spec
B1config return value: B1configuration element for CAPI, see CAPI spec
B2config return value: B2configuration element for CAPI, see CAPI spec
B3config return value: B3configuration element for CAPI, see CAPI spec
Exceptions:
CapiExternalError thrown when the ISDN controller doesn't support the wanted service

Definition at line 1043 of file connection.cpp.

References capi, convertToCP437(), FAXG3, Capi::profiles, service, and VOICE.

Referenced by changeProtocol(), Connection(), and connectWaiting().

{
      switch (service) {
            case VOICE:
                  if (!capi->profiles[controller-1].transp)
                        throw (CapiExternalError("controller doesn't support voice (transparent) services","Connection::buildBconfiguration()"));
                  B1proto=1;  // bit-transparent
                  B2proto=1;  // Transparent
                  B3proto=0;  // Transparent
                  B1config=NULL; // no configuration for bit-transparent available
                  B2config=NULL; // no configuration for transparent available
                  B3config=NULL; // no configuration for transparent available
            break;

            case FAXG3: {
                  B1proto=4; // T.30 modem for Fax G3
                  B2proto=4; // T.30 for Fax G3
                  if (capi->profiles[controller-1].faxExt)
                        B3proto=5; // T.30 for Fax G3 Extended
                  else if (capi->profiles[controller-1].fax)
                        B3proto=4; // T.30 for Fax G3
                  else
                        throw (CapiExternalError("controller doesn't support fax services","Connection::buildBconfiguration()"));

                  B1config=NULL; // default configuration (adaptive maximum baud rate, default transmit level)
                  B2config=NULL; // no configuration available

                  if (faxStationID.size()>20) // stationID mustn't exceed 20 characters
                        faxStationID=faxStationID.substr(0,20);
                  if (faxHeadline.size()>254)  // if the string would be longer the struct must be coded different, but I think a header > 254 bytes has no sence
                        faxHeadline=faxHeadline.substr(0,254);

                  // convert faxHeadline to CP437 for AVM drivers as they expect the string in this format
                  if (capi->profiles[controller-1].manufacturer.find("AVM")!=std::string::npos)
                        convertToCP437(faxHeadline);

                  B3config=new unsigned char [1+2+2+1+faxStationID.size()+1+faxHeadline.size()]; // length + 1 byte for the length itself
                  int i=0;
                  B3config[i++]=2+2+1+faxStationID.size()+1+faxHeadline.size();  // length
                  B3config[i++]=0; B3config[i++]=0; // resolution = standard
                  B3config[i++]=0; B3config[i++]=0; // format: SFF
                  B3config[i++]=faxStationID.size();
                  for (unsigned j=0;j<faxStationID.size();j++)
                        B3config[i++]=faxStationID[j];
                  B3config[i++]=faxHeadline.size();
                  for (unsigned j=0;j<faxHeadline.size();j++)
                        B3config[i++]=faxHeadline[j];
            } break;

            default:
                  throw CapiExternalError("unsupported service given by application","Connection::buildBconfiguration()");
            break;
      }
}


Generated by  Doxygen 1.6.0   Back to index