本文整理汇总了C++中TCommDbConnPref::SetDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ TCommDbConnPref::SetDirection方法的具体用法?C++ TCommDbConnPref::SetDirection怎么用?C++ TCommDbConnPref::SetDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCommDbConnPref
的用法示例。
在下文中一共展示了TCommDbConnPref::SetDirection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TCommDbConnPref
void
CConnectionManager::OpenLinkLayerConnectionL()
{
#ifdef USE_RCONNECTION
User::LeaveIfError(iSocketServ->Connect());
User::LeaveIfError(iConnection->Open(*iSocketServ));
TCommDbConnPref prefs = TCommDbConnPref();
if (iIAP >= 0) {
prefs.SetIapId(iIAP);
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
iConnection->Start(prefs, iStatus);
} else if (iIAP == -2) {
// Debug mode - use system default
iConnection->Start(iStatus);
} else {
// Use Always ask
prefs.SetDialogPreference(ECommDbDialogPrefPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
# ifdef NAV2_CLIENT_SERIES60_V2
prefs.SetBearerSet( EApBearerTypeGPRS | EApBearerTypeHSCSD );
# else //s80, s90
prefs.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma |
ECommDbBearerCdma2000 | ECommDbBearerPSD );
# endif
iConnection->Start(prefs, iStatus);
}
SetActive();
#endif
}
示例2: SetupL
void UT_CNATFWUNSAFServerQuery::SetupL()
{
iResultArray = new (ELeave) RArray<TInetAddr>;
User::LeaveIfError(iServer.Connect(KESockDefaultMessageSlots));
User::LeaveIfError(iConnection.Open(iServer, KConnectionTypeDefault));
TCommDbConnPref prefs;
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
prefs.SetIapId(10);
User::LeaveIfError(iConnection.Start(prefs));
iHostResolver = CNATFWUNSAFHostResolver::NewL(iServer, iConnection);
iObserver = UT_CNATFWUNSAFServerResolverObserverStub::NewL();
CNATFWUNSAFQueryData* query = CNATFWUNSAFQueryData::NewL(
iObserver,
5060,
_L8("udp"),
_L8("testi.net"),
_L8("stun"),
*iHostResolver,
*iResultArray );
CleanupStack::PushL(query);
iServerQuery = CNATFWUNSAFServerQuery::NewL( iObserver, query );
CleanupStack::Pop( query );
}
示例3: SetupL
void UT_CNATFWUNSAFUdpSender::SetupL()
{
User::LeaveIfError( iServer.Connect( 8 ) );
User::LeaveIfError( iConn.Open( iServer, KConnectionTypeDefault ) );
TCommDbConnPref prefs;
prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
prefs.SetDirection( ECommDbConnectionDirectionOutgoing );
prefs.SetIapId(10);
User::LeaveIfError( iConn.Start( prefs ) );
User::LeaveIfError( iSocket.Open( iServer,
KAfInet,
KSockDatagram,
KProtocolInetUdp,
iConn ) );
iMsg = NATFWUNSAFTransportTestUtils::CreateUNSAFBindingRequestL();
iAddr = TInetAddr( INET_ADDR( 127, 0, 0, 1 ) );
iSender = CNATFWUNSAFUdpSender::NewL( iSocket, *this );
iIsMsgSent = EFalse;
}
示例4: SetIap
TInt CResourceManager::SetIap(TUint32 aIapId, TBool aIsWap)
{
m_bUseOutNetSettting = false;
m_socketServ.Connect();
m_connection.Open(m_socketServ);
m_iapId = aIapId;
m_isWap = aIsWap;
TInt err = KErrNone;
// Now we have the iap Id. Use it to connect for the connection.
// Create a connection preference variable.
TCommDbConnPref connectPref;
// setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
connectPref.SetBearerSet(ECommDbBearerGPRS | ECommDbBearerWLAN | ECommDbBearerLAN);
//Sets the CommDb ID of the IAP to use for this connection
connectPref.SetIapId(aIapId);
err = m_connection.Start(connectPref);
if (err == KErrNone) {
m_IAPSeted = true;
m_IAPReady = true;
ResendRequest();
}
return err;
}
示例5: SetupL
void UT_CRtpComm::SetupL( )
{
iTimer = CPeriodic::NewL( EPriorityNormal );
iErr=0;
TCommDbConnPref prefs;
prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
prefs.SetDirection( ECommDbConnectionDirectionOutgoing );
prefs.SetIapId( KDefaultIap );//6
TInt err( KErrCouldNotConnect );
// Opens a session to the socket server
// i.e. creates an IPC communication channel to the socket server
if ( ( err = iSocketServ.Connect() ) != KErrNone )
{
EUNIT_ASSERT( err==KErrNone );
}
// Opens a new RConnection instance
else if (( err = iConnection.Open( iSocketServ )) != KErrNone )
{
iConnection.Close();
EUNIT_ASSERT( err==KErrNone );
}
else if (( err = iConnection.Start( prefs )) != KErrNone )
{
iConnection.Close();
EUNIT_ASSERT( err==KErrNone );
}
}
示例6: StartInterfaceL
// -----------------------------------------------------------------------------
// CSIPExSocketEngine::StartInterfaceL
// Activates PDP ctx
// -----------------------------------------------------------------------------
//
void CSIPExSocketEngine::StartInterfaceL( const TUint32 aIapId )
{
if( !iConnection.SubSessionHandle() )
{
User::LeaveIfError( iConnection.Open( iSocketServer ) );
}
TCommDbConnPref prefs;
prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
prefs.SetDirection( ECommDbConnectionDirectionOutgoing );
prefs.SetIapId( aIapId );
User::LeaveIfError( iConnection.Start( prefs ) );
}
示例7: SetupL
void UT_CNATFWUNSAFServerResolver::SetupL()
{
iResultArray = new (ELeave) RArray<TInetAddr>;
User::LeaveIfError(iServer.Connect(KESockDefaultMessageSlots));
User::LeaveIfError(iConnection.Open(iServer, KConnectionTypeDefault));
TCommDbConnPref prefs;
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
prefs.SetIapId(10);
User::LeaveIfError(iConnection.Start(prefs));
iObserver = UT_CNATFWUNSAFServerResolverObserverStub::NewL();
iServerResolver = CNATFWUNSAFServerResolver::NewL(iServer,
iConnection,
*iObserver,
EFalse);
}
示例8: Start
/**
* Connect to the network using this IAP ID
*/
TInt CRconn::Start(TUint32 aIapId, TBool aPrompt)
{
DEBUG_INFO("CRconn::Start: IAP id %u\n", aIapId);
Cancel();
TCommDbConnPref prefs;
prefs.SetIapId(aIapId);
if (aPrompt)
prefs.SetDialogPreference(ECommDbDialogPrefPrompt);
else
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
iConn.Start(prefs, iStatus);
SetActive();
return 0;
}
示例9: SetupL
void UT_CNATTraversalController::SetupL()
{
User::LeaveIfError(iSocketServ.Connect());
User::LeaveIfError(iConnection.Open(iSocketServ));
TCommDbConnPref prefs;
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
prefs.SetIapId(KIapId);
User::LeaveIfError(iConnection.Start(prefs));
User::LeaveIfError(iSocket.Open(iSocketServ,
KAfInet,
KSockDatagram,
KProtocolInetUdp,
iConnection));
User::LeaveIfError(iLocalAddr.Input(KLocalAddr));
User::LeaveIfError(iNextHopAddr.Input(KNextHopAddr));
TSIPNATTraversalControllerInitParams initParams(iSocketServ);
iController = CNATTraversalController::NewL(&initParams);
}
示例10: SetupConnectionL
void CommonSocketConnection::SetupConnectionL()
{
iSocketServ.Connect();
iSocketServ.ShareAuto();
iConnection.Open(iSocketServ);
iStatus = KRequestPending;
TCommDbConnPref pref;
pref.SetDirection(ECommDbConnectionDirectionOutgoing);
if(iAccessPointId!=INVALID_IAPID)
{
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
pref.SetIapId(iAccessPointId);
iConnection.Start(pref,iStatus);
}
else
{
//SetDefaultIap(0); //cmnet
pref.SetDialogPreference(ECommDbDialogPrefPrompt);
iConnection.Start(pref,iStatus);
}
iConnectionState = EConnecting;
SetActive();
}
示例11: ConstructL
void FConnection::ConstructL()
{
iLastError = KErrNone;
StringBuffer errMsg;
TCommDbConnPref prefs;
// Connect SocketServer session
iLastError = iSession.Connect();
if (iLastError != KErrNone) {
errMsg.sprintf("FConnection error: unable to connect SocketServ (code %d)", iLastError);
goto error;
}
// *Note*: THIS IS MANDATORY TO USE THE SAME SESSION FROM DIFFERENT THREADS!
// After calling this function the RSocketServ object
// may be used by threads other than than the one that created it.
iLastError = iSession.ShareAuto();
if (iLastError != KErrNone) {
errMsg.sprintf("FConnection error: unable to share SocketServ (code %d)", iLastError);
goto error;
}
//
// Default preferences: no prompt, just to initialize the connection object
//
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetDirection(ECommDbConnectionDirectionUnknown);
prefs.SetIapId(0);
// Opens the connection
openConnection();
return;
error:
LOG.error("%s", errMsg.c_str());
}
示例12: SetupConnection
//.........这里部分代码省略.........
if (iCurrentProfileId == EConnectionStatus::Disconnected)
{
iBearerFilter = EApBearerTypeWLAN;
}
// Show IAP selection dialog
/*CActiveApDb* aDb = CActiveApDb::NewL();
CleanupStack::PushL(aDb);
CApSettingsHandler* settings = CApSettingsHandler::NewLC
(
*aDb
, ETrue
, EApSettingsSelListIsPopUp
, EApSettingsSelMenuSelectNormal
, KEApIspTypeAll
, iBearerFilter
, KEApSortNameAscending
, 0
, EVpnFilterBoth
, ETrue
);
TInt iapRet = settings->RunSettingsL(0, iSelectedConnectionId);
CleanupStack::PopAndDestroy(settings);
CleanupStack::PopAndDestroy(aDb);
if (iapRet != KApUiEventSelected)
{
// Exit no selection
User::Leave(KErrNotReady);
}
else*/
// open the IAP communications database
CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
CleanupStack::PushL(commDB);
// initialize a view
CCommsDbConnectionPrefTableView* commDBView =
commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);
// go to the first record
User::LeaveIfError(commDBView->GotoFirstRecord());
CCommsDbConnectionPrefTableView::TCommDbIapBearer bearer;
bearer.iBearerSet = iBearerFilter;
// Declare a prefTableView Object.
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
pref.iBearer = bearer;
pref.iDirection = ECommDbConnectionDirectionOutgoing;
// read the connection preferences
commDBView->ReadConnectionPreferenceL(pref);
iSelectedConnectionId = pref.iBearer.iIapId;
// pop and destroy the IAP View
CleanupStack::PopAndDestroy(commDBView);
// pop and destroy the database object
CleanupStack::PopAndDestroy(commDB);
iNewConnection = ETrue;
// IAP Selected
// Open socket server and start the connection
User::LeaveIfError(iServerSocket.Connect(KESockDefaultMessageSlots));
User::LeaveIfError(iConnection.Open(iServerSocket, KConnectionTypeDefault));
// Now we have the iap Id. Use it to connect for the connection
TCommDbConnPref connectPref;
// Setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
// Sets the CommDb ID of the IAP to use for this connection
connectPref.SetIapId(iSelectedConnectionId);
// Sets direction
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
connectPref.SetBearerSet(iBearerFilter);
// Start connection
User::LeaveIfError(iConnection.Start(connectPref));
//TInt retval = iConnection.Start();
//User::LeaveIfError(retval);
// Set the sessions connection info...
RStringPool strPool = iSessionHttp.StringPool();
RHTTPConnectionInfo connInfo = iSessionHttp.ConnectionInfo();
// ...to use our socket server and connection
connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal (iServerSocket.Handle()));
// ...to use our connection
connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))));
iConnectionSetup = ETrue;
return ETrue;
}
示例13: SetupConnectionL
// ----------------------------------------------------------------------------
// CClientEngine::SetupConnectionL()
//
// The method set the internet access point and connection setups.
// ----------------------------------------------------------------------------
void CClientEngine::SetupConnectionL()
{
if( iConnectionSetupDone )
return;
iConnectionSetupDone = ETrue;
//open socket server and start the connection
User::LeaveIfError(iSocketServ.Connect());
User::LeaveIfError(iConnection.Open(iSocketServ));
TCommDbConnPref connectPref;
TUint32 iapID;
if(iSetIap == EFalse)
{
// open the IAP communications database
CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP);
CleanupStack::PushL(commDB);
// initialize a view
CCommsDbConnectionPrefTableView* commDBView =
commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown);
// go to the first record
User::LeaveIfError(commDBView->GotoFirstRecord());
// Declare a prefTableView Object.
CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;
// read the connection preferences
commDBView->ReadConnectionPreferenceL(pref);
iapID = pref.iBearer.iIapId;
// pop and destroy the IAP View
CleanupStack::PopAndDestroy(commDBView);
// pop and destroy the database object
CleanupStack::PopAndDestroy(commDB);
// setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
connectPref.SetBearerSet(ECommDbBearerGPRS);
//Sets the CommDb ID of the IAP to use for this connection
connectPref.SetIapId(iapID);
}else{
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
connectPref.SetDirection(ECommDbConnectionDirectionUnknown);
connectPref.SetBearerSet(ECommDbBearerGPRS);
//Sets the CommDb ID of the IAP to use for this connection
connectPref.SetIapId(iIapId);
}
User::LeaveIfError(iConnection.Start(connectPref));
//set the sessions connection info
RStringPool strPool = iSession.StringPool();
RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
//to use our socket server and connection
connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );
connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
RHTTPSession::GetTable() ),
THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))) );
}
示例14: startConnection
const int FConnection::startConnection(const StringBuffer& aIAPName)
{
LOG.info("Starting new connection...");
LOG.debug("Looking for '%s' IAP name", aIAPName.c_str());
iLastError = KErrNone;
StringBuffer errMsg;
TCommDbConnPref prefs;
prefs.SetDirection(ECommDbConnectionDirectionUnknown);
if (aIAPName == "Default") {
//
// Use the default IAP without prompting the user
//
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetIapId(0);
}
else if (aIAPName.empty() || aIAPName == "Ask") {
//
// Prompt user for IAP selection
//
}
else {
//
// Search for the desired IAP. If not found, will prompt the user.
//
TInt iapID = GetIAPIDFromName(aIAPName);
if (iapID >= 0) {
LOG.debug("SetDialogPreference");
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
prefs.SetIapId(iapID);
}
else {
LOG.debug("IAP '%s' not found!", aIAPName.c_str());
}
}
/*
* **** TODO: check if we need this! ****
In S60 3rd Edition, enabling/disabling the inactivity timer will require
the NetworkControl capability, which is only accessed via Symbian
partner.
*/
//#if !defined(__SERIES60_3X__) || defined(__S60_3X_NET_CTRL__)
// // Disable inactivity timer, otherwise inactive connection is closed
// // within few seconds if there are no activity (e.g sockets)
// iConnection.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
//#endif
// Opens the connection
openConnection();
// Start connection
iLastError = iConnection.Start(prefs);
if (iLastError != KErrNone) {
errMsg.sprintf("FConnection error: unable to start connection (code %d)", iLastError);
LOG.debug("Goto retry");
goto retry;
}
// Save the IAP ID & name of the active connection.
// Query the CommDb database for the IAP ID in use.
_LIT(KIAPSettingName, "IAP\\Id");
iConnection.GetIntSetting(KIAPSettingName, iIAP);
iIAPName = GetIAPNameFromID(iIAP);
LOG.debug("Current active IAP ID = %d, name = '%s'", iIAP, iIAPName.c_str());
//
// TODO: should we persist the iIAPName in the config, here?
//
iRetryConnection = 0;
return 0;
retry:
LOG.error("%s", errMsg.c_str());
if (iIAPName.empty() || iIAPName == "Ask") {
LOG.debug("Connection error and no IAP stored: don't retry");
return iLastError;
}
LOG.debug("About to retry...");
if (iRetryConnection < MAX_RETRY_CONNECTION) {
iRetryConnection ++;
LOG.info("Retry connection (%d time)...", iRetryConnection);
startConnection(iIAPName);
}
else {
LOG.error("FConnection: %d connection failed", iRetryConnection);
}
return iLastError;
}
示例15: SetupConnection
TBool CConnectionManager::SetupConnection()
{
TInt iCurrentProfileId;
iBearerFilter = EApBearerTypeAllBearers;
ASSERT(iRepository);
// Check whether we are offline or online
iRepository->Get(KProEngActiveProfile, iCurrentProfileId);
// Close the connection only if
// a) this is not the first time and
// b) the profile has changed and
// c) either the previous or the current profile is Offline (5 = Offline)
if (iPreviousProfileId != -1 && iPreviousProfileId != iCurrentProfileId &&
(iPreviousProfileId == EConnectionStatus::Disconnected || iCurrentProfileId == EConnectionStatus::Disconnected))
{
// Close and uninitialize
iConnectionSetup = EFalse;
iSessionHttp .Close();
iConnection .Close();
iServerSocket.Close();
}
// Save current profile id
iPreviousProfileId = iCurrentProfileId;
// Try to find an existing connection. If connection has not been set up,
// iConnection is not initialized and FindExistingConnection() fails.
// Thus, in that case, finding must not be carried out.
if (iConnectionSetup && !FindExistingConnection())
{
iConnectionSetup = EFalse;
}
if (iConnectionSetup)
{
// Connection setup is done
iNewConnection = EFalse;
return ETrue;
}
// Open RHTTPSession with default protocol ("HTTP/TCP")
iSessionHttp.OpenL();
// Install this class as the callback for authentication requests. When
// page requires authentication the framework calls GetCredentialsL to get
// user name and password.
InstallAuthenticationL(iSessionHttp);
// In offline, only WLAN connections are available
if (iCurrentProfileId == EConnectionStatus::Disconnected)
{
iBearerFilter = EApBearerTypeWLAN;
}
// Show IAP selection dialog
if ( gSelectedConnectionId == -1 )
gSelectedConnectionId = SelectIAP();
iSelectedConnectionId = gSelectedConnectionId;
iNewConnection = ETrue;
// IAP Selected
// Open socket server and start the connection
User::LeaveIfError(iServerSocket.Connect(KESockDefaultMessageSlots));
User::LeaveIfError(iConnection.Open(iServerSocket, KConnectionTypeDefault));
// Now we have the iap Id. Use it to connect for the connection
TCommDbConnPref connectPref;
// Setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
// Sets the CommDb ID of the IAP to use for this connection
connectPref.SetIapId(iSelectedConnectionId);
// Sets direction
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
connectPref.SetBearerSet(iBearerFilter);
// Start connection
User::LeaveIfError(iConnection.Start(connectPref));
//TInt retval = iConnection.Start();
//User::LeaveIfError(retval);
// Set the sessions connection info...
RStringPool strPool = iSessionHttp.StringPool();
RHTTPConnectionInfo connInfo = iSessionHttp.ConnectionInfo();
// ...to use our socket server and connection
connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal (iServerSocket.Handle()));
// ...to use our connection
connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))));
iConnectionSetup = ETrue;
return ETrue;
}