Factor shared Bluetooth code into superclass.

This commit is contained in:
akwizgran
2018-01-10 13:03:07 +00:00
parent 2f049fbead
commit 0c5976b287
11 changed files with 471 additions and 615 deletions

View File

@@ -126,6 +126,10 @@ public class StringUtils {
return toUtf8(s).length > maxLength;
}
public static boolean isValidMac(String mac) {
return MAC.matcher(mac).matches();
}
public static byte[] macToBytes(String mac) {
if (!MAC.matcher(mac).matches()) throw new IllegalArgumentException();
return fromHexString(mac.replaceAll(":", ""));