aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/jau/direct_bt/DBTGattService.java2
-rw-r--r--java/jni/direct_bt/DBGattServer.cxx10
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx23
-rw-r--r--java/jni/direct_bt/DBTDevice.cxx64
-rw-r--r--java/jni/direct_bt/DBTGattChar.cxx4
-rw-r--r--java/jni/direct_bt/DBTGattDesc.cxx2
-rw-r--r--java/jni/direct_bt/EInfoReport.cxx8
-rw-r--r--java/org/direct_bt/BTDevice.java1
8 files changed, 55 insertions, 59 deletions
diff --git a/java/jau/direct_bt/DBTGattService.java b/java/jau/direct_bt/DBTGattService.java
index 2caa5190..b312b254 100644
--- a/java/jau/direct_bt/DBTGattService.java
+++ b/java/jau/direct_bt/DBTGattService.java
@@ -30,9 +30,7 @@ import java.util.List;
import org.direct_bt.BTDevice;
import org.direct_bt.BTGattChar;
-import org.direct_bt.BTGattDesc;
import org.direct_bt.BTGattService;
-import org.direct_bt.BTObject;
public class DBTGattService extends DBTObject implements BTGattService
{
diff --git a/java/jni/direct_bt/DBGattServer.cxx b/java/jni/direct_bt/DBGattServer.cxx
index a7eed750..1ce9919a 100644
--- a/java/jni/direct_bt/DBGattServer.cxx
+++ b/java/jni/direct_bt/DBGattServer.cxx
@@ -54,8 +54,8 @@ static const std::string _dbGattValueClazzCtorArgs("([BIZ)V");
static jobject _createDBGattValueFromDesc(JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, const DBGattDescRef& valueHolder) {
const jau::POctets& value = valueHolder->getValue();
- jbyteArray jval = env_->NewByteArray(value.size());
- env_->SetByteArrayRegion(jval, 0, value.size(), (const jbyte*)(value.get_ptr()));
+ jbyteArray jval = env_->NewByteArray( (jsize) value.size() );
+ env_->SetByteArrayRegion(jval, 0, (jsize) value.size(), (const jbyte*)(value.get_ptr()));
java_exception_check_and_throw(env_, E_FILE_LINE);
jobject jDBGattValue = env_->NewObject(clazz, clazz_ctor, jval, (jint)value.capacity(), valueHolder->hasVariableLength());
@@ -68,8 +68,8 @@ static jobject _createDBGattValueFromDesc(JNIEnv *env_, jclass clazz, jmethodID
static jobject _createDBGattValueFromChar(JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, const DBGattCharRef& valueHolder) {
const jau::POctets& value = valueHolder->getValue();
- jbyteArray jval = env_->NewByteArray(value.size());
- env_->SetByteArrayRegion(jval, 0, value.size(), (const jbyte*)(value.get_ptr()));
+ jbyteArray jval = env_->NewByteArray( (jsize) value.size() );
+ env_->SetByteArrayRegion(jval, 0, (jsize) value.size(), (const jbyte*)(value.get_ptr()));
java_exception_check_and_throw(env_, E_FILE_LINE);
jobject jDBGattValue = env_->NewObject(clazz, clazz_ctor, jval, (jint)value.capacity(), valueHolder->hasVariableLength());
@@ -635,7 +635,7 @@ class JNIDBGattServerListener : public DBGattServer::Listener {
mCCDChanged = search_method(env, clazz, "clientCharConfigChanged", "(Lorg/direct_bt/BTDevice;Lorg/direct_bt/DBGattService;Lorg/direct_bt/DBGattChar;Lorg/direct_bt/DBGattDesc;ZZ)V", false);
}
- ~JNIDBGattServerListener() noexcept { }
+ ~JNIDBGattServerListener() noexcept override = default;
void connected(BTDeviceRef device, const uint16_t initialMTU) override {
jobject j_device = JavaGlobalObj::checkAndGetObject(device->getJavaObject(), E_FILE_LINE);
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index c16d1553..7cd117f0 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -119,9 +119,8 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
return "JNIAdapterStatusListener[this "+jau::to_hexstring(this)+", iname "+std::to_string(iname)+"]";
}
- ~JNIAdapterStatusListener() override {
- // listenerObjRef dtor will call notifyDelete and clears the nativeInstance handle
- }
+ // listenerObjRef dtor will call notifyDelete and clears the nativeInstance handle
+ ~JNIAdapterStatusListener() override = default;
JNIAdapterStatusListener(JNIEnv *env, jobject statusListenerObj)
: iname(iname_next.fetch_add(1))
@@ -544,7 +543,7 @@ jint Java_jau_direct_1bt_DBTAdapter_removeAllStatusListenerImpl(JNIEnv *env, job
shared_ptr_ref<BTAdapter> adapter(env, obj); // hold until done
JavaAnonRef adapter_java = adapter->getJavaObject(); // hold until done!
JavaGlobalObj::check(adapter_java, E_FILE_LINE);
- return adapter->removeAllStatusListener();
+ return (jint)adapter->removeAllStatusListener();
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -566,7 +565,7 @@ jboolean Java_jau_direct_1bt_DBTAdapter_isDeviceWhitelisted(JNIEnv *env, jobject
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -596,7 +595,7 @@ jboolean Java_jau_direct_1bt_DBTAdapter_addDeviceToWhitelistImpl1(JNIEnv *env, j
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -625,7 +624,7 @@ jboolean Java_jau_direct_1bt_DBTAdapter_addDeviceToWhitelistImpl2(JNIEnv *env, j
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -653,7 +652,7 @@ jboolean Java_jau_direct_1bt_DBTAdapter_removeDeviceFromWhitelistImpl(JNIEnv *en
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -861,7 +860,7 @@ jint Java_jau_direct_1bt_DBTAdapter_removeDiscoveredDevicesImpl1(JNIEnv *env, jo
JavaAnonRef adapter_java = adapter->getJavaObject(); // hold until done!
JavaGlobalObj::check(adapter_java, E_FILE_LINE);
- return adapter->removeDiscoveredDevices();
+ return (jint) adapter->removeDiscoveredDevices();
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -884,7 +883,7 @@ jboolean Java_jau_direct_1bt_DBTAdapter_removeDiscoveredDeviceImpl1(JNIEnv *env,
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -1038,7 +1037,7 @@ jbyte Java_jau_direct_1bt_DBTAdapter_setDefaultLE_1PHYImpl(JNIEnv *env, jobject
const LE_PHYs Tx = static_cast<LE_PHYs>(jTx);
const LE_PHYs Rx = static_cast<LE_PHYs>(jRx);
- return number ( adapter->setDefaultLE_PHY(Tx, Rx) );
+ return (jbyte)number ( adapter->setDefaultLE_PHY(Tx, Rx) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -1101,7 +1100,7 @@ jobject Java_jau_direct_1bt_DBTAdapter_connectDeviceImpl(JNIEnv *env, jobject ob
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx
index efd9e6ee..873dd847 100644
--- a/java/jni/direct_bt/DBTDevice.cxx
+++ b/java/jni/direct_bt/DBTDevice.cxx
@@ -310,7 +310,7 @@ jint Java_jau_direct_1bt_DBTDevice_removeAllAssociatedCharListener(JNIEnv *env,
return 0;
}
- return gatt->removeAllAssociatedCharListener(associatedCharacteristicRef.shared_ptr());
+ return (jint) gatt->removeAllAssociatedCharListener(associatedCharacteristicRef.shared_ptr());
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -333,7 +333,7 @@ jint Java_jau_direct_1bt_DBTDevice_removeAllCharListener(JNIEnv *env, jobject ob
DBG_PRINT("BTGattChar's device GATTHandle not connected: %s", device->toString().c_str());
return 0;
}
- return gatt->removeAllCharListener();
+ return (jint) gatt->removeAllCharListener();
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -378,19 +378,19 @@ jbyte Java_jau_direct_1bt_DBTDevice_getConnectedLE_1PHYImpl(JNIEnv *env, jobject
JNICriticalArray<uint8_t, jbyteArray> criticalArrayTx(env); // RAII - release
uint8_t * resTx_ptr = criticalArrayTx.get(jresTx, criticalArrayTx.Mode::UPDATE_AND_RELEASE);
- if( NULL == resTx_ptr ) {
+ if( nullptr == resTx_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(resTx byte array) is null", E_FILE_LINE);
}
JNICriticalArray<uint8_t, jbyteArray> criticalArrayRx(env); // RAII - release
uint8_t * resRx_ptr = criticalArrayRx.get(jresRx, criticalArrayTx.Mode::UPDATE_AND_RELEASE);
- if( NULL == resRx_ptr ) {
+ if( nullptr == resRx_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(resRx byte array) is null", E_FILE_LINE);
}
LE_PHYs& resTx = *reinterpret_cast<LE_PHYs *>(resTx_ptr);
LE_PHYs& resRx = *reinterpret_cast<LE_PHYs *>(resRx_ptr);
- return number( device->getConnectedLE_PHY(resTx, resRx) );
+ return (jbyte) number( device->getConnectedLE_PHY(resTx, resRx) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -407,7 +407,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_setConnectedLE_1PHYImpl(JNIEnv *env, jobject
const LE_PHYs Tx = static_cast<LE_PHYs>(jTx);
const LE_PHYs Rx = static_cast<LE_PHYs>(jRx);
- return number ( device->setConnectedLE_PHY(Tx, Rx) );
+ return (jbyte)number ( device->setConnectedLE_PHY(Tx, Rx) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -420,7 +420,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getTxPhysImpl(JNIEnv *env, jobject obj) {
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getTxPhys() );
+ return (jbyte) number( device->getTxPhys() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -433,7 +433,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getRxPhysImpl(JNIEnv *env, jobject obj) {
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getRxPhys() );
+ return (jbyte) number( device->getRxPhys() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -446,7 +446,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_disconnectImpl(JNIEnv *env, jobject obj)
shared_ptr_ref<BTDevice> device(env, obj); // hold until done
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return (jint) number( device->disconnect() );
+ return (jbyte) number( device->disconnect() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -516,7 +516,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getAvailableSMPKeysImpl(JNIEnv *env, jobject
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getAvailableSMPKeys(JNI_TRUE == responder) );
+ return (jbyte) number( device->getAvailableSMPKeys(JNI_TRUE == responder) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -529,7 +529,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_uploadKeysImpl(JNIEnv *env, jobject obj) {
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->uploadKeys() );
+ return (jbyte) number( device->uploadKeys() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -551,7 +551,7 @@ void Java_jau_direct_1bt_DBTDevice_getLongTermKeyImpl(JNIEnv *env, jobject obj,
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * sink_ptr = criticalArray.get(jsink, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == sink_ptr ) {
+ if( nullptr == sink_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
SMPLongTermKey& ltk_sink = *reinterpret_cast<SMPLongTermKey *>(sink_ptr);
@@ -576,7 +576,7 @@ void Java_jau_direct_1bt_DBTDevice_setLongTermKeyImpl(JNIEnv *env, jobject obj,
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * source_ptr = criticalArray.get(jsource, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == source_ptr ) {
+ if( nullptr == source_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const SMPLongTermKey& ltk = *reinterpret_cast<SMPLongTermKey *>(source_ptr);
@@ -602,7 +602,7 @@ void Java_jau_direct_1bt_DBTDevice_getIdentityResolvingKeyImpl(JNIEnv *env, jobj
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * sink_ptr = criticalArray.get(jsink, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == sink_ptr ) {
+ if( nullptr == sink_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
SMPIdentityResolvingKey& irk_sink = *reinterpret_cast<SMPIdentityResolvingKey *>(sink_ptr);
@@ -627,7 +627,7 @@ void Java_jau_direct_1bt_DBTDevice_setIdentityResolvingKeyImpl(JNIEnv *env, jobj
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * source_ptr = criticalArray.get(jsource, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == source_ptr ) {
+ if( nullptr == source_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const SMPIdentityResolvingKey& irk = *reinterpret_cast<SMPIdentityResolvingKey *>(source_ptr);
@@ -653,7 +653,7 @@ void Java_jau_direct_1bt_DBTDevice_getSignatureResolvingKeyImpl(JNIEnv *env, job
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * sink_ptr = criticalArray.get(jsink, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == sink_ptr ) {
+ if( nullptr == sink_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
SMPSignatureResolvingKey& irk_sink = *reinterpret_cast<SMPSignatureResolvingKey *>(sink_ptr);
@@ -678,7 +678,7 @@ void Java_jau_direct_1bt_DBTDevice_setSignatureResolvingKeyImpl(JNIEnv *env, job
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * source_ptr = criticalArray.get(jsource, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == source_ptr ) {
+ if( nullptr == source_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const SMPSignatureResolvingKey& irk = *reinterpret_cast<SMPSignatureResolvingKey *>(source_ptr);
@@ -704,7 +704,7 @@ void Java_jau_direct_1bt_DBTDevice_getLinkKeyImpl(JNIEnv *env, jobject obj, jboo
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * sink_ptr = criticalArray.get(jsink, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == sink_ptr ) {
+ if( nullptr == sink_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
SMPLinkKey& lk_sink = *reinterpret_cast<SMPLinkKey *>(sink_ptr);
@@ -729,7 +729,7 @@ void Java_jau_direct_1bt_DBTDevice_setLinkKeyImpl(JNIEnv *env, jobject obj, jbyt
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * source_ptr = criticalArray.get(jsource, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == source_ptr ) {
+ if( nullptr == source_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const SMPLinkKey& lk = *reinterpret_cast<SMPLinkKey *>(source_ptr);
@@ -759,7 +759,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getConnSecurityLevelImpl(JNIEnv *env, jobjec
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getConnSecurityLevel() );
+ return (jbyte) number( device->getConnSecurityLevel() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -772,11 +772,11 @@ jbyte Java_jau_direct_1bt_DBTDevice_getConnIOCapabilityImpl(JNIEnv *env, jobject
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getConnIOCapability() );
+ return (jbyte) number( device->getConnIOCapability() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
- return number( SMPIOCapability::UNSET );
+ return (jbyte) number( SMPIOCapability::UNSET );
}
jboolean Java_jau_direct_1bt_DBTDevice_setConnSecurityImpl(JNIEnv *env, jobject obj, jbyte jsec_level, jbyte jio_cap) {
@@ -825,7 +825,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getPairingModeImpl(JNIEnv *env, jobject obj)
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->getPairingMode() );
+ return (jbyte) number( device->getPairingMode() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -838,7 +838,7 @@ jbyte Java_jau_direct_1bt_DBTDevice_getPairingStateImpl(JNIEnv *env, jobject obj
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return static_cast<uint8_t>( device->getPairingState() );
+ return (jbyte) static_cast<uint8_t>( device->getPairingState() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -851,11 +851,11 @@ jbyte Java_jau_direct_1bt_DBTDevice_setPairingPasskeyImpl(JNIEnv *env, jobject o
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->setPairingPasskey( static_cast<uint32_t>(jpasskey) ) );
+ return (jbyte) number( device->setPairingPasskey( static_cast<uint32_t>(jpasskey) ) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
- return static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
+ return (jbyte) static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
}
jbyte Java_jau_direct_1bt_DBTDevice_setPairingPasskeyNegativeImpl(JNIEnv *env, jobject obj) {
@@ -864,11 +864,11 @@ jbyte Java_jau_direct_1bt_DBTDevice_setPairingPasskeyNegativeImpl(JNIEnv *env, j
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->setPairingPasskeyNegative() );
+ return (jbyte) number( device->setPairingPasskeyNegative() );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
- return static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
+ return (jbyte) static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
}
jbyte Java_jau_direct_1bt_DBTDevice_setPairingNumericComparisonImpl(JNIEnv *env, jobject obj, jboolean jequal) {
@@ -877,11 +877,11 @@ jbyte Java_jau_direct_1bt_DBTDevice_setPairingNumericComparisonImpl(JNIEnv *env,
JavaAnonRef device_java = device->getJavaObject(); // hold until done!
JavaGlobalObj::check(device_java, E_FILE_LINE);
- return number( device->setPairingNumericComparison( JNI_TRUE == jequal ? true : false ) );
+ return (jbyte) number( device->setPairingNumericComparison( JNI_TRUE == jequal ? true : false ) );
} catch(...) {
rethrow_and_raise_java_exception(env);
}
- return static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
+ return (jbyte) static_cast<uint8_t>( HCIStatusCode::INTERNAL_FAILURE );
}
//
@@ -953,7 +953,7 @@ jboolean Java_jau_direct_1bt_DBTDevice_sendNotification(JNIEnv *env, jobject obj
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == value_ptr ) {
+ if( nullptr == value_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const jau::TROOctets value(value_ptr, value_size, jau::endian::little);
@@ -979,7 +979,7 @@ jboolean Java_jau_direct_1bt_DBTDevice_sendIndication(JNIEnv *env, jobject obj,
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == value_ptr ) {
+ if( nullptr == value_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
const jau::TROOctets value(value_ptr, value_size, jau::endian::little);
diff --git a/java/jni/direct_bt/DBTGattChar.cxx b/java/jni/direct_bt/DBTGattChar.cxx
index 3c8d20ef..e7bb3903 100644
--- a/java/jni/direct_bt/DBTGattChar.cxx
+++ b/java/jni/direct_bt/DBTGattChar.cxx
@@ -156,7 +156,7 @@ jboolean Java_jau_direct_1bt_DBTGattChar_writeValueImpl(JNIEnv *env, jobject obj
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == value_ptr ) {
+ if( nullptr == value_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
jau::TROOctets value(value_ptr, value_size, jau::endian::little);
@@ -202,7 +202,7 @@ jboolean Java_jau_direct_1bt_DBTGattChar_configNotificationIndicationImpl(JNIEnv
}
JNICriticalArray<jboolean, jbooleanArray> criticalArray(env); // RAII - release
jboolean * state_ptr = criticalArray.get(jEnabledState, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == state_ptr ) {
+ if( nullptr == state_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(boolean array) is null", E_FILE_LINE);
}
diff --git a/java/jni/direct_bt/DBTGattDesc.cxx b/java/jni/direct_bt/DBTGattDesc.cxx
index 456dda31..48aee220 100644
--- a/java/jni/direct_bt/DBTGattDesc.cxx
+++ b/java/jni/direct_bt/DBTGattDesc.cxx
@@ -100,7 +100,7 @@ jboolean Java_jau_direct_1bt_DBTGattDesc_writeValueImpl(JNIEnv *env, jobject obj
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == value_ptr ) {
+ if( nullptr == value_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
jau::TROOctets value(value_ptr, value_size, jau::endian::little);
diff --git a/java/jni/direct_bt/EInfoReport.cxx b/java/jni/direct_bt/EInfoReport.cxx
index 97a70520..030bf757 100644
--- a/java/jni/direct_bt/EInfoReport.cxx
+++ b/java/jni/direct_bt/EInfoReport.cxx
@@ -153,7 +153,7 @@ void Java_org_direct_1bt_EInfoReport_setAddressImpl(JNIEnv *env, jobject obj, jb
}
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
uint8_t * address_ptr = criticalArray.get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
- if( NULL == address_ptr ) {
+ if( nullptr == address_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(address byte array) is null", E_FILE_LINE);
}
const EUI48& address = *reinterpret_cast<EUI48 *>(address_ptr);
@@ -501,8 +501,8 @@ jobject Java_org_direct_1bt_EInfoReport_getManufacturerData(JNIEnv *env, jobject
if( nullptr != mdata ) {
result = env->NewObject(map_cls, map_ctor, 1);
- jbyteArray arr = env->NewByteArray(mdata->getData().size());
- env->SetByteArrayRegion(arr, 0, mdata->getData().size(), (const jbyte *)mdata->getData().get_ptr());
+ jbyteArray arr = env->NewByteArray( (jsize) mdata->getData().size() );
+ env->SetByteArrayRegion(arr, 0, (jsize) mdata->getData().size(), (const jbyte *)mdata->getData().get_ptr());
jobject key = env->NewObject(short_cls, short_ctor, mdata->getCompany());
env->CallObjectMethod(result, map_put, key, arr);
@@ -649,7 +649,7 @@ void Java_org_direct_1bt_EInfoReport_getConnInterval(JNIEnv *env, jobject obj, j
}
JNICriticalArray<uint16_t, jshortArray> criticalArray(env); // RAII - release
uint16_t * array_ptr = criticalArray.get(jminmax, criticalArray.Mode::UPDATE_AND_RELEASE);
- if( NULL == array_ptr ) {
+ if( nullptr == array_ptr ) {
throw jau::InternalError("GetPrimitiveArrayCritical(short array) is null", E_FILE_LINE);
}
ref->getConnInterval(array_ptr[0], array_ptr[1]);
diff --git a/java/org/direct_bt/BTDevice.java b/java/org/direct_bt/BTDevice.java
index 253bdd3b..0fd5fa64 100644
--- a/java/org/direct_bt/BTDevice.java
+++ b/java/org/direct_bt/BTDevice.java
@@ -26,7 +26,6 @@
package org.direct_bt;
import java.util.List;
-import java.util.Map;
/**
* BTDevice represents one remote Bluetooth device.