Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.


From Wiki
Jump to: navigation, search
Article Metadata

huwell 在 28 Jun 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 3rd Edition

  • 说明:

因为S60第三版中出于平台安全的考虑,所有信息设置已经被转移到Central Repository数据存储中。这样的转变导致老的SMS设置API(如CSmsSettings存储和输出函数)无法使用,当需要在S60第三版上发送一个短信时再使用它们会引发KErrGsmSMSUnspecifiedProtocol和KErrGsmSMSInvalidMandatoryInformation错误。

  • 详细描述:


// ----------------------------------------
// Sets the message center to the message
// ----------------------------------------
TInt CFW3MsgEngine::SetSMSCL()
TInt err = 0;
// CSmsHeader encapsulates data specific for sms messages,
// like service center number and options for sending.
CSmsHeader& header = iMtm->SmsHeader();
CSmsSettings* settings = CSmsSettings::NewL();
CSmsNumber* sc = CSmsNumber::NewL(); //CSmsNumber* sc = 0;
//--------- SMSC & header set-up
settings->CopyL(iMtm->ServiceSettings()); // restore existing settings
// set send options
settings->SetDelivery(ESmsDeliveryImmediately); // set to be delivered immediately
// Set SMSC address
if (header.Message().ServiceCenterAddress().Length() == 0)
// No smsc set. We assume there is at least one sc number defined and use
// the default SC number.
CSmsSettings* serviceSettings = &(iMtm->ServiceSettings());
// if number of scaddresses in the list is null
if (!serviceSettings->ServiceCenterCount()) // New messaging API uses new methods
// here there should be a dialog in which user can add sc number
_LIT(KNotSet,"SMSC not set");
// Display a Note
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->ShowNoteL(EAknGlobalInformationNote , KNotSet);
CleanupStack::PopAndDestroy(); // globalNote
// set sc address to default.
// New messaging API uses new methods
//--------- SMSC & header set-up
CleanupStack::PopAndDestroy(2); // sc, settings
return err;
This page was last modified on 15 December 2011, at 10:43.
48 page views in the last 30 days.