[NAN] Provide inteface MAC address to app.

Expose NAN discovery interface MAC address to app. Required
to enable OOB discovery with other NAN functionality
(e.g. data-path).

Bug: 30000035
Change-Id: Id3c336a61a36522d7011557c805bc3c5307747a1
This commit is contained in:
Etan Cohen
2016-07-07 15:07:38 -07:00
parent c13b9f6b7d
commit d097f8a4e5
3 changed files with 13 additions and 10 deletions

View File

@@ -28,7 +28,7 @@ oneway interface IWifiNanEventCallback
{
void onConnectSuccess();
void onConnectFail(int reason);
void onIdentityChanged();
void onIdentityChanged(in byte[] mac);
void onRangingSuccess(int rangingId, in RttManager.ParcelableRttResults results);
void onRangingFailure(int rangingId, int reason, in String description);

View File

@@ -62,7 +62,7 @@ public class WifiNanEventCallback {
* Called when NAN connect operation
* {@link WifiNanManager#connect(android.os.Looper, WifiNanEventCallback)}
* is completed. Doesn't necessarily mean that have joined or started a NAN
* cluster. An indication is provided by {@link #onIdentityChanged()}.
* cluster. An indication is provided by {@link #onIdentityChanged(byte[])}.
*/
public void onConnectSuccess() {
/* empty */
@@ -81,12 +81,14 @@ public class WifiNanEventCallback {
}
/**
* Called when NAN identity has changed. This may be due to joining a
* cluster, starting a cluster, or discovery interface change. The
* implication is that peers you've been communicating with may no longer
* recognize you and you need to re-establish your identity.
* Called when NAN identity has changed and after {@link #onConnectSuccess()}. Call may be
* due to joining a cluster, starting a cluster, or discovery interface change. The
* implication is that peers you've been communicating with may no longer recognize you and
* you need to re-establish your identity.
* @param mac The MAC address of the NAN discovery interface. Depending on the permission
* model may be all 0's.
*/
public void onIdentityChanged() {
public void onIdentityChanged(byte[] mac) {
/* empty */
}
}

View File

@@ -819,7 +819,7 @@ public class WifiNanManager {
originalCallback.onConnectFail(msg.arg1);
break;
case CALLBACK_IDENTITY_CHANGED:
originalCallback.onIdentityChanged();
originalCallback.onIdentityChanged((byte[]) msg.obj);
break;
case CALLBACK_RANGING_SUCCESS: {
RttManager.RttListener listener = getAndRemoveRangingListener(msg.arg1);
@@ -875,10 +875,11 @@ public class WifiNanManager {
}
@Override
public void onIdentityChanged() {
if (VDBG) Log.v(TAG, "onIdentityChanged");
public void onIdentityChanged(byte[] mac) {
if (VDBG) Log.v(TAG, "onIdentityChanged: mac=" + new String(HexEncoding.encode(mac)));
Message msg = mHandler.obtainMessage(CALLBACK_IDENTITY_CHANGED);
msg.obj = mac;
mHandler.sendMessage(msg);
}