Site Tools


ble_for_linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
ble_for_linux [2015/08/10 22:41]
ossama [Requirements]
ble_for_linux [2015/08/10 22:44]
ossama
Line 18: Line 18:
  
 ===== Implementation ===== ===== Implementation =====
-The IoTivity BLE Transport for Linux implements the IoTivity Connectivity Abstraction (CA) transport adapter interface ​by registering a set of required functions with the CA layer. ​ The required functions include ''​CAInitializeLE()''​ as well as the fields ​in the ''​CAConnectivityHandler_t'' ​type found in the [[https://​git.iotivity.org/​cgit/​iotivity/​tree/​resource/​csdk/​connectivity/​inc/​caadapterinterface.h|resource/​csdk/​connectivity/​inc/​caadapterinterface.h]] header:+The IoTivity BLE Transport for Linux implements the IoTivity Connectivity Abstraction (CA) BLE transport adapter interface ​defined ​in type found in the [[https://​git.iotivity.org/​cgit/​iotivity/​tree/​resource/​csdk/​connectivity/​inc/​caleinterface.h|resource/​csdk/​connectivity/​inc/​caleinterface.h]] header:
  
-<code c> +...
-CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,​ +
-                          CANetworkPacketReceivedCallback reqRespCallback,​ +
-                          CANetworkChangeCallback netCallback,​ +
-                          ca_thread_pool_t handle); +
- +
-typedef struct +
-+
-    /** Start Transport specific functions*/​ +
-    CAAdapterStart startAdapter;​ +
- +
-    /** Listening Server function address*/ +
-    CAAdapterStartListeningServer startListenServer;​ +
- +
-    /** Discovery Server function address **/ +
-    CAAdapterStartDiscoveryServer startDiscoveryServer;​ +
- +
-    /** Unicast data function address**/​ +
-    CAAdapterSendUnicastData sendData; +
- +
-    /** Multicast data function address**/​ +
-    CAAdapterSendMulticastData sendDataToAll;​ +
- +
-    /** Get Networking information ​ **/ +
-    CAAdapterGetNetworkInfo GetnetInfo;​ +
- +
-    /** Read Data function address**/​ +
-    CAAdapterReadData readData; +
- +
-    /** Stop Transport specific functions*/​ +
-    CAAdapterStop stopAdapter;​ +
- +
-    /** Terminate function address stored in this pointer**/​ +
-    CAAdapterTerminate terminate;​ +
- +
-} CAConnectivityHandler_t;​ +
-</​code>​ +
- +
-==== CAInitializeLE() ==== +
- +
-The ''​CAInitializeLE()''​ function is called by the IoTivity Connectivity Abstraction adapter framework to configure CA transport adapters with several callback functions and the CA thread pool handle. +
- +
-  * CA adapter registration callback +
-    * The Linux BLE transport adapter functions that implement the CA adapter interface are registered with the CA framework through this callback. +
-  * CA request/​response callback +
-    * The request/​response callback is used to pass requests received by the BLE GATT server or responses received by the BLE GATT client up to to CA messaging layer +
-  * CA network changed callback +
-    * The network changed callback is used to inform the user of any changes to the state of local Bluetooth hardware adapters, i.e. if the Bluetooth hardware adapter has gone up or down.  +
-  * Thread pool handle +
-    * The thread pool handle may be used by adapters to add tasks (threads) to the pool.  The Linux BLE transport adapter adds such tasks to the thread pool when the transport adapter itself is started, and when the listening server (BLE peripheral) is started. ​ See the documentation for ''​CAAdapterStart()''​ and ''​CAAdapterStartListeningServer()''​ below for more details. +
-    * No tasks are added to the thread pool during the ''​CAInitializeLE()''​ call due to limitation in the CA termination code that destroys the thread pool before the transport adapters themselves are terminated. ​ That prevents tasks from being added to the thread pool during ''​CAInitializeLE()''​ since those tasks may not have completed before the thread pool is destroyed since the ''​pthread_join()''​ that is called during thread pool destruction will end up blocking indefinitely due to the event loops in the BLE thread pool tasks not being stopped. ​  +
-==== CAAdapterStart ==== +
- +
-==== CAAdapterStartListeningServer ==== +
- +
-==== CAAdapterStartListeningServer ==== +
- +
-==== CAAdapterSendUnicastData ==== +
- +
-==== CAAdapterSendMulticastData ==== +
- +
-==== CAAdapterGetNetworkInfo ==== +
- +
-==== CAAdapterReadData ==== +
- +
-==== CAAdapterStop ==== +
- +
-==== CAAdapterTerminate ====+
  
 ===== Testing ===== ===== Testing =====
  
  
ble_for_linux.txt · Last modified: 2016/07/13 08:47 by hudovisk