Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to use the global settings to manage modems/locations for two-box device

Note: This section is provided as a reference for the legacy CommDb component, which has been superceded by the CommsDat component. It is strongly recommended that users migrate to CommsDat. Migration information is available in the CommsDat API and Migration Guide.

[Top]


Introduction

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.

[Top]


Setting the default modem for data

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); 

[Top]


Getting the default modem settings

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.