Package network.datahop.blediscovery
Class BLEServiceDiscovery
- java.lang.Object
-
- network.datahop.blediscovery.BLEServiceDiscovery
-
- All Implemented Interfaces:
datahop.BleDiscoveryDriver
public class BLEServiceDiscovery extends java.lang.Object implements datahop.BleDiscoveryDriver
BLEServiceDiscovery class is used for service discovery using Bluetooth Low Energy (BLE) beacons. BLEServiceDiscovery is responsible of scanning for BLE Beacons and starts a connection to the GATT server when found BLE Beacons with the same service id. Characteristics are compared in the GATT Server when accepting connections to compare status for each "topic". When detected different values of the "topics" it receives network information from the server.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdvertisingInfo(java.lang.String characteristic, byte[] info)
This method adds advertising information value for the specified "topic".static BLEServiceDiscovery
getInstance(android.content.Context appContext)
void
setNotifier(datahop.BleDiscNotifier notifier)
Set the notifier that receives the events advertised when creating or destroying the group or when receiving users connectionsvoid
start(java.lang.String service_uuid, long scanTime, long idleTime)
This method starts the service and periodically scans for users and tries to connect to themvoid
stop()
Stops the discovery service
-
-
-
Method Detail
-
getInstance
public static BLEServiceDiscovery getInstance(android.content.Context appContext)
-
setNotifier
public void setNotifier(datahop.BleDiscNotifier notifier)
Set the notifier that receives the events advertised when creating or destroying the group or when receiving users connections- Parameters:
notifier
- instance
-
start
public void start(java.lang.String service_uuid, long scanTime, long idleTime)
This method starts the service and periodically scans for users and tries to connect to them- Parameters:
service_uuid
- service idscanTime
- duration of the scanning phaseidleTime
- idle time before starting another scan cycle
-
stop
public void stop()
Stops the discovery service- Specified by:
stop
in interfacedatahop.BleDiscoveryDriver
-
addAdvertisingInfo
public void addAdvertisingInfo(java.lang.String characteristic, byte[] info)
This method adds advertising information value for the specified "topic". In case "topic" already exists information is updated- Specified by:
addAdvertisingInfo
in interfacedatahop.BleDiscoveryDriver
- Parameters:
topic
- topic idinfo
- value advertised
-
-