28import java.util.Iterator;
93 if(
null == listener ) {
94 throw new IllegalArgumentException(
"listener argument null");
97 for(
final Iterator<BTGattService> is = services.iterator(); is.hasNext(); ) {
99 final List<BTGattChar> characteristics = s.
getChars();
100 for(
final Iterator<BTGattChar> ic = characteristics.iterator(); ic.hasNext(); ) {
101 ic.next().enableNotificationOrIndication(
new boolean[2]);
117 for(
final Iterator<BTGattService> is = services.iterator(); is.hasNext(); ) {
119 final List<BTGattChar> characteristics = s.
getChars();
120 for(
final Iterator<BTGattChar> ic = characteristics.iterator(); ic.hasNext(); ) {
121 ic.next().configNotificationIndication(
false ,
false ,
new boolean[2]);
135 for(
final Iterator<BTGattService> is = services.iterator(); is.hasNext(); ) {
137 final List<BTGattChar> characteristics = s.
getChars();
138 for(
final Iterator<BTGattChar> ic = characteristics.iterator(); ic.hasNext(); ) {
139 ic.next().configNotificationIndication(
false ,
false ,
new boolean[2]);
BTGattChar event listener for notification and indication events.
BTDevice represents one remote Bluetooth device.
boolean removeCharListener(final BTGattCharListener l)
Remove the given BTGattCharListener from the listener list.
boolean addCharListener(final BTGattCharListener listener)
Add the given BTGattCharListener to the listener list if not already present.
int removeAllCharListener()
Remove all BTGattCharListener from the list.
Representing a Gatt Characteristic object from the GATT client perspective.
Representing a Gatt Service object from the GATT client perspective.
static boolean addCharListenerToAll(final BTDevice device, final List< BTGattService > services, final BTGattCharListener listener)
Adds the given BTGattCharListener to the BTDevice and BTGattChar#enableNotificationOrIndication(boole...
BTGattChar findGattChar(String char_uuid)
Find a BTGattChar by its char_uuid.
String getUUID()
Get the UUID of this service.
List< BTGattChar > getChars()
Returns a list of BTGattChar this service exposes.
boolean getPrimary()
Returns true if this service is a primary service, false if secondary.
static int removeAllCharListener(final BTDevice device, final List< BTGattService > services)
Removes all BTGattCharListener from the BTDevice.
static boolean removeCharListenerFromAll(final BTDevice device, final List< BTGattService > services, final BTGattCharListener listener)
Removes the given BTGattCharListener from the BTDevice.
BTDevice getDevice()
Returns the device to which this service belongs to.