Methods Summary |
---|
public static com.android.internal.telephony.TelephonyDevController | create()
synchronized (mLock) {
if (sTelephonyDevController != null) {
throw new RuntimeException("TelephonyDevController already created!?!");
}
sTelephonyDevController = new TelephonyDevController();
return sTelephonyDevController;
}
|
public java.util.ArrayList | getAllModems()get all modem's registered.
synchronized (mLock) {
ArrayList<HardwareConfig> modems = new ArrayList<HardwareConfig>();
if (mModems.isEmpty()) {
if (DBG) logd("getAllModems: empty list.");
} else {
for (HardwareConfig modem: mModems) {
modems.add(modem);
}
}
return modems;
}
|
public java.util.ArrayList | getAllSims()get all sim's registered.
synchronized (mLock) {
ArrayList<HardwareConfig> sims = new ArrayList<HardwareConfig>();
if (mSims.isEmpty()) {
if (DBG) logd("getAllSims: empty list.");
} else {
for (HardwareConfig sim: mSims) {
sims.add(sim);
}
}
return sims;
}
|
public java.util.ArrayList | getAllSimsForModem(int modemIndex)get all sim's associated with modem at index 'modemIndex'.
synchronized (mLock) {
if (mSims.isEmpty()) {
loge("getAllSimsForModem: no registered sim device?!?");
return null;
}
if (modemIndex > getModemCount()) {
loge("getAllSimsForModem: out-of-bounds access for modem device " + modemIndex + " max: " + getModemCount());
return null;
}
if (DBG) logd("getAllSimsForModem " + modemIndex);
ArrayList<HardwareConfig> result = new ArrayList<HardwareConfig>();
HardwareConfig modem = getModem(modemIndex);
for (HardwareConfig sim: mSims) {
if (sim.modemUuid.equals(modem.uuid)) {
result.add(sim);
}
}
return result;
}
|
public static com.android.internal.telephony.TelephonyDevController | getInstance()
synchronized (mLock) {
if (sTelephonyDevController == null) {
throw new RuntimeException("TelephonyDevController not yet created!?!");
}
return sTelephonyDevController;
}
|
public HardwareConfig | getModem(int index)get modem at index 'index'.
synchronized (mLock) {
if (mModems.isEmpty()) {
loge("getModem: no registered modem device?!?");
return null;
}
if (index > getModemCount()) {
loge("getModem: out-of-bounds access for modem device " + index + " max: " + getModemCount());
return null;
}
if (DBG) logd("getModem: " + index);
return mModems.get(index);
}
|
public static int | getModemCount()get total number of registered modem.
synchronized (mLock) {
int count = mModems.size();
if (DBG) logd("getModemCount: " + count);
return count;
}
|
public HardwareConfig | getModemForSim(int simIndex)get modem associated with sim index 'simIndex'.
synchronized (mLock) {
if (mModems.isEmpty() || mSims.isEmpty()) {
loge("getModemForSim: no registered modem/sim device?!?");
return null;
}
if (simIndex > getSimCount()) {
loge("getModemForSim: out-of-bounds access for sim device " + simIndex + " max: " + getSimCount());
return null;
}
if (DBG) logd("getModemForSim " + simIndex);
HardwareConfig sim = getSim(simIndex);
for (HardwareConfig modem: mModems) {
if (modem.uuid.equals(sim.modemUuid)) {
return modem;
}
}
return null;
}
|
public HardwareConfig | getSim(int index)get sim at index 'index'.
synchronized (mLock) {
if (mSims.isEmpty()) {
loge("getSim: no registered sim device?!?");
return null;
}
if (index > getSimCount()) {
loge("getSim: out-of-bounds access for sim device " + index + " max: " + getSimCount());
return null;
}
if (DBG) logd("getSim: " + index);
return mSims.get(index);
}
|
public int | getSimCount()get total number of registered sims.
synchronized (mLock) {
int count = mSims.size();
if (DBG) logd("getSimCount: " + count);
return count;
}
|
private static void | handleGetHardwareConfigChanged(android.os.AsyncResult ar)hardware configuration changed.
if ((ar.exception == null) && (ar.result != null)) {
List hwcfg = (List)ar.result;
for (int i = 0 ; i < hwcfg.size() ; i++) {
HardwareConfig hw = null;
hw = (HardwareConfig) hwcfg.get(i);
if (hw != null) {
if (hw.type == HardwareConfig.DEV_HARDWARE_TYPE_MODEM) {
updateOrInsert(hw, mModems);
} else if (hw.type == HardwareConfig.DEV_HARDWARE_TYPE_SIM) {
updateOrInsert(hw, mSims);
}
}
}
} else {
/* error detected, ignore. are we missing some real time configutation
* at this point? what to do...
*/
loge("handleGetHardwareConfigChanged - returned an error.");
}
|
public void | handleMessage(android.os.Message msg)handle callbacks from RIL.
AsyncResult ar;
switch (msg.what) {
case EVENT_HARDWARE_CONFIG_CHANGED:
if (DBG) logd("handleMessage: received EVENT_HARDWARE_CONFIG_CHANGED");
ar = (AsyncResult) msg.obj;
handleGetHardwareConfigChanged(ar);
break;
default:
loge("handleMessage: Unknown Event " + msg.what);
}
|
private void | initFromResource()
Resources resource = Resources.getSystem();
String[] hwStrings = resource.getStringArray(
com.android.internal.R.array.config_telephonyHardware);
if (hwStrings != null) {
for (String hwString : hwStrings) {
HardwareConfig hw = new HardwareConfig(hwString);
if (hw != null) {
if (hw.type == HardwareConfig.DEV_HARDWARE_TYPE_MODEM) {
updateOrInsert(hw, mModems);
} else if (hw.type == HardwareConfig.DEV_HARDWARE_TYPE_SIM) {
updateOrInsert(hw, mSims);
}
}
}
}
|
private static void | logd(java.lang.String s)
Rlog.d(LOG_TAG, s);
|
private static void | loge(java.lang.String s)
Rlog.e(LOG_TAG, s);
|
public static void | registerRIL(CommandsInterface cmdsIf)each RIL call this interface to register/unregister the unsolicited hardware
configuration callback data it can provide.
/* get the current configuration from this ril... */
cmdsIf.getHardwareConfig(sRilHardwareConfig);
/* ... process it ... */
if (sRilHardwareConfig != null) {
AsyncResult ar = (AsyncResult) sRilHardwareConfig.obj;
if (ar.exception == null) {
handleGetHardwareConfigChanged(ar);
}
}
/* and register for async device configuration change. */
cmdsIf.registerForHardwareConfigChanged(sTelephonyDevController, EVENT_HARDWARE_CONFIG_CHANGED, null);
|
public static void | unregisterRIL(CommandsInterface cmdsIf)
cmdsIf.unregisterForHardwareConfigChanged(sTelephonyDevController);
|
private static void | updateOrInsert(HardwareConfig hw, java.util.ArrayList list)hardware configuration update or insert.
int size;
HardwareConfig item;
synchronized (mLock) {
size = list.size();
for (int i = 0 ; i < size ; i++) {
item = list.get(i);
if (item.uuid.compareTo(hw.uuid) == 0) {
if (DBG) logd("updateOrInsert: removing: " + item);
list.remove(i);
}
}
if (DBG) logd("updateOrInsert: inserting: " + hw);
list.add(hw);
}
|