BTL2CAP implementation
Logical Link Control and Adaptation Protocol (L2CAP) implementation for Bluetooth.
The native porting API for L2CAP protocol is collected in btL2CAPSocket.h file.
This API has GNU sockets style but could be used for other non-sockets underlying Bluetooth implementations too.
There are two entities in the API: client connection and server connection.
Some functions can be applied only for dedicated entity but other functions are common.
Native connection handles stored in fields of the L2CAPConnectionImpl and
L2CAPNotifierImpl Java classes are accessed only from native code to avoid race conditions.
All KNI-oriented code is located in these two files and
the porting layer is used to call native platform-specific connection methods.
There are no global native variables except jfieldID variables
that are set once by static initializers and can be safely used by multiple isolates.
Native finalizers are used to release all native resources used by connections.
The following environment variables are used by JSR 82 build system:
USE_JSR_82 turns on JSR 82 building process in
phoneME project build system.
JSR_82_DIR specifies path to JSR 82 workspace.
USE_JSR_82_EMULATOR switchs between real mode and emulation mode.
For files with .jpp extension Java pre-processor is called to generate emulator
or real mode specific code depending on the value of USE_JSR_82_EMULATOR environment variable.
The following romizer tunings in jsr82_rom.config are done:
- Renaming is disabled for the fields accessed via
KNI_GetFieldID .
- Renaming is disabled for the classes that are instantiated via
Class.forName() .
- Internal packages are made hidden.
Non-romized code is prevented from accessing even public methods/fields of classes in these packages.
- Public JSR API are restricted. Non-romized code cannot load new classes into them.
This stack has own technology to manipulate properties.
It uses .xml configuration files for this purpose.
So the properties were moved to dedicated configurator files.
Three configuration files were created: common , emul and linux .
Currently own trace system is used for debugging.
Later it could be replaced using common logging system.
Current trace system is located in btMacros.h .
The following macros are declared:
PRINT_INFO , PRINT_ERROR and EXCEPTION_MSG .
It's possible independently to swith on/off each of them.
For instance, it a good approach to switch on EXCEPTION_MSG macro
during developing to cache problems easier but switch it off in release to reduce code footprint.
TCK and JDTS test frameworks could be used to test the implementation.
The following permissions need to be enabled in JDTS:
Connector.comm , Connector.bluetooth.client , Connector.bluetooth.server .
|