To manipulate the default modems and locations you can use the global settings functions provided by CCommsDatabase
. Two examples of using these global settings are provided below.
Create a modem record as follows:
TUint32 recordId;
table=theDb->OpenTableLC(TPtrC(MODEM)); //TheDb is of type CCommsDatabase
table->InsertRecord(recordId);
//
//Fill in the appropriate fields for the modem record
//
table->PutRecordChanges();
CleanupStack::PopAndDestroy(); //table
Using the CCommsDatabase::SetGlobalSettingL()
function, set the MODEM_DATA_FAX
setting with the COMMDB_ID
of the modem record to be used as default modem for data transactions.
theDb->SetGlobalSettingL(TPtrC(MODEM_DATA_FAX), recordId);
The following example demonstrates how to obtain the ID for the modem to be used for data transactions and open the record corresponding to the default modem.
TUint32 defaultModemDataId;
theDb->GetGlobalSettingL(TPtrC(MODEM_DATA_FAX),defaultModemDataId);
CCommsDbTableView* table =
theDb->OpenViewMatchingUintLC(TPtrC(MODEM),TPtrC(COMMDB_ID),defaultModemDataId);
Similar techniques may be used to set or obtain the global settings MODEM_PHONE_SERVICES_SMS
, LOCATION_DATA_FAX
and LOCATION_PHONE_SERVICES_SMS
.