Fields Summary |
---|
private static final boolean | DBG |
private static final String | TAG |
public static final int | RTT_TYPE_UNSPECIFIED |
public static final int | RTT_TYPE_ONE_SIDED |
public static final int | RTT_TYPE_11_V |
public static final int | RTT_TYPE_11_MC |
public static final int | RTT_PEER_TYPE_UNSPECIFIED |
public static final int | RTT_PEER_TYPE_AP |
public static final int | RTT_PEER_TYPE_STA |
public static final int | RTT_CHANNEL_WIDTH_20 |
public static final int | RTT_CHANNEL_WIDTH_40 |
public static final int | RTT_CHANNEL_WIDTH_80 |
public static final int | RTT_CHANNEL_WIDTH_160 |
public static final int | RTT_CHANNEL_WIDTH_80P80 |
public static final int | RTT_CHANNEL_WIDTH_5 |
public static final int | RTT_CHANNEL_WIDTH_10 |
public static final int | RTT_CHANNEL_WIDTH_UNSPECIFIED |
public static final int | RTT_STATUS_SUCCESS |
public static final int | RTT_STATUS_FAILURE |
public static final int | RTT_STATUS_FAIL_NO_RSP |
public static final int | RTT_STATUS_FAIL_REJECTED |
public static final int | RTT_STATUS_FAIL_NOT_SCHEDULED_YET |
public static final int | RTT_STATUS_FAIL_TM_TIMEOUT |
public static final int | RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL |
public static final int | RTT_STATUS_FAIL_NO_CAPABILITY |
public static final int | RTT_STATUS_ABORTED |
public static final int | REASON_UNSPECIFIED |
public static final int | REASON_NOT_AVAILABLE |
public static final int | REASON_INVALID_LISTENER |
public static final int | REASON_INVALID_REQUEST |
public static final String | DESCRIPTION_KEY |
public static final int | BASE |
public static final int | CMD_OP_START_RANGING |
public static final int | CMD_OP_STOP_RANGING |
public static final int | CMD_OP_FAILED |
public static final int | CMD_OP_SUCCEEDED |
public static final int | CMD_OP_ABORTED |
private android.content.Context | mContext |
private IRttManager | mService |
private static final int | INVALID_KEY |
private static int | sListenerKey |
private static final android.util.SparseArray | sListenerMap |
private static final Object | sListenerMapLock |
private static com.android.internal.util.AsyncChannel | sAsyncChannel |
private static CountDownLatch | sConnected |
private static final Object | sThreadRefLock |
private static int | sThreadRefCount |
private static android.os.HandlerThread | sHandlerThread |
Methods Summary |
---|
public android.net.wifi.RttManager$Capabilities | getCapabilities()
return new Capabilities();
|
private static java.lang.Object | getListener(int key)
if (key == INVALID_KEY) return null;
synchronized (sListenerMapLock) {
Object listener = sListenerMap.get(key);
return listener;
}
|
private static int | getListenerKey(java.lang.Object listener)
if (listener == null) return INVALID_KEY;
synchronized (sListenerMapLock) {
int index = sListenerMap.indexOfValue(listener);
if (index == -1) {
return INVALID_KEY;
} else {
return sListenerMap.keyAt(index);
}
}
|
private void | init()
synchronized (sThreadRefLock) {
if (++sThreadRefCount == 1) {
Messenger messenger = null;
try {
Log.d(TAG, "Get the messenger from " + mService);
messenger = mService.getMessenger();
} catch (RemoteException e) {
/* do nothing */
} catch (SecurityException e) {
/* do nothing */
}
if (messenger == null) {
sAsyncChannel = null;
return;
}
sHandlerThread = new HandlerThread("WifiScanner");
sAsyncChannel = new AsyncChannel();
sConnected = new CountDownLatch(1);
sHandlerThread.start();
Handler handler = new ServiceHandler(sHandlerThread.getLooper());
sAsyncChannel.connect(mContext, handler, messenger);
try {
sConnected.await();
} catch (InterruptedException e) {
Log.e(TAG, "interrupted wait at init");
}
}
}
|
private static int | putListener(java.lang.Object listener)
if (listener == null) return INVALID_KEY;
int key;
synchronized (sListenerMapLock) {
do {
key = sListenerKey++;
} while (key == INVALID_KEY);
sListenerMap.put(key, listener);
}
return key;
|
private static java.lang.Object | removeListener(int key)
if (key == INVALID_KEY) return null;
synchronized (sListenerMapLock) {
Object listener = sListenerMap.get(key);
sListenerMap.remove(key);
return listener;
}
|
private static int | removeListener(java.lang.Object listener)
int key = getListenerKey(listener);
if (key == INVALID_KEY) return key;
synchronized (sListenerMapLock) {
sListenerMap.remove(key);
return key;
}
|
public void | startRanging(android.net.wifi.RttManager$RttParams[] params, android.net.wifi.RttManager$RttListener listener)
validateChannel();
ParcelableRttParams parcelableParams = new ParcelableRttParams(params);
sAsyncChannel.sendMessage(CMD_OP_START_RANGING,
0, putListener(listener), parcelableParams);
|
public void | stopRanging(android.net.wifi.RttManager$RttListener listener)
validateChannel();
sAsyncChannel.sendMessage(CMD_OP_STOP_RANGING, 0, removeListener(listener));
|
private void | validateChannel()
if (sAsyncChannel == null) throw new IllegalStateException(
"No permission to access and change wifi or a bad initialization");
|