summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-08-24 05:50:00 +0200
committerSven Gothel <[email protected]>2020-08-24 05:50:00 +0200
commitf9f54887a7d1db59e2ead858274bdaa89c82956c (patch)
tree70de5fcd869ec6d6338a0bf1c827c1f985c9eb7b /java
parent2c5ff9fe582b56889d7cfc0f26b82b501354c215 (diff)
Adapt to new DBG_PRINT(..) semantics, reduce verbosity, use specific macros for special cases (e.g. GATT_PRINT, ..)
Diffstat (limited to 'java')
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx13
-rw-r--r--java/jni/direct_bt/DBTNativeDownlink.cxx4
-rw-r--r--java/jni/helper_base.cxx7
3 files changed, 5 insertions, 19 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index 6e215d91..cecd63cf 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -233,10 +233,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
void adapterSettingsChanged(DBTAdapter const &a, const AdapterSetting oldmask, const AdapterSetting newmask,
const AdapterSetting changedmask, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter SETTINGS_CHANGED: %s -> %s, changed %s\n",
- direct_bt::getAdapterSettingsString(oldmask).c_str(),
- direct_bt::getAdapterSettingsString(newmask).c_str(),
- direct_bt::getAdapterSettingsString(changedmask).c_str());
(void)a;
jobject adapterSettingOld = env->NewObject(adapterSettingsClazzRef.getClass(), adapterSettingsClazzCtor, (jint)oldmask);
java_exception_check_and_throw(env, E_FILE_LINE);
@@ -257,7 +253,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
void discoveringChanged(DBTAdapter const &a, const bool enabled, const bool keepAlive, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter Device DISCOVERING: enabled %d, keepAlive %d: %s\n", enabled, keepAlive, a.toString().c_str());
(void)a;
env->CallVoidMethod(listenerObjRef.getObject(), mDiscoveringChanged, JavaGlobalObj::GetObject(adapterObjRef),
(jboolean)enabled, (jboolean)keepAlive, (jlong)timestamp);
@@ -266,7 +261,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
void deviceFound(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter Device FOUND__: %s\n", device->toString(true).c_str());
jobject jdevice;
std::shared_ptr<JavaAnonObj> jDeviceRef0 = device->getJavaObject();
if( JavaGlobalObj::isValid(jDeviceRef0) ) {
@@ -297,7 +291,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
void deviceUpdated(std::shared_ptr<DBTDevice> device, const EIRDataType updateMask, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter Device UPDATED: %s of %s\n", direct_bt::getEIRDataMaskString(updateMask).c_str(), device->toString(true).c_str());
std::shared_ptr<JavaAnonObj> jDeviceRef = device->getJavaObject();
JavaGlobalObj::check(jDeviceRef, E_FILE_LINE);
env->SetLongField(JavaGlobalObj::GetObject(jDeviceRef), deviceClazzTSLastUpdateField, (jlong)timestamp);
@@ -313,7 +306,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
void deviceConnected(std::shared_ptr<DBTDevice> device, const uint16_t handle, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter Device CONNECTED: %s\n", device->toString(true).c_str());
jobject jdevice;
std::shared_ptr<JavaAnonObj> jDeviceRef0 = device->getJavaObject();
@@ -349,8 +341,6 @@ class JNIAdapterStatusListener : public AdapterStatusListener {
}
void deviceDisconnected(std::shared_ptr<DBTDevice> device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
JNIEnv *env = *jni_env;
- DBG_PRINT("****** JNI Adapter Device DISCONNECTED: Reason 0x%X (%s): %s\n",
- static_cast<uint8_t>(reason), getHCIStatusCodeString(reason).c_str(), device->toString(true).c_str());
std::shared_ptr<JavaAnonObj> jDeviceRef = device->getJavaObject();
JavaGlobalObj::check(jDeviceRef, E_FILE_LINE);
@@ -401,14 +391,13 @@ jboolean Java_direct_1bt_tinyb_DBTAdapter_addStatusListener(JNIEnv *env, jobject
if( adapter->addStatusListener( l ) ) {
setInstance(env, statusListener, l.get());
- DBG_PRINT("JNIAdapterStatusListener::addStatusListener: OK: %s", l->toString().c_str());
return JNI_TRUE;
}
ERR_PRINT("JNIAdapterStatusListener::addStatusListener: FAILED: %s", l->toString().c_str());
} catch(...) {
rethrow_and_raise_java_exception(env);
}
- DBG_PRINT("JNIAdapterStatusListener::addStatusListener: FAILED XX");
+ ERR_PRINT("JNIAdapterStatusListener::addStatusListener: FAILED XX");
return JNI_FALSE;
}
diff --git a/java/jni/direct_bt/DBTNativeDownlink.cxx b/java/jni/direct_bt/DBTNativeDownlink.cxx
index 934bf0ca..4a9bc174 100644
--- a/java/jni/direct_bt/DBTNativeDownlink.cxx
+++ b/java/jni/direct_bt/DBTNativeDownlink.cxx
@@ -53,7 +53,7 @@ void Java_direct_1bt_tinyb_DBTNativeDownlink_initNativeJavaObject(JNIEnv *env, j
std::shared_ptr<JavaGlobalObj> jobjRef( new JavaGlobalObj(obj, mNotifyDeleted) );
javaUplink->setJavaObject( jobjRef );
JavaGlobalObj::check(javaUplink->getJavaObject(), E_FILE_LINE);
- DBG_PRINT("Java_direct_1bt_tinyb_DBTNativeDownlink_initNativeJavaObject %p -> %s", javaUplink, javaUplink->toString().c_str());
+ // DBG_PRINT("Java_direct_1bt_tinyb_DBTNativeDownlink_initNativeJavaObject %p -> %s", javaUplink, javaUplink->toString().c_str());
} catch(...) {
rethrow_and_raise_java_exception(env);
}
@@ -64,7 +64,7 @@ void Java_direct_1bt_tinyb_DBTNativeDownlink_deleteNativeJavaObject(JNIEnv *env,
(void)obj;
try {
JavaUplink *javaUplink = castInstance<JavaUplink>(nativeInstance);
- DBG_PRINT("Java_direct_1bt_tinyb_DBTNativeDownlink_deleteNativeJavaObject %p -> %s", javaUplink, javaUplink->toString().c_str());
+ // DBG_PRINT("Java_direct_1bt_tinyb_DBTNativeDownlink_deleteNativeJavaObject %p -> %s", javaUplink, javaUplink->toString().c_str());
javaUplink->setJavaObject(nullptr);
} catch(...) {
rethrow_and_raise_java_exception(env);
diff --git a/java/jni/helper_base.cxx b/java/jni/helper_base.cxx
index 33f12e08..de85ce2f 100644
--- a/java/jni/helper_base.cxx
+++ b/java/jni/helper_base.cxx
@@ -31,9 +31,6 @@
#include <stdexcept>
#include <vector>
-// #define VERBOSE_ON 1
-#include <dbt_debug.hpp>
-
#include "helper_base.hpp"
#define JAVA_MAIN_PACKAGE "org/tinyb"
@@ -281,7 +278,7 @@ bool java_exception_check(JNIEnv *env, const char* file, int line)
jthrowable e = env->ExceptionOccurred();
if( nullptr != e ) {
#if 1
- INFO_PRINT("Java exception occurred @ %s : %d and forwarded.", file, line);
+ fprintf(stderr, "Java exception occurred @ %s : %d and forwarded.", file, line); fflush(stderr);
// ExceptionDescribe prints an exception and a backtrace of the stack to a system error-reporting channel, such as stderr.
// The pending exception is cleared as a side-effect of calling this function. This is a convenience routine provided for debugging.
env->ExceptionDescribe();
@@ -297,7 +294,7 @@ void java_exception_check_and_throw(JNIEnv *env, const char* file, int line)
{
jthrowable e = env->ExceptionOccurred();
if( nullptr != e ) {
- ERR_PRINT("Java exception occurred @ %s : %d and forwarded.", file, line);
+ fprintf(stderr, "Java exception occurred @ %s : %d and forwarded.", file, line); fflush(stderr);
// ExceptionDescribe prints an exception and a backtrace of the stack to a system error-reporting channel, such as stderr.
// The pending exception is cleared as a side-effect of calling this function. This is a convenience routine provided for debugging.
env->ExceptionDescribe();