Application-level roaming (ALR) enables your application to roam to use the best available data connection while operational.
class CALRApplication : public CActive, public MMobilityProtocolResp { ... public: // From MMobilityProtocolResp void PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo, TAccessPointInfo aNewAPInfo, TBool aIsUpgrade, TBool aIsSeamless ); void NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless ); void Error( TInt aError ); private: // Data RConnection iConnection; CActiveCommsMobilityApiExt* iMobility; }; // When the connection starts, iMobility is created and it registers the connection to receive mobility messages. iMobility = CActiveCommsMobilityApiExt::NewL( iConnection, *this );When apreferred access point becomes available, the implementation of CALRApplication::PreferredCarrierAvailable is called. MigrateToPreferredCarrier Mobility message is sent to the middleware in order to roam to this preferred access point. void CALRApplication::PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo,TAccessPointInfo aNewAPInfo,TBool aIsUpgrade,TBool aIsSeamless ){ // aOldAPInfo contains the current IAP used by the connection. // aNewAPInfo contains the newly available IAP that can be used by the connection. if ( aIsSeamless ) { // It is Seamless. E.g. Mobile IP enabled. } else { // sockets used by the connection should be closed here. // We ask to migrate to the Preferred Carrier. iMobility->MigrateToPreferredCarrier(); } } Once the connection roamed to the new access point, the implementation ofCALRApplication::NewCarrierActive is called. The application reopens its sockets on the connection. If the socket connection is fine, the application sends the NewCarrierAccepted Mobility message to the middleware. void CALRApplication::NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless ) { // aNewAPInfo contains the newly started IAP used now by the connection. if ( aIsSeamless ) { // It is Seamless. E.g. Mobile IP enabled. } else { // sockets used by the connection should be reopened here. // We accept the new IAP. iMobility->NewCarrierAccepted(); } }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.