注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

回首望星辰

See you in the next world

 
 
 

日志

 
 

Symbian添加手机上的短信中心号码  

2009-10-20 14:54:28|  分类: 手机开发 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

添加手机新短信中心号码:
CSmsSettings*sSettings = CSmsSettings::NewL();

CSmsAccount* account = CSmsAccount::NewLC();
account->InitialiseDefaultSettingsL(*sSettings);
sSettings->SetValidityPeriod(ESmsVPWeek);
sSettings->SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger);
sSettings->AddServiceCenterL(_L("vincent"), _L("+8613800138000"));
sSettings->AddServiceCenterL(_L("vvvincent"), _L("+8613800138000"));
sSettings->SetDefaultServiceCenter(1);
sSettings->SetReplyQuoted(EFalse);
sSettings->SetRejectDuplicate(ETrue);
sSettings->SetDelivery(ESmsDeliveryImmediately);
sSettings->SetDeliveryReport(ETrue);
sSettings->SetReplyPath(EFalse);
sSettings->SetMessageConversion(ESmsConvPIDNone);
sSettings->SetCanConcatenate(ETrue);

account->SaveSettingsL(*sSettings);

修改手机短信中心号码:
CSmsAccount* account = CSmsAccount::NewL();
CleanupStack::PushL(account);
CSmsSettings* sendOptions = CSmsSettings::NewL();
CleanupStack::PushL(sendOptions);
account->InitialiseDefaultSettingsL(*sendOptions);
sendOptions->CopyL(iSmsMtm->ServiceSettings()); // restore existing settings
// set send options
sendOptions->SetDelivery(ESmsDeliveryImmediately); // set to be delivered immediately
sendOptions->SetStatusReportHandling(CSmsSettings::EDiscardReport);
sendOptions->SetDeliveryReport(EFalse);
// here we modified the character set
sendOptions->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabetUCS2);
scIndex = sendOptions->DefaultServiceCenter();
if ((scIndex < 0) || (scIndex >= numSCAddresses))
scIndex = 0;
sendOptions->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->AddServiceCenterL(_L("scenter"),_L("+8613800200502"));
sendOptions->SetCommDbAction( CSmsSettings::EStoreToCommDb );
sendOptions->SetSmsBearerAction( CSmsSettings::EStoreToCommDb );
//header.SetServiceCenterAddressL(CnBuf); //改变短信中心号码
//header.SetSmsSettingsL(*sendOptions);
account->SaveSettingsL(*sendOptions);
CleanupStack::PopAndDestroy(sendOptions);
CleanupStack::PopAndDestroy(account);
=====================================================

获取短信中心号码(不用AT指令)

CSmsSettings& serviceSettings = iSmsMtm->ServiceSettings();
const TInt numSCAddresses = serviceSettings.ServiceCenterCount();

TInt scIndex=0;

if (numSCAddresses > 0)
{
scIndex = serviceSettings.DefaultServiceCenter();
if ((scIndex < 0) || (scIndex >= numSCAddresses))
{
return EFalse;
}

CSmsServiceCenter& serviceCenter = serviceSettings.GetServiceCenter(scIndex);
TBuf<64> scNum(serviceCenter.Address());
}

  评论这张
 
阅读(780)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017