Android Open Source - BLEConnector B L E Connected Devices






From Project

Back to project page BLEConnector.

License

The source code is released under:

MIT License

If you think the Android project BLEConnector 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.felhr.bleconnector;
/*  ww  w  .j  a v a 2 s  .c  o  m*/
import java.util.Hashtable;
import java.util.Map;

public class BLEConnectedDevices extends Hashtable<String,BLEConnectedDevice>
{
  
  private static final long serialVersionUID = 1L;
  
  public BLEConnectedDevices()
  {
    super();
  }
  
  public boolean setAllNotifications(boolean value)
  {
    boolean response = false;
    for(Map.Entry<String, BLEConnectedDevice> entry: this.entrySet())
    {
      BLEConnectedDevice device = entry.getValue();
      if(device.getNotificationsStatus())
      {
        response = true;
        device.getGatt().setCharacteristicNotification(device.getCharacteristic(), value);
      }
    }
    return response;
  }
  
  public boolean setNotifications(String deviceAddress, boolean value)
  {
    BLEConnectedDevice device = get(deviceAddress);
    if(device.getNotificationsStatus())
    {
      return device.getGatt().setCharacteristicNotification(device.getCharacteristic(), value);
    }else
    {
      return false;
    }
    
  }
}




Java Source Code List

com.felhr.bleconnector.BLEAdvertisingParser.java
com.felhr.bleconnector.BLEBuffer.java
com.felhr.bleconnector.BLEConnectedDevice.java
com.felhr.bleconnector.BLEConnectedDevices.java
com.felhr.bleconnector.BLEConnector.java
com.felhr.bleconnector.BLEDevice.java