Symbian Developer Library


[Index] [Glossary] [Previous] [Next]

Using RTelServer class

This section describes, by example, some of the less intuitive behaviour of the RTelServer class.

Loading a TSY module

To use a specific modem, client applications must first load a TSY module which supports its functionality. This is achieved by passing the file name of the TSY to the LoadPhoneModule() function, as shown below:

RTelServer server;
Int ret = server.Connect();

In the case above the server is first connected, and then the Hayes TSY is loaded. Note that the name of the TSY has been hard coded. This is not recommended practice. Instead the name of the TSY module should be obtained by querying the communications database for the name of the currently selected TSY, or by scanning the \system\libs\ directory of each drive for files with the *.tsy extension. An example of how to scan the file system for a particular file type is provided in the File Server examples.

The code fragment below shows a function which can be used to obtain the name of the currently selected TSY. The project should also #include commdb.h, and link to commdb.lib.

void CExampleCode::GetTsyNameL(TDes& aTsyName)
 CCommsDatabase* db = CCommsDatabase::NewL();
 TUint32 id;
 db->GetDefaultRecordL(TPtrC(CONNECTED_MODEM), id);
 CCommsDbTableView* table = db->OpenViewMatchingUintLC(TPtrC(CONNECTED_MODEM), TPtrC(COMMDB_ID), id);
 TBuf<KCommsDbSvrMaxFieldLength> tsyName;
 table->ReadTextL(TPtrC(MODEM_TSY_NAME), aTsyName);
 delete db;