summaryrefslogtreecommitdiffstats
path: root/java/jni/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-04 04:11:12 +0200
committerSven Gothel <[email protected]>2020-06-04 04:11:12 +0200
commit73f5b4fc21d7a14aa174f2c48657ca3f2229dda1 (patch)
tree1b455d3e699600eb9f0c1ccc09d10ffd8052929b /java/jni/direct_bt
parent1c449ba2a4cede1e942ff9df181bf96a408d2c67 (diff)
Introduce HCITypes + HCIHandler: Providing C++ basics for full HCI support; Misc..
Introduce HCITypes + HCIHandler: Providing C++ basics for full HCI support ============================================================================ - HCITypes defines the HCI command and event data structures, similar to MgmtTypes and ATTPDUTypes. For more coding efficiency we use template command and event classes, allowing to reuse the HCIIoctl struct types being wrapped in the C++ classes for flow and lifecycle control. HCITypes further includes all essential 'enum class' command opcodes, event types etc, ensuring type safety. - HCIHandler defines the command/event workflow similar to GATTHandler and DBTManager. One HCIHandler per DBTAdapter is being used, each HCIHandler using its event reader thread and ringbuffer. Socket event filtering and manual le-meta filtering ensures reduced workload (DoS safety). Similar to HCITypes, we use template function to utilize the template command and event classes, reuising the HCIIoctl struct types... HCIHandler can be extended for more functionality as well as used to implement our own DBTManager, i.e. Reducing HCIEvents to MgmtEvents with callback support. At least this is a viable option now, if so desired (non-linux, etc). - HCIComm: Contains the core I/O functionality only, dropped all semantic HCI code. The latter resides in HCIHandler now. - DBTAdapter now uses HCIHander instead of HCIComm, renamed field to simply 'hci' Misc.. ======= - reduced all ringbuffer capacity to 128 from 256 - Moved Mgmt*EventCallback from DBTManager to MgmtTypes, as we might want to reuse the MgmtTypes incl callbacks for alternative DBTManager implementations. - Added 'enum class' to underlying number type conversion pattern: <NumberType> number('enum class type') Avoiding the many static_cast<NumberType>(..) directives. - align all Type -> String method names: 'get<Type>String(Type)' - BasicTypes: Add safe uint32_t bitfield mask helper
Diffstat (limited to 'java/jni/direct_bt')
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index 8da84686..f4d0a21d 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -616,9 +616,9 @@ jobject Java_direct_1bt_tinyb_DBTAdapter_connectDevice(JNIEnv *env, jobject obj,
device->toString().c_str());
}
- std::shared_ptr<direct_bt::HCIComm> hci = adapter->openHCI();
+ std::shared_ptr<direct_bt::HCIHandler> hci = adapter->openHCI();
if( nullptr == hci ) {
- throw BluetoothException("Couldn't get or open adapter's HCIComm "+adapter->toString(), E_FILE_LINE);
+ throw BluetoothException("Couldn't get or open adapter's HCI "+adapter->toString(), E_FILE_LINE);
}
std::shared_ptr<JavaAnonObj> jDeviceRef = device->getJavaObject();
JavaGlobalObj::check(jDeviceRef, E_FILE_LINE);