How to activate snap group account on Symbian 9.x upwards platform
来源:互联网 发布:mac wifi未安装硬件 编辑:程序博客网 时间:2024/06/02 01:24
With the UIQ 2 platform, users would have to manually make these connections from the settings menu every time they changed their environment. With the UIQ 3 platform, anytime ActiveSync attempts to connect to the internet, the phone will automatically select the best network connection to be used without any user intervention.
Here is an example for activating a single Internet group on UIQ3.
// ------- gets the default snap account id
void GetDefaultIAPL(TUint32 &defaultSnapID) {
CMDBSession *pDbSession = NULL;
CMDBRecordSet<CCDGlobalSettingsRecord> *pGlobalSettingsRecSet = NULL;
defaultSnapID = 0;
// start the session
pDbSession = CMDBSession::NewLC(CMDBSession::LatestVersion());
// load the global settings
pGlobalSettingsRecSet = new (ELeave) CMDBRecordSet<CCDGlobalSettingsRecord>(KCDTIdGlobalSettingsRecord);
CleanupStack::PushL(pGlobalSettingsRecSet);
pGlobalSettingsRecSet->LoadL(*pDbSession);
// get the default SNAP ID
if (pGlobalSettingsRecSet->iRecords.Count())
defaultSnapID = static_cast<TUint32>((*pGlobalSettingsRecSet)[0]->iDefaultSnap);
CleanupStack::PopAndDestroy(pGlobalSettingsRecSet); // pGlobalSettingsRecSet
CleanupStack::PopAndDestroy(pDbSession); // pDbSession
}
//-------
//------- connnects to the internet
{
TCommSnapPref iSNAPPrefs;
RConnection iConnection;
RSocketServ iSocketServer;
TUint32 currIAPID = 0;
iSocketServer.Connect();
iConnection.Open(iSocketServer);
GetDefaultIAPL(currIAPID); // please see function above for this
iSNAPPrefs.SetSnap(currIAPID);
iConnection.Start(iSNAPPrefs, iStatus);
SetActive();
}
//-------
//------- gets a list of snap accounts
class CSnapAccountInfo : public CBase
{
public:
CSnapAccountInfo() : mpName(NULL), mId(0), mIsDefault(EFalse) { }
virtual ~CSnapAccountInfo() { delete mpName; }
HBufC* mpName;
TUint32 mId;
TBool mIsDefault;
};
void GetListOfAccessPointsL(CArrayPtrFlat<CSnapAccountInfo> **ppListSnapAccounts) {
TUint32 defaultID = 0;
CSnapAccountInfo *pCurrSnapAccountsInfo = NULL;
CArrayPtrFlat<CSnapAccountInfo> *pLocalListSnapAccounts = NULL;
CMDBSession *pDbSession = NULL;
CMDBRecordSet<CCDGlobalSettingsRecord> *pGlobalSettingsRecSet = NULL;
CMDBRecordSet<CCDAccessPointRecord> *pSnapRecordSet = NULL;
CCDAccessPointRecord *pCurrSNAPRec = NULL;
// start the session
pDbSession = CMDBSession::NewLC(CMDBSession::LatestVersion());
// load the global settings
pGlobalSettingsRecSet = new (ELeave) CMDBRecordSet<CCDGlobalSettingsRecord>(KCDTIdGlobalSettingsRecord);
CleanupStack::PushL(pGlobalSettingsRecSet);
pGlobalSettingsRecSet->LoadL(*pDbSession);
// load the SNAp record list
pSnapRecordSet = new (ELeave) CMDBRecordSet<CCDAccessPointRecord>(KCDTIdAccessPointRecord);
CleanupStack::PushL(pSnapRecordSet);
pSnapRecordSet->LoadL(*pDbSession);
// get the default SNAP ID
if (pGlobalSettingsRecSet->iRecords.Count())
defaultID = static_cast<TUint32>((*pGlobalSettingsRecSet)[0]->iDefaultSnap);
// create the array to hold the access point info
*ppListSnapAccounts = NULL;
pLocalListSnapAccounts = new (ELeave) CArrayPtrFlat<CSnapAccountInfo>(4);
CleanupStack::PushL(pLocalListSnapAccounts);
// parse the SNAP record list to extract the display info
for (TInt i = 0; i < pSnapRecordSet->iRecords.Count(); ++i)
{
pCurrSNAPRec = (*pSnapRecordSet)[i];
pCurrSnapAccountsInfo = new (ELeave) CSnapAccountInfo;
CleanupStack::PushL(pCurrSnapAccountsInfo);
TPtrC recNamePtr(pCurrSNAPRec->iRecordName);
pCurrSnapAccountsInfo->mpName = recNamePtr.AllocL();
pCurrSnapAccountsInfo->mId = pCurrSNAPRec->RecordId();
if (pCurrSnapAccountsInfo->mId == defaultID)
pCurrSnapAccountsInfo->mIsDefault = ETrue;
pLocalListSnapAccounts->AppendL(pCurrSnapAccountsInfo);
CleanupStack::Pop(pCurrSnapAccountsInfo);
}
// now pass back the list
*ppListSnapAccounts = pLocalListSnapAccounts;
CleanupStack::Pop(pLocalListSnapAccounts);
CleanupStack::PopAndDestroy(pSnapRecordSet); // pSnapRecordSet
CleanupStack::PopAndDestroy(pGlobalSettingsRecSet); // pGlobalSettingsRecSet
CleanupStack::PopAndDestroy(pDbSession); // pDbSession }
//-------
- How to activate snap group account on Symbian 9.x upwards platform
- how to manage upwards
- How to activate Serial Console on Debian Squeeze
- How to use OpenID to sign on with Google account
- How to back up and restore Gmail account on Linux
- Eventually,I activate my blog account on CSDN.NET
- How to add an account to administrator group, and get root privilege.
- Tips: How to relink Oracle 9ias on Unix platform
- How to compile VLC on Linux Platform (From the authority)
- How to generate unique key on Android platform
- how to cross compile valgrind on android platform
- How to Install PyQt4 on OS X
- How to solve symbian Error: Error: Invalid argument: /X
- How to add Snap-in (扩展Powershell)
- How to debug apps on Kindle Fire on OS X
- How to use obex-data-server to transfer a file on ARM-xScale platform (原创)
- How to make XAML project to build faster on the Windows Platform
- How to configure MailEnable to send emails on Google Cloud Platform instance?
- ajax是否存在潜在危险
- 使用Excel“自动化”功能将数据输出到Excel的三种高效方法对比实验
- 我的股票:2007/06/18 净值:不变
- 是什么I18N/L10N ?
- 关于Window.open [总结]
- How to activate snap group account on Symbian 9.x upwards platform
- 牛人的七年IT奋斗纪实及感悟【转载】
- asp横向循环的问题
- 工作3个月纪念
- In-place editing of ListView subitems
- Shrink SQL Server Log Files
- 表中的两个字段拼接到一起,做为查询条件
- LINUX下获取IP地址和MAC地址
- 浅出Java Socket编程(转)