summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2017-01-26 15:16:30 -0800
committerRandy Pan <zpan@google.com>2017-01-26 15:16:30 -0800
commit75cb696c469b9ea1b1988fb18871cc96520d8899 (patch)
tree9b90fd16e3d0d8bbf1645a1653f070807324aad0 /service
parent8eb5377c60cb75a63da07df1ebb5d0e8320b57cb (diff)
WifiVendorHal: add a MAC string parsing helper function
This helper function parse a unquoted MAC address string into a byte array. Bug: 34740076 Test: compiles Change-Id: Ie4a534d8e60a1c963464499eb7828edd83ace4b6
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiVendorHal.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java
index f2b209b33..cb4478095 100644
--- a/service/java/com/android/server/wifi/WifiVendorHal.java
+++ b/service/java/com/android/server/wifi/WifiVendorHal.java
@@ -511,6 +511,20 @@ public class WifiVendorHal {
throw new UnsupportedOperationException();
}
+ /**
+ * Helper function that parses unquoted MAC address string to a byte array
+ *
+ * @param macWithColons mac address string without double quotes
+ * @param mac an array of 6 bytes to receive the parsed mac address
+ */
+ private void parseUnquotedMacStrToByteArray(String macWithColons, byte[] mac) {
+ String[] macAddrStr = macWithColons.split(":");
+ for (int i = 0; i < 6; i++) {
+ Integer hexVal = Integer.parseInt(macAddrStr[i], 16);
+ mac[i] = hexVal.byteValue();
+ }
+ }
+
StackTraceElement[] mTrace;
private void kilroy() {