Merge "P2P: update WifiP2pServiceResponse creator" into oc-dev
This commit is contained in:
@@ -186,31 +186,23 @@ public class WifiP2pServiceResponse implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Create the list of WifiP2pServiceResponse instance from supplicant event.
|
* Create the list of WifiP2pServiceResponse instance from supplicant event.
|
||||||
*
|
*
|
||||||
* <pre>The format is as follows.
|
* @param srcAddr source address of the service response
|
||||||
* P2P-SERV-DISC-RESP <address> <update indicator> <response data>
|
* @param tlvsBin byte array containing the binary tlvs data
|
||||||
* e.g) P2P-SERV-DISC-RESP 02:03:7f:11:62:da 1 0300000101
|
|
||||||
*
|
|
||||||
* @param supplicantEvent wpa_supplicant event string.
|
|
||||||
* @return if parse failed, return null
|
* @return if parse failed, return null
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static List<WifiP2pServiceResponse> newInstance(String supplicantEvent) {
|
public static List<WifiP2pServiceResponse> newInstance(String srcAddr, byte[] tlvsBin) {
|
||||||
|
//updateIndicator not used, and not passed up from supplicant
|
||||||
|
|
||||||
List<WifiP2pServiceResponse> respList = new ArrayList<WifiP2pServiceResponse>();
|
List<WifiP2pServiceResponse> respList = new ArrayList<WifiP2pServiceResponse>();
|
||||||
String[] args = supplicantEvent.split(" ");
|
|
||||||
if (args.length != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
WifiP2pDevice dev = new WifiP2pDevice();
|
WifiP2pDevice dev = new WifiP2pDevice();
|
||||||
String srcAddr = args[1];
|
|
||||||
dev.deviceAddress = srcAddr;
|
dev.deviceAddress = srcAddr;
|
||||||
//String updateIndicator = args[2];//not used.
|
if (tlvsBin == null) {
|
||||||
byte[] bin = hexStr2Bin(args[3]);
|
|
||||||
if (bin == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bin));
|
|
||||||
|
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(tlvsBin));
|
||||||
try {
|
try {
|
||||||
while (dis.available() > 0) {
|
while (dis.available() > 0) {
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user