diff options
author | Sven Gothel <[email protected]> | 2022-05-10 03:57:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-10 03:57:49 +0200 |
commit | 4faded58c1f5662b8baea6b1259cd297986a278c (patch) | |
tree | ab2df60f577efefa43f5472de4c3e79e01f893bf /java/org/direct_bt/BTGattService.java | |
parent | 4d5b98cade63a3cb0208bade2b5ff0d531594d74 (diff) |
JNI Lifecycle Fix: BTGattCharListener: Adopt full Java/Native link via DBTNativeDownlink and JavaUplink like AdapterStatusListener change, clean listener API + impl.
AdapterStatusListener adopted fully linked via DBTNativeDownlink (java->native) and JavaUplink (native->java).
This allows intrinsic lifecycle management.
Native destruction leads to its reference removal from the java object
and destruction of the java object removes its reference from the native object.
Both reference removals may lead to their destruction if reaching zero.
(was commit 9c5f25ccd1637728d6e79592279e4b38ecd32f59)
Same applies to BTGattCharListener:
- This removed BTGattChar::Listener, simply use BTGattCharListener
- Using private BTGattHandler::GattCharListenerPair struct for BTGattChar mapping
- No more manual or exposed BTGattChar mapping
- Java: An added BTGattCharListener instance can be used for removal now,
no more wrapper object magic returned.
Further:
- moved removed `namespace impl`, moved StatusListenerPair into private BTAdapter
- have all add/remove*Listener methods noexcept
Unit tests validating BTGattCharListener add and remove.
Diffstat (limited to 'java/org/direct_bt/BTGattService.java')
-rw-r--r-- | java/org/direct_bt/BTGattService.java | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/java/org/direct_bt/BTGattService.java b/java/org/direct_bt/BTGattService.java index 62cd04ec..592ca9fc 100644 --- a/java/org/direct_bt/BTGattService.java +++ b/java/org/direct_bt/BTGattService.java @@ -88,9 +88,6 @@ public interface BTGattService extends BTObject if( null == listener ) { throw new IllegalArgumentException("listener argument null"); } - if( null != listener.getAssociatedChar() ) { - throw new IllegalArgumentException("listener's associated characteristic is not null"); - } final boolean res = device.addCharListener(listener); for(final Iterator<BTGattService> is = services.iterator(); is.hasNext(); ) { final BTGattService s = is.next(); |