How to know the tsy name programatically on a specific device
Article Metadata
In order to load a tsy on a device, we need to pass a device specific tsy name, i.e erigsm.tsy, to RTelServer::LoadPhoneModule(). Without hard coding the name of the tsy and keep the code as portable as possible,knowing the tsy name programatically on a specific device will be a lot helpful.
This can be programatically retrieved, since tsy name is stored in the commdb in the modem bearer table for phone and SMS services.
The following code can be useful to get the tsy name:
CCommsDatabase* const db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
CleanupStack::PushL(db); // PUSH
TUint32 modemId = 0;
//Find the modem bearer for phone and SMS service.
db->GetGlobalSettingL(TPtrC(MODEM_PHONE_SERVICES_SMS), modemId);
// PUSH
CCommsDbTableView* const view =
db->OpenViewMatchingUintLC(TPtrC(MODEM), TPtrC(COMMDB_ID), modemId);
TInt err = view->GotoFirstRecord();
User::LeaveIfError(err);
TFileName tsyName;
view->ReadTextL(TPtrC(MODEM_TSY_NAME), tsyName);
User::LeaveIfError(telServer.LoadPhoneModule(tsyName));
CleanupStack::PopAndDestroy(2, db); // view & db
--


In [CODE] User::LeaveIfError(telServer.LoadPhoneModule(tsyName)); [/CODE]
I have KERN-EXEC 0 panic. Tested on the emulator and E71 device.