Telephony data connection. Management -- dataconnection

Source: Internet
Author: User
Dataconnectiontracker

Dataconnectiontracker: Controls mobile phone APN loading and data connection;

Including: when the connection is disconnected at startup, the radio status changes, the APN changes, and the voice and data services are switched,

Connection failure and automatic reconnection, when roaming is enabled and disabled ...... Data Connection processing in these cases;

There are some differences in processing data connections between CDMA and GSM network communication technologies. The basic process is the same. Let's take a look at the working process of CDMA dataconnectiontracker;

2. APN Loading 1 APN Concept

The Access Point name (APN) is the Access Point name used to identify the service type of GPRS. Currently, it is divided into two categories: cmwap (accessing WAP services through GPRS ),

Cmnet (Other services except WAP currently use cmnet, such as connecting to the Internet ). It is a parameter that must be configured when accessing the Internet through a mobile phone. It determines the access method through which your mobile phone accesses the network.

Business ProcessGPRSThe process for a private network system terminal to log on to the server platform over the Internet is as follows:

1) The user sends a GPRS login request, including the private network APN specially allocated for the GPRS private network system by the mobile company;

2) based on the APN in the request, the sgsn sends a query request to the DNS server, finds the ggsn connected to the Enterprise Server Platform, and encapsulates the user request to the ggsn through the Gbps tunnel;

3) ggsn sends user authentication information (including mobile phone numbers, user accounts, and passwords) to radius through a leased line for authentication;

4) when the RADIUS Authentication Server displays authentication information such as the mobile phone number, it confirms that the request is sent by a valid user and assigns the user address to the DHCP server;

5) after the RADIUS Authentication is passed, the radius sends a confirmation message containing the user address to the ggsn;

6) if you get an IP address, you can carry data packets to access the information query and service processing platform of the GPRS private network system.

2 APN Creation

The CDMA dataconnectiontracker object is loaded and the system provides the APN when it is created. In CDMA, a special kind of CDMA dataprofiletracker is used to manage the APN.

 
CDMA dataconnectiontracker (cdmaphone p ){Super(P); mdpt=NewCDMA dataprofiletracker (p); mdpt. registerformodemprofileready (This, Event_modem_data_profile_ready,Null); Createalldataconnectionlist ();}

 

CDMA dataprofiletracker:

 Public   Void  Handlemessage (Message MSG ){  Switch  (Msg. What ){  Case  Event_load_profiles:  //  Load from local database  Loadprofiles ();  Break  ;  Case Event_read_modem_profiles: onreaddataprofilesfrommodem ();  Break  ;  Case  Event_get_data_call_profile_done:  //  When the APN is loaded, a notification is sent. Ongetdatacallprofiledone (asyncresult) msg. OBJ ,( Int  ) Msg. arg1 );  Break  ;}} 

 

 

For details about the loading process, go to the function. For more information about how to generate and view the APN, see this article.Article:

Http://myqdroid.blog.51cto.com/2057579/389134

 

2. Data Connection Process 1. Start data connection

All data connections send message calls:

Protected Boolean ontrysetupdata (string reason ){

Return trysetupdata (reason );

}

Determine whether the current condition can be met and connect to the data:

Private   Boolean  Trysetupdata (string reason ){  //  WiFi has been connected already, ignore default type data call setup.      If (Featurequery. feature_ct_fmc_support & miswificonnected = True && Mrequestedapntype. Equals (phone. apn_type_default) {setstate (State. idle );  If  (Dataenabled [apn_default_id]) {dataenabled [apn_default_id] = False ; Enabledcount -- ;}  Return   False  ;}  //  Enable data connection if conditions are met      If (Mstate = state. Idle | mstate = state. Scanning )&& Isdataallowed () & Getanydataenabled ()&&! Isemergency ()){  Boolean Retvalue =Setupdata (reason); notifyoffapnsofavailability (reason );  Return  Retvalue ;}} 

 

 

Start the data connection:

 Private   Boolean  Setupdata (string reason) {CDMA dataconnection Conn = Findfreedataconnection (); mpendingdataconnection = Conn; mactiveapn = Mdpt. getdataprofile (mrequestedapntype ); //  Callback message for connection completion Message MSG = Obtainmessage (); MSG. What = Event_data_setup_complete; msg. OBJ = Reason; Conn. bringup (MSG, mactiveapn); setstate (State. initing); notifydataconnection (reason );  Return   True  ;} 

 

2. Data Connection Process

The data connection is completed through the dataconnection class. Let's take a look at the dataconnection class structure:

The structure of the related classes shows that:Dataconnection is a state machine that uses the state mode, so that the process is clear;

When the internal status of an object changes during the data connection process, the status is switched and different behaviors are executed.

Start the data connection interface:

 
Public VoidBringup (Message oncompletedmsg, dataprofile APN) {sendmessage (obtainmessage (event_connect,NewConnectionparams (APN, oncompletedmsg )));}

Here, the message is sent to the initialization status for processing:Dcinactivestate

 
CaseEvent_connect: onconnect (CP); transitionto (mactivatingstate );Break;

 

It will be called to connect in the CDMA dataconnection:

Protected VoidOnconnect (connectionparams CP) {mapn=CP. APN; message msg=Obtainmessage (Event_setup_data_connection_done, CP); msg. OBJ=CP;
//Start data connection through RILPhone. MCM. setupdatacall (integer. tostring (getrilradiotechnology (rilconstants. setup_data_tech_cdma), integer. tostring (dataprofile), mapn. APN, mapn. user, mapn. password, integer. tostring (mapn. authtype), mapn. protocol, MSG );}

 

 

 

After the connection is complete, the event_data_setup_complete callback message will be sent to dataconnectiontracker:

 
CaseEvent_data_setup_complete: mcidactive=MSG. arg1; ondatasetupcomplete (asyncresult) msg. OBJ );Break;

Connection completed:

Protected VoidOndatasetupcomplete (asyncresult AR ){If(Isdatasetupcompleteok (AR) {dataprofilecdma mcurrentapn=(Dataprofilecdma) mactiveapn; yydefaultdata (reason );}Else{Startdelayedretry (cause, reason, retryoverride );}}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.