Android Open Source - bluetooth Beacon Filter From Project Back to project page bluetooth .
License The source code is released under:
MIT License
If you think the Android project bluetooth listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.mauriciotogneri.bluetooth.beacons;
/ * f r o m w w w . j a v a 2 s . c o m * /
public abstract class BeaconFilter
{
private static final char [] HEX_CHARS =
{
'0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F'
};
protected static byte toByte(String hex)
{
int result = Integer.parseInt(hex, 16);
if (result > 127)
{
result -= 256;
}
return (byte )result;
}
protected int toInt(byte [] bytes)
{
return Integer.parseInt(toHex(bytes), 16);
}
protected String toHex(byte [] bytes)
{
char [] chars = new char [bytes.length * 2];
for (int i = 0; i < bytes.length; i++)
{
int value = bytes[i] & 0xFF;
chars[i * 2] = BeaconFilter.HEX_CHARS[value >>> 4];
chars[i * 2 + 1] = BeaconFilter.HEX_CHARS[value & 0x0F];
}
return new String(chars);
}
public abstract Beacon getBeacon(String macAddress, int rssi, byte [] data);
}
Java Source Code List com.mauriciotogneri.bluetooth.beacons.BeaconFilter.java com.mauriciotogneri.bluetooth.beacons.BeaconListener.java com.mauriciotogneri.bluetooth.beacons.BeaconManager.java com.mauriciotogneri.bluetooth.beacons.BeaconService.java com.mauriciotogneri.bluetooth.beacons.Beacon.java com.mauriciotogneri.bluetooth.beacons.UnsupportedBluetoothLeException.java com.mauriciotogneri.bluetooth.connection.client.ClientConnection.java com.mauriciotogneri.bluetooth.connection.client.ClientEvent.java com.mauriciotogneri.bluetooth.connection.client.ClientLink.java com.mauriciotogneri.bluetooth.connection.client.ClientThread.java com.mauriciotogneri.bluetooth.connection.kernel.ConnectionThread.java com.mauriciotogneri.bluetooth.connection.scan.DeviceScanner.java com.mauriciotogneri.bluetooth.connection.scan.ScannerManager.java com.mauriciotogneri.bluetooth.connection.server.ServerConnection.java com.mauriciotogneri.bluetooth.connection.server.ServerEvent.java com.mauriciotogneri.bluetooth.connection.server.ServerLink.java com.mauriciotogneri.bluetooth.connection.server.ServerThread.java