---
title: "设置symbian信息中心号"
author: "netxdiy"
date: "2011-04-08T17:59:00Z"
tags: []
slug: "symbian"
draft: false
lastmod: "2012-09-27T10:57:12Z"
id: 1686581
url: "https://netxdiy.iteye.com/blog/1686581"
---

代码：

CSmsAccount* account = CSmsAccount::NewL();  
CleanupStack::PushL(account);  
CSmsSettings* sendOptions = CSmsSettings::NewL();  
CleanupStack::PushL(sendOptions);  
account-&gt;InitialiseDefaultSettingsL(\*sendOptions);  
sendOptions-&gt;CopyL(iSmsMtm-&gt;ServiceSettings()); // restore existing settings  
// set send options  
sendOptions-&gt;SetDelivery(ESmsDeliveryImmediately); // set to be delivered immediately  
sendOptions-&gt;SetStatusReportHandling(CSmsSettings::EDiscardReport);  
sendOptions-&gt;SetDeliveryReport(EFalse);  
// here we modified the character set  
sendOptions-&gt;SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabetUCS2);  
scIndex = sendOptions-&gt;DefaultServiceCenter();  
if ((scIndex &lt; 0) || (scIndex &gt;= numSCAddresses))  
scIndex = 0;  
sendOptions-&gt;GetServiceCenter(scIndex).SetAddressL(CnBuf);  
//This can only be used on SMS-SUBMIT type messages. The message PDU  
//type can be checked by using the CSmsHeader::Type API.  
//sendOptions-&gt;AddServiceCenterL(\_L("scenter"),\_L("+8613800200502"));  
sendOptions-&gt;SetCommDbAction( CSmsSettings::EStoreToCommDb );  
sendOptions-&gt;SetSmsBearerAction( CSmsSettings::EStoreToCommDb );  
//header.SetServiceCenterAddressL(CnBuf); //改变短信中心号码  
//header.SetSmsSettingsL(\*sendOptions);  
account-&gt;SaveSettingsL(\*sendOptions);  
CleanupStack::PopAndDestroy(sendOptions);  
CleanupStack::PopAndDestroy(account);