Package network.datahop.blediscovery
Class BLEAdvertising
- java.lang.Object
-
- network.datahop.blediscovery.BLEAdvertising
-
- All Implemented Interfaces:
datahop.BleAdvertisingDriver,datahop.BleDiscoveryDriver
public class BLEAdvertising extends java.lang.Object implements datahop.BleAdvertisingDriverBLEAdvertising class is used for service discovery using Bluetooth Low Energy beacons. BLEAdvertising is responsible of advertising service discovery data and exchange service status using GATT server and GATT characteristics. Advertised data for each service is structured in "topics" and each topic is configured as a BLE characteristic in the GATT server. Characteristics are compared in the GATT Server when accepting connections to compare status for each "topic. When detected different values of the "topics" means different service status and it can reply with network information.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdvertisingInfo(java.lang.String topic, byte[] info)This method adds advertising information value for the specified "topic".static BLEAdvertisinggetInstance(android.content.Context appContext)voidnotifyEmptyValue()This method can be used to notify no different "topic" status is detected.voidnotifyNetworkInformation(java.lang.String network, java.lang.String password, java.lang.String info)This method can be used to notify network information (SSID, password, node info) when detected different "topic" statusvoidsetNotifier(datahop.BleAdvNotifier notifier)Set the notifier that receives the events advertised when creating or destroying the group or when receiving users connectionsvoidstart(java.lang.String serviceid)This method configures AdvertiseSettings, starts advertising via BluetoothLeAdvertiser and starts the GATT servervoidstop()This method stops the advertising service
-
-
-
Method Detail
-
getInstance
public static BLEAdvertising getInstance(android.content.Context appContext)
-
setNotifier
public void setNotifier(datahop.BleAdvNotifier 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 serviceid)
This method configures AdvertiseSettings, starts advertising via BluetoothLeAdvertiser and starts the GATT server- Specified by:
startin interfacedatahop.BleAdvertisingDriver- Specified by:
startin interfacedatahop.BleDiscoveryDriver- Parameters:
serviceid- service id
-
stop
public void stop()
This method stops the advertising service- Specified by:
stopin interfacedatahop.BleAdvertisingDriver- Specified by:
stopin interfacedatahop.BleDiscoveryDriver
-
addAdvertisingInfo
public void addAdvertisingInfo(java.lang.String topic, byte[] info)This method adds advertising information value for the specified "topic". In case "topic" already exists information is updated- Specified by:
addAdvertisingInfoin interfacedatahop.BleAdvertisingDriver- Specified by:
addAdvertisingInfoin interfacedatahop.BleDiscoveryDriver- Parameters:
topic- topic idinfo- value advertised
-
notifyNetworkInformation
public void notifyNetworkInformation(java.lang.String network, java.lang.String password, java.lang.String info)This method can be used to notify network information (SSID, password, node info) when detected different "topic" status- Parameters:
network- SSIDpassword-info- other network information
-
notifyEmptyValue
public void notifyEmptyValue()
This method can be used to notify no different "topic" status is detected.
-
-