Class 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 connections
      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
      void stop()
      Stops the discovery service
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface datahop.BleDiscoveryDriver

        start
    • 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 id
        scanTime - duration of the scanning phase
        idleTime - idle time before starting another scan cycle
      • stop

        public void stop()
        Stops the discovery service
        Specified by:
        stop in interface datahop.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 interface datahop.BleDiscoveryDriver
        Parameters:
        topic - topic id
        info - value advertised