java.lang.Object | |
↳ | com.kddi.android.internal.telephony.cdma.KddiPacketSMSManager |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
KddiPacketSMSManager.AddressAlreadyInUseException | Solution 1 Start ** protected boolean kddiConnectSocket() { if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "kddiConnectSocket Start"); } try { mLocalPort++; if (mLocalPort < 5000 || mLocalPort > 6999) { mLocalPort = 5000; } Log.d(KDDI_TAG, "local port: " + mLocalPort); mSocket = new Socket(mKddiChatGateWayIP, KDDI_CHGW_PORT, null, mLocalPort); mErrorCount = 0; // reset error count mIn = mSocket.getInputStream(); mOut = mSocket.getOutputStream(); // Create result receive thread mRetReceiver = new KddiResultReceiver(); mRetRevThread = new Thread(mRetReceiver, "KddiResultReceiver"); } // +[hTC]Kelvin, change source port if the port is using catch (java.net.BindException ex) { //ex.printStackTrace(); String es = ex.getMessage(); if (KDDI_OUTPUT_DEBUG_LOG) { Log.d(KDDI_TAG, "bindexception: " + es); } if (es.startsWith("Address already in use")) { if (KDDI_OUTPUT_DEBUG_LOG) { Log.d(KDDI_TAG, "change source port"); } mErrorCount++; if (mErrorCount > 50) { Log.d(KDDI_TAG, "error count limit!" + mErrorCount); mErrorCount = 0; return false; } else { return kddiConnectSocket(); } } else { ex.printStackTrace(); return false; } } // -[hTC]Kelvin, change source port if the port is using catch(UnknownHostException e) { e.printStackTrace(); if(KDDI_OUTPUT_DEBUG_LOG) { Log.d( KDDI_TAG, e.toString()); } return false; } catch(IOException e) { e.printStackTrace(); if(KDDI_OUTPUT_DEBUG_LOG) { Log.d( KDDI_TAG, e.toString()); } return false; } if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "kddiConnectSocket End"); } return true; } /** Solution1 End | ||||||||||
KddiPacketSMSManager.KddiBgHandler |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long | HTC_RETRY_INTERVAL_TIMER | ||||||||||
int | HTC_RETRY_MAX_TIMES | ||||||||||
int | KDDI_EVENT_CLOSE_SESSION | ||||||||||
int | KDDI_EVENT_CLOSE_SOCKET | ||||||||||
int | KDDI_EVENT_DATA_STATE_CHANGED | ||||||||||
int | KDDI_EVENT_MULTIPLE_SEND_ERROR | ||||||||||
int | KDDI_EVENT_PACKETSMSMGR_SYS_ERROR | ||||||||||
int | KDDI_EVENT_REQ_CONNECT | ||||||||||
int | KDDI_EVENT_REQ_SEND_MSG | ||||||||||
int | KDDI_EVENT_SEND | ||||||||||
int | KDDI_EVENT_SEND_CANCEL | ||||||||||
int | KDDI_SEND_SMS | ||||||||||
int | KDDI_SEND_SMS_IN_QUEUE | ||||||||||
long | SEND_DELAY_MILIIS |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get instance of KddiPacketSMSManager
Return instance of KddiPacketSMSManager.
| |||||||||||
Message send cancel
The send cancellation is done when context in the request origin and
context under processing agree.
| |||||||||||
remove original KDDI's codes **
public void kddiSendSmsMessage(Context context, String destAddr, String message,
PendingIntent sentIntent, int sendingMode) {
//** +[hTC]Kelvin, handle multiple send request
| |||||||||||
Send PacketSMS message
PacketSMS message send request is received,
and message send request is done.
| |||||||||||
Look up a host name and return the result as an int.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Check radio state
The state of the radio is checked.
| |||||||||||
remove original codes **
int ipAddress = NetworkUtils.lookupHost(mKddiChatGateWayIP);
return mConnectivityManager.requestRouteToHost
(mConnectivityManager.TYPE_MOBILE, ipAddress);
}
/** -[hTC]Kelvin110329, remove End
| |||||||||||
remove original codes **
return 0;
}
/** -[hTC]Kelvin110329, remove original codes End
| |||||||||||
remove original codes **
return 0;
}
/** -[hTC]Kelvin110329, remove original codes End
| |||||||||||
Check on calling state
Call state is acquired, and on calling or idle is returned.
| |||||||||||
Release
The following processing is executed as release processing.
| |||||||||||
remove original codes **
if(KDDI_OUTPUT_VERBOSE_LOG) {
Log.v(KDDI_TAG, "kddiSetIntentFilter End");
}
}
if(null == mDataConnectIntentfilter) {
if(KDDI_OUTPUT_VERBOSE_LOG) {
Log.v(KDDI_TAG, "setIntentFilter Start for data state change");
}
mDataConnectIntentfilter = new IntentFilter();
// Set action
mDataConnectIntentfilter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
// registration of receiver
Intent intent = mContext.registerReceiver(mPsmsSender.mDataConnectIntentRev, mDataConnectIntentfilter);
if(KDDI_OUTPUT_VERBOSE_LOG) {
Log.v(KDDI_TAG, "DataConnectIntent Register return Intent["+ intent +"]");
}
if(KDDI_OUTPUT_VERBOSE_LOG) {
Log.v(KDDI_TAG, "setIntentFilter End for data state change");
}
}
return;
}
/** remove original codes End
| |||||||||||
Message writing request for socket
convert into the IRC format.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Get instance of KddiPacketSMSManager Return instance of KddiPacketSMSManager.
Message send cancel The send cancellation is done when context in the request origin and context under processing agree.
sentIntent | Cancel result notification intent |
---|
remove original KDDI's codes ** public void kddiSendSmsMessage(Context context, String destAddr, String message, PendingIntent sentIntent, int sendingMode) { //** +[hTC]Kelvin, handle multiple send request
Send PacketSMS message PacketSMS message send request is received, and message send request is done.
context | Context |
---|---|
destAddr | Destination address |
message | Message body |
sentIntent | Result notification intent |
sendingMode | Send mode identifier(transaction/store) |
Look up a host name and return the result as an int. Works if the argument is an IP address in dot notation. Obviously, this can only be used for IPv4 addresses.
hostname | the name of the host (or the IP address) |
---|
int
in network byte order
Check radio state The state of the radio is checked.
context | Context |
---|
remove original codes ** int ipAddress = NetworkUtils.lookupHost(mKddiChatGateWayIP); return mConnectivityManager.requestRouteToHost (mConnectivityManager.TYPE_MOBILE, ipAddress); } /** -[hTC]Kelvin110329, remove End
remove original codes ** return 0; } /** -[hTC]Kelvin110329, remove original codes End
remove original codes ** return 0; } /** -[hTC]Kelvin110329, remove original codes End
Check on calling state Call state is acquired, and on calling or idle is returned.
Release The following processing is executed as release processing. - Deletion of registered message event - Release socket - Disconnect session - Network connectivity state listener stop - Send result is notified to the application - Change send state - result receive thread stop
remove original codes ** if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "kddiSetIntentFilter End"); } } if(null == mDataConnectIntentfilter) { if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "setIntentFilter Start for data state change"); } mDataConnectIntentfilter = new IntentFilter(); // Set action mDataConnectIntentfilter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED); // registration of receiver Intent intent = mContext.registerReceiver(mPsmsSender.mDataConnectIntentRev, mDataConnectIntentfilter); if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "DataConnectIntent Register return Intent["+ intent +"]"); } if(KDDI_OUTPUT_VERBOSE_LOG) { Log.v(KDDI_TAG, "setIntentFilter End for data state change"); } } return; } /** remove original codes End
Message writing request for socket convert into the IRC format. converted message is written in the socket and send request is done to the CHAT server.