aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/direct_bt/DBTTypes.hpp24
-rw-r--r--api/direct_bt/GATTCharacteristic.hpp10
-rw-r--r--api/direct_bt/GATTDescriptor.hpp6
-rw-r--r--api/direct_bt/GATTNumbers.hpp28
-rw-r--r--api/direct_bt/GATTService.hpp6
-rw-r--r--api/direct_bt/HCIHandler.hpp4
-rw-r--r--api/direct_bt/UUID.hpp2
-rw-r--r--java/jni/BluetoothFactory.cxx4
-rw-r--r--java/jni/direct_bt/DBTDevice.cxx46
-rw-r--r--java/jni/direct_bt/DBTGattCharacteristic.cxx38
-rw-r--r--java/jni/direct_bt/DBTGattDescriptor.cxx8
-rw-r--r--java/jni/direct_bt/DBTGattService.cxx42
-rw-r--r--java/jni/direct_bt/DBTManager.cxx18
-rw-r--r--src/direct_bt/BTTypes.cpp12
-rw-r--r--src/direct_bt/DBTAdapter.cpp24
-rw-r--r--src/direct_bt/GATTHandler.cpp4
-rw-r--r--src/direct_bt/HCIHandler.cpp8
-rw-r--r--src/direct_bt/L2CAPComm.cpp16
-rw-r--r--src/direct_bt/UUID.cpp1
19 files changed, 150 insertions, 151 deletions
diff --git a/api/direct_bt/DBTTypes.hpp b/api/direct_bt/DBTTypes.hpp
index f185823f..93d66fb7 100644
--- a/api/direct_bt/DBTTypes.hpp
+++ b/api/direct_bt/DBTTypes.hpp
@@ -102,8 +102,8 @@ namespace direct_bt {
public:
static size_t minimumDataSize() noexcept { return 6 + 1 + 1 + 1 + 1; }
- ConnectionInfo(const EUI48 &address, BDAddressType addressType, int8_t rssi, int8_t tx_power, int8_t max_tx_power) noexcept
- : address(address), addressType(addressType), rssi(rssi), tx_power(tx_power), max_tx_power(max_tx_power) {}
+ ConnectionInfo(const EUI48 &address_, BDAddressType addressType_, int8_t rssi_, int8_t tx_power_, int8_t max_tx_power_) noexcept
+ : address(address_), addressType(addressType_), rssi(rssi_), tx_power(tx_power_), max_tx_power(max_tx_power_) {}
const EUI48 getAddress() const noexcept { return address; }
BDAddressType getAddressType() const noexcept { return addressType; }
@@ -135,8 +135,8 @@ namespace direct_bt {
NameAndShortName() noexcept
: name(), short_name() {}
- NameAndShortName(const std::string & name, const std::string & short_name) noexcept
- : name(name), short_name(short_name) {}
+ NameAndShortName(const std::string & name_, const std::string & short_name_) noexcept
+ : name(name_), short_name(short_name_) {}
std::string getName() const noexcept { return name; }
std::string getShortName() const noexcept { return short_name; }
@@ -226,14 +226,14 @@ namespace direct_bt {
void setShortName(const std::string v) noexcept { short_name = v; }
public:
- AdapterInfo(const int dev_id, const EUI48 & address,
- const uint8_t version, const uint16_t manufacturer,
- const AdapterSetting supported_setting, const AdapterSetting current_setting,
- const uint32_t dev_class, const std::string & name, const std::string & short_name) noexcept
- : dev_id(dev_id), address(address), version(version),
- manufacturer(manufacturer), supported_setting(supported_setting),
- current_setting(current_setting), dev_class(dev_class),
- name(name), short_name(short_name)
+ AdapterInfo(const int dev_id_, const EUI48 & address_,
+ const uint8_t version_, const uint16_t manufacturer_,
+ const AdapterSetting supported_setting_, const AdapterSetting current_setting_,
+ const uint32_t dev_class_, const std::string & name_, const std::string & short_name_) noexcept
+ : dev_id(dev_id_), address(address_), version(version_),
+ manufacturer(manufacturer_), supported_setting(supported_setting_),
+ current_setting(current_setting_), dev_class(dev_class_),
+ name(name_), short_name(short_name_)
{ }
bool isSettingMaskSupported(const AdapterSetting setting) const noexcept {
diff --git a/api/direct_bt/GATTCharacteristic.hpp b/api/direct_bt/GATTCharacteristic.hpp
index 5c9f614f..b1802dcc 100644
--- a/api/direct_bt/GATTCharacteristic.hpp
+++ b/api/direct_bt/GATTCharacteristic.hpp
@@ -143,10 +143,10 @@ namespace direct_bt {
/* Optional Client Characteristic Configuration index within descriptorList */
int clientCharacteristicsConfigIndex = -1;
- GATTCharacteristic(const GATTServiceRef & service, const uint16_t service_handle, const uint16_t handle,
- const PropertyBitVal properties, const uint16_t value_handle, std::shared_ptr<const uuid_t> value_type) noexcept
- : wbr_service(service), service_handle(service_handle), handle(handle),
- properties(properties), value_handle(value_handle), value_type(value_type) {}
+ GATTCharacteristic(const GATTServiceRef & service_, const uint16_t service_handle_, const uint16_t handle_,
+ const PropertyBitVal properties_, const uint16_t value_handle_, std::shared_ptr<const uuid_t> value_type_) noexcept
+ : wbr_service(service_), service_handle(service_handle_), handle(handle_),
+ properties(properties_), value_handle(value_handle_), value_type(value_type_) {}
std::string get_java_class() const noexcept override {
return java_class();
@@ -178,7 +178,7 @@ namespace direct_bt {
if( 0 > clientCharacteristicsConfigIndex ) {
return nullptr;
}
- return descriptorList.at(clientCharacteristicsConfigIndex); // abort if out of bounds
+ return descriptorList.at(static_cast<size_t>(clientCharacteristicsConfigIndex)); // abort if out of bounds
}
/**
diff --git a/api/direct_bt/GATTDescriptor.hpp b/api/direct_bt/GATTDescriptor.hpp
index 8ddf7603..af3e0f20 100644
--- a/api/direct_bt/GATTDescriptor.hpp
+++ b/api/direct_bt/GATTDescriptor.hpp
@@ -116,9 +116,9 @@ namespace direct_bt {
/* Characteristics Descriptor's Value */
POctets value;
- GATTDescriptor(const GATTCharacteristicRef & characteristic, const std::shared_ptr<const uuid_t> & type,
- const uint16_t handle) noexcept
- : wbr_characteristic(characteristic), type(type), handle(handle), value(/* intentional zero sized */) {}
+ GATTDescriptor(const GATTCharacteristicRef & characteristic, const std::shared_ptr<const uuid_t> & type_,
+ const uint16_t handle_) noexcept
+ : wbr_characteristic(characteristic), type(type_), handle(handle_), value(/* intentional zero sized */) {}
std::string get_java_class() const noexcept override {
return java_class();
diff --git a/api/direct_bt/GATTNumbers.hpp b/api/direct_bt/GATTNumbers.hpp
index 89c4a0af..805aaebc 100644
--- a/api/direct_bt/GATTNumbers.hpp
+++ b/api/direct_bt/GATTNumbers.hpp
@@ -272,9 +272,9 @@ class GattGenericAccessSvc {
/** Characteristic: Optional [Read: Mandatory; Write: Excluded; ...]*/
const std::shared_ptr<GattPeriphalPreferredConnectionParameters> prefConnParam;
- GattGenericAccessSvc(const std::string & deviceName, const AppearanceCat appearance,
- const std::shared_ptr<GattPeriphalPreferredConnectionParameters> & prefConnParam) noexcept
- : deviceName(deviceName), appearance(appearance), prefConnParam(prefConnParam) {}
+ GattGenericAccessSvc(const std::string & deviceName_, const AppearanceCat appearance_,
+ const std::shared_ptr<GattPeriphalPreferredConnectionParameters> & prefConnParam_) noexcept
+ : deviceName(deviceName_), appearance(appearance_), prefConnParam(prefConnParam_) {}
std::string toString() const noexcept;
};
@@ -298,8 +298,8 @@ struct GattPnP_ID {
GattPnP_ID(const TROOctets &source) noexcept;
- GattPnP_ID(const uint8_t vendor_id_source, const uint16_t vendor_id, const uint16_t product_id, const uint16_t product_version) noexcept
- : vendor_id_source(vendor_id_source), vendor_id(vendor_id), product_id(product_id), product_version(product_version) {}
+ GattPnP_ID(const uint8_t vendor_id_source_, const uint16_t vendor_id_, const uint16_t product_id_, const uint16_t product_version_) noexcept
+ : vendor_id_source(vendor_id_source_), vendor_id(vendor_id_), product_id(product_id_), product_version(product_version_) {}
std::string toString() const noexcept;
};
@@ -331,12 +331,12 @@ class GattDeviceInformationSvc {
/** Optional */
const std::shared_ptr<GattPnP_ID> pnpID;
- GattDeviceInformationSvc(const POctets &systemID, const std::string &modelNumber, const std::string &serialNumber,
- const std::string &firmwareRevision, const std::string &hardwareRevision, const std::string &softwareRevision,
- const std::string &manufacturer, const POctets &regulatoryCertDataList, const std::shared_ptr<GattPnP_ID> &pnpID) noexcept
- : systemID(systemID), modelNumber(modelNumber), serialNumber(serialNumber), firmwareRevision(firmwareRevision),
- hardwareRevision(hardwareRevision), softwareRevision(softwareRevision), manufacturer(manufacturer),
- regulatoryCertDataList(regulatoryCertDataList), pnpID(pnpID) {}
+ GattDeviceInformationSvc(const POctets &systemID_, const std::string &modelNumber_, const std::string &serialNumber_,
+ const std::string &firmwareRevision_, const std::string &hardwareRevision_, const std::string &softwareRevision_,
+ const std::string &manufacturer_, const POctets &regulatoryCertDataList_, const std::shared_ptr<GattPnP_ID> &pnpID_) noexcept
+ : systemID(systemID_), modelNumber(modelNumber_), serialNumber(serialNumber_), firmwareRevision(firmwareRevision_),
+ hardwareRevision(hardwareRevision_), softwareRevision(softwareRevision_), manufacturer(manufacturer_),
+ regulatoryCertDataList(regulatoryCertDataList_), pnpID(pnpID_) {}
std::string toString() const noexcept;
};
@@ -376,9 +376,9 @@ class GattTemperatureMeasurement {
return get(o);
}
- GattTemperatureMeasurement(const uint8_t flags, const float temperatureValue,
- const ieee11073::AbsoluteTime &timestamp, const uint8_t temperature_type) noexcept
- : flags(flags), temperatureValue(temperatureValue), timestamp(timestamp), temperature_type(temperature_type) {}
+ GattTemperatureMeasurement(const uint8_t flags_, const float temperatureValue_,
+ const ieee11073::AbsoluteTime &timestamp_, const uint8_t temperature_type_) noexcept
+ : flags(flags_), temperatureValue(temperatureValue_), timestamp(timestamp_), temperature_type(temperature_type_) {}
bool isFahrenheit() const noexcept { return 0 != ( flags & Bits::IS_TEMP_FAHRENHEIT ); }
bool hasTimestamp() const noexcept { return 0 != ( flags & Bits::HAS_TIMESTAMP ); }
diff --git a/api/direct_bt/GATTService.hpp b/api/direct_bt/GATTService.hpp
index f652ac5c..f8ebe465 100644
--- a/api/direct_bt/GATTService.hpp
+++ b/api/direct_bt/GATTService.hpp
@@ -96,9 +96,9 @@ namespace direct_bt {
/** List of Characteristic Declarations as shared reference */
std::vector<GATTCharacteristicRef> characteristicList;
- GATTService(const std::shared_ptr<GATTHandler> &handler, const bool isPrimary,
- const uint16_t startHandle, const uint16_t endHandle, std::shared_ptr<const uuid_t> type) noexcept
- : wbr_handler(handler), isPrimary(isPrimary), startHandle(startHandle), endHandle(endHandle), type(type), characteristicList() {
+ GATTService(const std::shared_ptr<GATTHandler> &handler_, const bool isPrimary_,
+ const uint16_t startHandle_, const uint16_t endHandle_, std::shared_ptr<const uuid_t> type_) noexcept
+ : wbr_handler(handler_), isPrimary(isPrimary_), startHandle(startHandle_), endHandle(endHandle_), type(type_), characteristicList() {
characteristicList.reserve(10);
}
diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp
index e2879f24..a2151d7f 100644
--- a/api/direct_bt/HCIHandler.hpp
+++ b/api/direct_bt/HCIHandler.hpp
@@ -62,8 +62,8 @@ namespace direct_bt {
uint16_t handle; // mutable
public:
- HCIConnection(const EUI48 &address, const BDAddressType addressType, const uint16_t handle)
- : address(address), addressType(addressType), handle(handle) {}
+ HCIConnection(const EUI48 &address_, const BDAddressType addressType_, const uint16_t handle_)
+ : address(address_), addressType(addressType_), handle(handle_) {}
HCIConnection(const HCIConnection &o) = default;
HCIConnection(HCIConnection &&o) = default;
diff --git a/api/direct_bt/UUID.hpp b/api/direct_bt/UUID.hpp
index b96eeac9..02adb1e7 100644
--- a/api/direct_bt/UUID.hpp
+++ b/api/direct_bt/UUID.hpp
@@ -63,7 +63,7 @@ private:
TypeSize type;
protected:
- uuid_t(TypeSize const type) : type(type) {}
+ uuid_t(TypeSize const type_) : type(type_) {}
public:
static TypeSize toTypeSize(const int size);
diff --git a/java/jni/BluetoothFactory.cxx b/java/jni/BluetoothFactory.cxx
index b8f4520c..bd5dfa3f 100644
--- a/java/jni/BluetoothFactory.cxx
+++ b/java/jni/BluetoothFactory.cxx
@@ -44,13 +44,13 @@ jstring Java_org_tinyb_BluetoothFactory_getNativeAPIVersion(JNIEnv *env, jclass
return nullptr;
}
-void Java_org_tinyb_BluetoothFactory_setenv(JNIEnv *env, jclass clazz, jstring jname, jstring jvalue, jboolean overwrite)
+void Java_org_tinyb_BluetoothFactory_setenv(JNIEnv *env, jclass clazz, jstring jname, jstring jval, jboolean overwrite)
{
try {
(void) clazz;
std::string name = from_jstring_to_string(env, jname);
- std::string value = from_jstring_to_string(env, jvalue);
+ std::string value = from_jstring_to_string(env, jval);
if( name.length() > 0 ) {
if( value.length() > 0 ) {
setenv(name.c_str(), value.c_str(), overwrite);
diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx
index 54c7aab0..f0ee5f4e 100644
--- a/java/jni/direct_bt/DBTDevice.cxx
+++ b/java/jni/direct_bt/DBTDevice.cxx
@@ -67,8 +67,8 @@ class JNICharacteristicListener : public GATTCharacteristicListener {
public:
- JNICharacteristicListener(JNIEnv *env, DBTDevice *device, jobject listener, GATTCharacteristic * associatedCharacteristicRef)
- : associatedCharacteristicRef(associatedCharacteristicRef),
+ JNICharacteristicListener(JNIEnv *env, DBTDevice *device, jobject listener, GATTCharacteristic * associatedCharacteristicRef_)
+ : associatedCharacteristicRef(associatedCharacteristicRef_),
listenerObj(listener)
{
jclass listenerClazz = search_class(env, listenerObj.getObject());
@@ -77,9 +77,9 @@ class JNICharacteristicListener : public GATTCharacteristicListener {
throw InternalError("CharacteristicListener not found", E_FILE_LINE);
}
- if( nullptr != associatedCharacteristicRef ) {
- JavaGlobalObj::check(associatedCharacteristicRef->getJavaObject(), E_FILE_LINE);
- associatedCharacteristicObj = JavaGlobalObj::GetJavaObject(associatedCharacteristicRef->getJavaObject()); // new global ref
+ if( nullptr != associatedCharacteristicRef_ ) {
+ JavaGlobalObj::check(associatedCharacteristicRef_->getJavaObject(), E_FILE_LINE);
+ associatedCharacteristicObj = JavaGlobalObj::GetJavaObject(associatedCharacteristicRef_->getJavaObject()); // new global ref
}
mNotificationReceived = search_method(env, listenerClazz, "notificationReceived", _notificationReceivedMethodArgs.c_str(), false);
@@ -108,14 +108,14 @@ class JNICharacteristicListener : public GATTCharacteristicListener {
jobject jCharDecl = JavaGlobalObj::GetObject(charDecl->getJavaObject());
const size_t value_size = charValue->getSize();
- jbyteArray jvalue = env->NewByteArray((jsize)value_size);
- env->SetByteArrayRegion(jvalue, 0, (jsize)value_size, (const jbyte *)charValue->get_ptr());
+ jbyteArray jval = env->NewByteArray((jsize)value_size);
+ env->SetByteArrayRegion(jval, 0, (jsize)value_size, (const jbyte *)charValue->get_ptr());
java_exception_check_and_throw(env, E_FILE_LINE);
env->CallVoidMethod(listenerObj.getObject(), mNotificationReceived,
- jCharDecl, jvalue, (jlong)timestamp);
+ jCharDecl, jval, (jlong)timestamp);
java_exception_check_and_throw(env, E_FILE_LINE);
- env->DeleteLocalRef(jvalue);
+ env->DeleteLocalRef(jval);
}
void indicationReceived(GATTCharacteristicRef charDecl,
@@ -126,14 +126,14 @@ class JNICharacteristicListener : public GATTCharacteristicListener {
jobject jCharDecl = JavaGlobalObj::GetObject(charDecl->getJavaObject());
const size_t value_size = charValue->getSize();
- jbyteArray jvalue = env->NewByteArray((jsize)value_size);
- env->SetByteArrayRegion(jvalue, 0, (jsize)value_size, (const jbyte *)charValue->get_ptr());
+ jbyteArray jval = env->NewByteArray((jsize)value_size);
+ env->SetByteArrayRegion(jval, 0, (jsize)value_size, (const jbyte *)charValue->get_ptr());
java_exception_check_and_throw(env, E_FILE_LINE);
env->CallVoidMethod(listenerObj.getObject(), mIndicationReceived,
- jCharDecl, jvalue, (jlong)timestamp, (jboolean)confirmationSent);
+ jCharDecl, jval, (jlong)timestamp, (jboolean)confirmationSent);
java_exception_check_and_throw(env, E_FILE_LINE);
- env->DeleteLocalRef(jvalue);
+ env->DeleteLocalRef(jval);
}
};
@@ -456,25 +456,25 @@ jobject Java_direct_1bt_tinyb_DBTDevice_getServicesImpl(JNIEnv *env, jobject obj
// final String type_uuid, final short handleStart, final short handleEnd)
std::function<jobject(JNIEnv*, jclass, jmethodID, GATTService*)> ctor_service =
- [](JNIEnv *env, jclass clazz, jmethodID clazz_ctor, GATTService *service)->jobject {
+ [](JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, GATTService *service)->jobject {
// prepare adapter ctor
- std::shared_ptr<DBTDevice> device = service->getDeviceChecked();
- JavaGlobalObj::check(device->getJavaObject(), E_FILE_LINE);
- jobject jdevice = JavaGlobalObj::GetObject(device->getJavaObject());
+ std::shared_ptr<DBTDevice> _device = service->getDeviceChecked();
+ JavaGlobalObj::check(_device->getJavaObject(), E_FILE_LINE);
+ jobject jdevice = JavaGlobalObj::GetObject(_device->getJavaObject());
const jboolean isPrimary = service->isPrimary;
- const jstring juuid = from_string_to_jstring(env,
+ const jstring juuid = from_string_to_jstring(env_,
directBTJNISettings.getUnifyUUID128Bit() ? service->type->toUUID128String() :
service->type->toString());
- java_exception_check_and_throw(env, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
- jobject jservice = env->NewObject(clazz, clazz_ctor, (jlong)service, jdevice, isPrimary,
+ jobject jservice = env_->NewObject(clazz, clazz_ctor, (jlong)service, jdevice, isPrimary,
juuid, service->startHandle, service->endHandle);
- java_exception_check_and_throw(env, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
JNIGlobalRef::check(jservice, E_FILE_LINE);
std::shared_ptr<JavaAnon> jServiceRef = service->getJavaObject(); // GlobalRef
JavaGlobalObj::check(jServiceRef, E_FILE_LINE);
- env->DeleteLocalRef(juuid);
- env->DeleteLocalRef(jservice);
+ env_->DeleteLocalRef(juuid);
+ env_->DeleteLocalRef(jservice);
return JavaGlobalObj::GetObject(jServiceRef);
};
return convert_vector_sharedptr_to_jarraylist<GATTService>(env, services, _serviceClazzCtorArgs.c_str(), ctor_service);
diff --git a/java/jni/direct_bt/DBTGattCharacteristic.cxx b/java/jni/direct_bt/DBTGattCharacteristic.cxx
index d166a77d..70a19051 100644
--- a/java/jni/direct_bt/DBTGattCharacteristic.cxx
+++ b/java/jni/direct_bt/DBTGattCharacteristic.cxx
@@ -74,31 +74,31 @@ jobject Java_direct_1bt_tinyb_DBTGattCharacteristic_getDescriptorsImpl(JNIEnv *e
// final String type_uuid, final short handle, final byte[] value)
std::function<jobject(JNIEnv*, jclass, jmethodID, GATTDescriptor *)> ctor_desc =
- [](JNIEnv *env, jclass clazz, jmethodID clazz_ctor, GATTDescriptor *descriptor)->jobject {
+ [](JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, GATTDescriptor *descriptor)->jobject {
// prepare adapter ctor
- std::shared_ptr<GATTCharacteristic> characteristic = descriptor->getCharacteristicChecked();
- JavaGlobalObj::check(characteristic->getJavaObject(), E_FILE_LINE);
- jobject jcharacteristic = JavaGlobalObj::GetObject(characteristic->getJavaObject());
+ std::shared_ptr<GATTCharacteristic> _characteristic = descriptor->getCharacteristicChecked();
+ JavaGlobalObj::check(_characteristic->getJavaObject(), E_FILE_LINE);
+ jobject jcharacteristic = JavaGlobalObj::GetObject(_characteristic->getJavaObject());
- const jstring juuid = from_string_to_jstring(env,
+ const jstring juuid = from_string_to_jstring(env_,
directBTJNISettings.getUnifyUUID128Bit() ? descriptor->type->toUUID128String() :
descriptor->type->toString());
- java_exception_check_and_throw(env, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
const size_t value_size = descriptor->value.getSize();
- jbyteArray jvalue = env->NewByteArray((jsize)value_size);
- env->SetByteArrayRegion(jvalue, 0, (jsize)value_size, (const jbyte *)descriptor->value.get_ptr());
- java_exception_check_and_throw(env, E_FILE_LINE);
+ jbyteArray jval = env_->NewByteArray((jsize)value_size);
+ env_->SetByteArrayRegion(jval, 0, (jsize)value_size, (const jbyte *)descriptor->value.get_ptr());
+ java_exception_check_and_throw(env_, E_FILE_LINE);
- jobject jdesc = env->NewObject(clazz, clazz_ctor, (jlong)descriptor, jcharacteristic,
- juuid, (jshort)descriptor->handle, jvalue);
- java_exception_check_and_throw(env, E_FILE_LINE);
+ jobject jdesc = env_->NewObject(clazz, clazz_ctor, (jlong)descriptor, jcharacteristic,
+ juuid, (jshort)descriptor->handle, jval);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
JNIGlobalRef::check(jdesc, E_FILE_LINE);
std::shared_ptr<JavaAnon> jDescRef = descriptor->getJavaObject(); // GlobalRef
JavaGlobalObj::check(jDescRef, E_FILE_LINE);
- env->DeleteLocalRef(juuid);
- env->DeleteLocalRef(jvalue);
- env->DeleteLocalRef(jdesc);
+ env_->DeleteLocalRef(juuid);
+ env_->DeleteLocalRef(jval);
+ env_->DeleteLocalRef(jdesc);
return JavaGlobalObj::GetObject(jDescRef);
};
return convert_vector_sharedptr_to_jarraylist<GATTDescriptor>(env, descriptorList, _descriptorClazzCtorArgs.c_str(), ctor_desc);
@@ -131,12 +131,12 @@ jbyteArray Java_direct_1bt_tinyb_DBTGattCharacteristic_readValueImpl(JNIEnv *env
return nullptr;
}
-jboolean Java_direct_1bt_tinyb_DBTGattCharacteristic_writeValueImpl(JNIEnv *env, jobject obj, jbyteArray jvalue, jboolean withResponse) {
+jboolean Java_direct_1bt_tinyb_DBTGattCharacteristic_writeValueImpl(JNIEnv *env, jobject obj, jbyteArray jval, jboolean withResponse) {
try {
- if( nullptr == jvalue ) {
+ if( nullptr == jval ) {
throw IllegalArgumentException("byte array null", E_FILE_LINE);
}
- const int value_size = env->GetArrayLength(jvalue);
+ const int value_size = env->GetArrayLength(jval);
if( 0 == value_size ) {
return JNI_TRUE;
}
@@ -144,7 +144,7 @@ jboolean Java_direct_1bt_tinyb_DBTGattCharacteristic_writeValueImpl(JNIEnv *env,
JavaGlobalObj::check(characteristic->getJavaObject(), E_FILE_LINE);
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
- uint8_t * value_ptr = criticalArray.get(jvalue, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
+ uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
if( NULL == value_ptr ) {
throw InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
diff --git a/java/jni/direct_bt/DBTGattDescriptor.cxx b/java/jni/direct_bt/DBTGattDescriptor.cxx
index 615ba60d..c8d557bc 100644
--- a/java/jni/direct_bt/DBTGattDescriptor.cxx
+++ b/java/jni/direct_bt/DBTGattDescriptor.cxx
@@ -80,12 +80,12 @@ jbyteArray Java_direct_1bt_tinyb_DBTGattDescriptor_readValueImpl(JNIEnv *env, jo
return nullptr;
}
-jboolean Java_direct_1bt_tinyb_DBTGattDescriptor_writeValueImpl(JNIEnv *env, jobject obj, jbyteArray jvalue) {
+jboolean Java_direct_1bt_tinyb_DBTGattDescriptor_writeValueImpl(JNIEnv *env, jobject obj, jbyteArray jval) {
try {
- if( nullptr == jvalue ) {
+ if( nullptr == jval ) {
throw IllegalArgumentException("byte array null", E_FILE_LINE);
}
- const int value_size = env->GetArrayLength(jvalue);
+ const size_t value_size = (size_t)env->GetArrayLength(jval);
if( 0 == value_size ) {
return JNI_TRUE;
}
@@ -93,7 +93,7 @@ jboolean Java_direct_1bt_tinyb_DBTGattDescriptor_writeValueImpl(JNIEnv *env, job
JavaGlobalObj::check(descriptor->getJavaObject(), E_FILE_LINE);
JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release
- uint8_t * value_ptr = criticalArray.get(jvalue, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
+ uint8_t * value_ptr = criticalArray.get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
if( NULL == value_ptr ) {
throw InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE);
}
diff --git a/java/jni/direct_bt/DBTGattService.cxx b/java/jni/direct_bt/DBTGattService.cxx
index 24dbc20e..7b3690bf 100644
--- a/java/jni/direct_bt/DBTGattService.cxx
+++ b/java/jni/direct_bt/DBTGattService.cxx
@@ -76,46 +76,46 @@ jobject Java_direct_1bt_tinyb_DBTGattService_getCharacteristicsImpl(JNIEnv *env,
// final int clientCharacteristicsConfigIndex)
std::function<jobject(JNIEnv*, jclass, jmethodID, GATTCharacteristic *)> ctor_char =
- [](JNIEnv *env, jclass clazz, jmethodID clazz_ctor, GATTCharacteristic *characteristic)->jobject {
+ [](JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, GATTCharacteristic *characteristic)->jobject {
// prepare adapter ctor
- std::shared_ptr<GATTService> service = characteristic->getServiceChecked();
- JavaGlobalObj::check(service->getJavaObject(), E_FILE_LINE);
- jobject jservice = JavaGlobalObj::GetObject(service->getJavaObject());
+ std::shared_ptr<GATTService> _service = characteristic->getServiceChecked();
+ JavaGlobalObj::check(_service->getJavaObject(), E_FILE_LINE);
+ jobject jservice = JavaGlobalObj::GetObject(_service->getJavaObject());
std::vector<std::unique_ptr<std::string>> props = GATTCharacteristic::getPropertiesStringList(characteristic->properties);
- unsigned int props_size = props.size();
+ size_t props_size = props.size();
jobjectArray jproperties;
{
- jclass string_class = search_class(env, "java/lang/String");
- jproperties = env->NewObjectArray(props_size, string_class, 0);
- java_exception_check_and_throw(env, E_FILE_LINE);
- env->DeleteLocalRef(string_class);
+ jclass string_class = search_class(env_, "java/lang/String");
+ jproperties = env_->NewObjectArray((jsize)props_size, string_class, 0);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
+ env_->DeleteLocalRef(string_class);
}
- for (unsigned int i = 0; i < props_size; ++i) {
- jobject elem = from_string_to_jstring(env, *props[i].get());
- env->SetObjectArrayElement(jproperties, i, elem);
- env->DeleteLocalRef(elem);
+ for (size_t i = 0; i < props_size; ++i) {
+ jobject elem = from_string_to_jstring(env_, *props[i].get());
+ env_->SetObjectArrayElement(jproperties, (jsize)i, elem);
+ env_->DeleteLocalRef(elem);
}
- java_exception_check_and_throw(env, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
const bool hasNotify = characteristic->hasProperties(GATTCharacteristic::PropertyBitVal::Notify);
const bool hasIndicate = characteristic->hasProperties(GATTCharacteristic::PropertyBitVal::Indicate);
- const jstring uuid = from_string_to_jstring(env,
+ const jstring uuid = from_string_to_jstring(env_,
directBTJNISettings.getUnifyUUID128Bit() ? characteristic->value_type->toUUID128String() :
characteristic->value_type->toString());
- java_exception_check_and_throw(env, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
- jobject jchar = env->NewObject(clazz, clazz_ctor, (jlong)characteristic, jservice,
+ jobject jcharVal = env_->NewObject(clazz, clazz_ctor, (jlong)characteristic, jservice,
characteristic->handle, jproperties, hasNotify, hasIndicate,
uuid, characteristic->value_handle, characteristic->clientCharacteristicsConfigIndex);
- java_exception_check_and_throw(env, E_FILE_LINE);
- JNIGlobalRef::check(jchar, E_FILE_LINE);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
+ JNIGlobalRef::check(jcharVal, E_FILE_LINE);
std::shared_ptr<JavaAnon> jCharRef = characteristic->getJavaObject(); // GlobalRef
JavaGlobalObj::check(jCharRef, E_FILE_LINE);
- env->DeleteLocalRef(jproperties);
- env->DeleteLocalRef(jchar);
+ env_->DeleteLocalRef(jproperties);
+ env_->DeleteLocalRef(jcharVal);
return JavaGlobalObj::GetObject(jCharRef);
};
return convert_vector_sharedptr_to_jarraylist<GATTCharacteristic>(env, characteristics, _characteristicClazzCtorArgs.c_str(), ctor_char);
diff --git a/java/jni/direct_bt/DBTManager.cxx b/java/jni/direct_bt/DBTManager.cxx
index f113848c..8734b9f3 100644
--- a/java/jni/direct_bt/DBTManager.cxx
+++ b/java/jni/direct_bt/DBTManager.cxx
@@ -92,19 +92,19 @@ jobject Java_direct_1bt_tinyb_DBTManager_getAdapterListImpl(JNIEnv *env, jobject
adapters.push_back(std::move(adapter));
}
std::function<jobject(JNIEnv*, jclass, jmethodID, DBTAdapter*)> ctor_adapter =
- [](JNIEnv *env, jclass clazz, jmethodID clazz_ctor, DBTAdapter* adapter)->jobject {
+ [](JNIEnv *env_, jclass clazz, jmethodID clazz_ctor, DBTAdapter* adapter)->jobject {
// prepare adapter ctor
- const jstring addr = from_string_to_jstring(env, adapter->getAddressString());
- const jstring name = from_string_to_jstring(env, adapter->getName());
- java_exception_check_and_throw(env, E_FILE_LINE);
- jobject jAdapter = env->NewObject(clazz, clazz_ctor, (jlong)adapter, addr, name);
- java_exception_check_and_throw(env, E_FILE_LINE);
+ const jstring addr = from_string_to_jstring(env_, adapter->getAddressString());
+ const jstring name = from_string_to_jstring(env_, adapter->getName());
+ java_exception_check_and_throw(env_, E_FILE_LINE);
+ jobject jAdapter = env_->NewObject(clazz, clazz_ctor, (jlong)adapter, addr, name);
+ java_exception_check_and_throw(env_, E_FILE_LINE);
JNIGlobalRef::check(jAdapter, E_FILE_LINE);
std::shared_ptr<JavaAnon> jAdapterRef = adapter->getJavaObject(); // GlobalRef
JavaGlobalObj::check(jAdapterRef, E_FILE_LINE);
- env->DeleteLocalRef(addr);
- env->DeleteLocalRef(name);
- env->DeleteLocalRef(jAdapter);
+ env_->DeleteLocalRef(addr);
+ env_->DeleteLocalRef(name);
+ env_->DeleteLocalRef(jAdapter);
DBG_PRINT("Java_direct_1bt_tinyb_DBTManager_getAdapterListImpl: New Adapter %p %s", adapter, adapter->toString().c_str());
return JavaGlobalObj::GetObject(jAdapterRef);
diff --git a/src/direct_bt/BTTypes.cpp b/src/direct_bt/BTTypes.cpp
index 0b91d261..88b50032 100644
--- a/src/direct_bt/BTTypes.cpp
+++ b/src/direct_bt/BTTypes.cpp
@@ -370,12 +370,12 @@ static std::string bt_compidtostr(const uint16_t companyid) noexcept {
return std::to_string(companyid);
}
-ManufactureSpecificData::ManufactureSpecificData(uint16_t const company) noexcept
-: company(company), companyName(std::string(bt_compidtostr(company))), data(/* intentional zero sized */) {
+ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_) noexcept
+: company(company_), companyName(std::string(bt_compidtostr(company_))), data(/* intentional zero sized */) {
}
-ManufactureSpecificData::ManufactureSpecificData(uint16_t const company, uint8_t const * const data, int const data_len) noexcept
-: company(company), companyName(std::string(bt_compidtostr(company))), data(data, data_len) {
+ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_, uint8_t const * const data_, size_t const data_len) noexcept
+: company(company_), companyName(std::string(bt_compidtostr(company_))), data(data_, data_len) {
}
std::string ManufactureSpecificData::toString() const noexcept {
@@ -487,8 +487,8 @@ void EInfoReport::setManufactureSpecificData(uint16_t const company, uint8_t con
set(EIRDataType::MANUF_DATA);
}
-void EInfoReport::setDeviceID(const uint16_t source, const uint16_t vendor, const uint16_t product, const uint16_t version) noexcept {
- did_source = source;
+void EInfoReport::setDeviceID(const uint16_t source_, const uint16_t vendor, const uint16_t product, const uint16_t version) noexcept {
+ did_source = source_;
did_vendor = vendor;
did_product = product;
did_version = version;
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index 154a7366..b54ac3eb 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -718,10 +718,10 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringMgmt(std::shared_ptr<MgmtEvent> e) noexc
jau::for_each_cow(statusListenerList, [&](std::shared_ptr<AdapterStatusListener> &l) {
try {
l->discoveringChanged(*this, enabled, keepDiscoveringAlive, event.getTimestamp());
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventCB:DeviceDiscovering-CBs %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), toString().c_str(), e.what());
+ l->toString().c_str(), toString().c_str(), except.what());
}
i++;
});
@@ -897,10 +897,10 @@ bool DBTAdapter::mgmtEvDeviceConnectedHCI(std::shared_ptr<MgmtEvent> e) noexcept
l->deviceConnected(device, event.getHCIHandle(), event.getTimestamp());
}
}
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventHCI:DeviceConnected-CBs %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), device->toString().c_str(), e.what());
+ l->toString().c_str(), device->toString().c_str(), except.what());
}
i++;
});
@@ -927,10 +927,10 @@ bool DBTAdapter::mgmtEvConnectFailedHCI(std::shared_ptr<MgmtEvent> e) noexcept {
if( l->matchDevice(*device) ) {
l->deviceDisconnected(device, event.getHCIStatus(), handle, event.getTimestamp());
}
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventHCI:DeviceDisconnected-CBs %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), device->toString().c_str(), e.what());
+ l->toString().c_str(), device->toString().c_str(), except.what());
}
i++;
});
@@ -965,10 +965,10 @@ bool DBTAdapter::mgmtEvDeviceDisconnectedHCI(std::shared_ptr<MgmtEvent> e) noexc
if( l->matchDevice(*device) ) {
l->deviceDisconnected(device, event.getHCIReason(), event.getHCIHandle(), event.getTimestamp());
}
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventHCI:DeviceDisconnected-CBs %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), device->toString().c_str(), e.what());
+ l->toString().c_str(), device->toString().c_str(), except.what());
}
i++;
});
@@ -1038,10 +1038,10 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept {
if( l->matchDevice(*dev) ) {
l->deviceFound(dev, eir->getTimestamp());
}
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventCB:DeviceFound: %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), dev->toString().c_str(), e.what());
+ l->toString().c_str(), dev->toString().c_str(), except.what());
}
i++;
});
@@ -1066,10 +1066,10 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept {
if( l->matchDevice(*dev) ) {
l->deviceFound(dev, eir->getTimestamp());
}
- } catch (std::exception &e) {
+ } catch (std::exception &except) {
ERR_PRINT("DBTAdapter::EventCB:DeviceFound-CBs %d/%zd: %s of %s: Caught exception %s",
i+1, statusListenerList.size(),
- l->toString().c_str(), dev->toString().c_str(), e.what());
+ l->toString().c_str(), dev->toString().c_str(), except.what());
}
i++;
});
diff --git a/src/direct_bt/GATTHandler.cpp b/src/direct_bt/GATTHandler.cpp
index d881ca9f..bbc303ea 100644
--- a/src/direct_bt/GATTHandler.cpp
+++ b/src/direct_bt/GATTHandler.cpp
@@ -475,8 +475,8 @@ GATTCharacteristicRef GATTHandler::findCharacterisicsByValueHandle(const uint16_
return findCharacterisicsByValueHandle(charValueHandle, services);
}
-GATTCharacteristicRef GATTHandler::findCharacterisicsByValueHandle(const uint16_t charValueHandle, std::vector<GATTServiceRef> &services) noexcept {
- for(auto it = services.begin(); it != services.end(); it++) {
+GATTCharacteristicRef GATTHandler::findCharacterisicsByValueHandle(const uint16_t charValueHandle, std::vector<GATTServiceRef> &services_) noexcept {
+ for(auto it = services_.begin(); it != services_.end(); it++) {
GATTCharacteristicRef decl = findCharacterisicsByValueHandle(charValueHandle, *it);
if( nullptr != decl ) {
return decl;
diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp
index 9bdae951..2fe1bb05 100644
--- a/src/direct_bt/HCIHandler.cpp
+++ b/src/direct_bt/HCIHandler.cpp
@@ -432,15 +432,15 @@ exit:
return ev;
}
-HCIHandler::HCIHandler(const uint16_t dev_id, const BTMode btMode) noexcept
+HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept
: env(HCIEnv::get()),
- dev_id(dev_id),
+ dev_id(dev_id_),
rbuffer(HCI_MAX_MTU),
- comm(dev_id, HCI_CHANNEL_RAW),
+ comm(dev_id_, HCI_CHANNEL_RAW),
hciEventRing(env.HCI_EVT_RING_CAPACITY), hciReaderShallStop(false),
hciReaderThreadId(0), hciReaderRunning(false),
allowClose( comm.isOpen() ),
- btMode(btMode)
+ btMode(btMode_)
{
WORDY_PRINT("HCIHandler.ctor: pid %d", HCIHandler::pidSelf);
if( !allowClose ) {
diff --git a/src/direct_bt/L2CAPComm.cpp b/src/direct_bt/L2CAPComm.cpp
index 6e2514d1..ca83109e 100644
--- a/src/direct_bt/L2CAPComm.cpp
+++ b/src/direct_bt/L2CAPComm.cpp
@@ -105,10 +105,10 @@ int L2CAPComm::l2cap_close_dev(int dd)
// *************************************************
// *************************************************
-L2CAPComm::L2CAPComm(std::shared_ptr<DBTDevice> device, const uint16_t psm, const uint16_t cid)
+L2CAPComm::L2CAPComm(std::shared_ptr<DBTDevice> device_, const uint16_t psm_, const uint16_t cid_)
: env(L2CAPEnv::get()),
- device(device), deviceString(device->getAddressString()), psm(psm), cid(cid),
- socket_descriptor( l2cap_open_dev(device->getAdapter().getAddress(), psm, cid, true /* pubaddrAdptr */) ),
+ device(device_), deviceString(device_->getAddressString()), psm(psm_), cid(cid_),
+ socket_descriptor( l2cap_open_dev(device_->getAdapter().getAddress(), psm_, cid_, true /* pubaddrAdptr */) ),
is_connected(true), has_ioerror(false), interrupt_flag(false), tid_connect(0), tid_read(0)
{
/** BT Core Spec v5.2: Vol 3, Part A: L2CAP_CONNECTION_REQ */
@@ -117,7 +117,7 @@ L2CAPComm::L2CAPComm(std::shared_ptr<DBTDevice> device, const uint16_t psm, cons
int to_retry_count=0; // ETIMEDOUT retry count
DBG_PRINT("L2CAPComm::ctor: Start Connect: %s, dd %d, %s, psm %u, cid %u, pubDevice %d",
- getStateString().c_str(), socket_descriptor.load(), deviceString.c_str(), psm, cid, true);
+ getStateString().c_str(), socket_descriptor.load(), deviceString.c_str(), psm_, cid_, true);
if( 0 > socket_descriptor ) {
goto failure; // open failed
@@ -127,10 +127,10 @@ L2CAPComm::L2CAPComm(std::shared_ptr<DBTDevice> device, const uint16_t psm, cons
// actual request to connect to remote device
bzero((void *)&req, sizeof(req));
req.l2_family = AF_BLUETOOTH;
- req.l2_psm = jau::cpu_to_le(psm);
- req.l2_bdaddr = device->getAddress();
- req.l2_cid = jau::cpu_to_le(cid);
- req.l2_bdaddr_type = device->getAddressType();
+ req.l2_psm = jau::cpu_to_le(psm_);
+ req.l2_bdaddr = device_->getAddress();
+ req.l2_cid = jau::cpu_to_le(cid_);
+ req.l2_bdaddr_type = device_->getAddressType();
while( !interrupt_flag ) {
// blocking
diff --git a/src/direct_bt/UUID.cpp b/src/direct_bt/UUID.cpp
index 7252f02f..5b3a744c 100644
--- a/src/direct_bt/UUID.cpp
+++ b/src/direct_bt/UUID.cpp
@@ -176,7 +176,6 @@ uuid128_t::uuid128_t(const std::string str)
std::string msg("UUID128 string not in format '00000000-0000-1000-8000-00805F9B34FB' but "+str);
throw jau::IllegalArgumentException(msg, E_FILE_LINE);
}
- jau::uint128_t value;
// sscanf provided host data type, in which we store the values,
// hence no endian conversion