4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
bluedroid.cpp File Reference

(This file was last changed: 2015-04-20 15:28:19 +0200, by Jacob Andersen)

Android PAL bluetooth implementation using the Bluedroid stack. More...

#include "PAL/bluetooth.h"
#include "PAL/android.h"
#include "FSYS/log.h"
#include "FSYS/basemsg.h"
#include "FSYS/msgaddr.h"
#include "FSYS/msgreceiver.h"
#include "FSYS/msgsender.h"
#include <cassert>
#include <condition_variable>
#include <jni.h>
#include <map>
#include <mutex>
#include <queue>
#include <set>
#include <string>
#include <thread>
#include <typeinfo>
#include <memory>
#include <utility>
#include <vector>
+ Include dependency graph for bluedroid.cpp:

Classes

class  anonymous_namespace{bluedroid.cpp}::ConnectIndicationMsg
 
class  anonymous_namespace{bluedroid.cpp}::DisconnectIndicationMsg
 
class  anonymous_namespace{bluedroid.cpp}::ReceiveApduMsg
 
struct  anonymous_namespace{bluedroid.cpp}::DownstreamRequest
 
struct  anonymous_namespace{bluedroid.cpp}::InterruptRequest
 
struct  anonymous_namespace{bluedroid.cpp}::DatatypeRequest
 
struct  anonymous_namespace{bluedroid.cpp}::DisconnectRequest
 
struct  anonymous_namespace{bluedroid.cpp}::SendApduRequest
 
class  anonymous_namespace{bluedroid.cpp}::JniManager
 
class  anonymous_namespace{bluedroid.cpp}::PhysicalDevice
 
class  anonymous_namespace{bluedroid.cpp}::VirtualDevice
 
class  PAL::BluetoothModule::PrivateBluetoothModule
 

Namespaces

Functions

static void anonymous_namespace{bluedroid.cpp}::jniRegisterNatives (JNIEnv *env, jclass cls)
 
static void anonymous_namespace{bluedroid.cpp}::jniConnectIndication (JNIEnv *env, jobject thiz, jstring address, jchar datatype, jstring displayName, jstring serviceName, jstring mdepDescription)
 
static void anonymous_namespace{bluedroid.cpp}::jniDisconnectIndication (JNIEnv *env, jobject thiz, jstring address, jchar datatype, jint error)
 
static void anonymous_namespace{bluedroid.cpp}::jniMessageReceived (JNIEnv *env, jobject thiz, jstring address, jchar datatype, jbyteArray apdu, jboolean reliable)
 

Variables

static JniManager * anonymous_namespace{bluedroid.cpp}::jniMgr = nullptr
 
static bool anonymous_namespace{bluedroid.cpp}::jniNativesRegistered = false
 

Detailed Description

This file implements the bluetooth PAL module specified in bluetooth.h for the Android platform using the Bluedroid bluetooth stack. Communication with the Java-based stack goes through the Bluedroid.java class.

Currently, only Bluetooth classic is supported, but in the future, also Bluetooth LE (a.k.a. SMART) support should be covered by this implementation.

Note
This module will spawn threads to handle Java/JNI tasks and communication. One of these threads will be an FSYS::MsgSender, but none will be receivers; hence, none will be running a message dispatcher. This module will therefore be able to work in a single-dispatcher environment, where no thread_local storage is needed.
See also
Bluedroid.java
Author
Jacob Andersen, The Alexandra Institute.