1 Bluetooth-Frwk-NG - BlueZ framework new generation
2 **************************************************
5 Copyright (C) 2013-2014 Intel Corporation
10 The overall goal of the Bluetooth-Frwm-NG project is to provide a bluetooth
11 framework for embedded/mobile and desktop systems based on Linux.
13 Within Bluetooth-Frwk-NG there is clear abstraction between the application
14 interfaces based on CAPI, the lower level (via D-Bus) and the integration with
15 other system components (plugins). The whole architecture is modular and
20 Application System-Message-Dialog
25 CAPI-Bluetooth +---------+ Bluetooth-Service
29 +-----bluez-lib/obex-lib------+
36 CAPI-Bluetooth provide a series of API based on BlueZ's features, and it's
37 easy to use through bluez-lib/obex-lib that encapsulate D-Bus interfaces about
38 BlueZ. All applications use CAPI-Bluetooth to call BlueZ's function. Mostly
39 APIs directly use bluez-lib/obex-lib to call BlueZ, but others call
40 Bluetooth-Service that also using bluez-lib/obex-lib to access BlueZ, because
41 some features should be keeping during the calling procedure, such as send
42 file through Obex. System-Message-Dialog show the extern message, such as
43 input-pincode, using plugin to walk up it.
45 Develop Mode (on PC) and Runing Mode (on target):
47 Bluetooth-Frwk-NG can be developed on PC and running on other system (such as
48 mobile). Develop, run and test it on PC. Once the feature's development is
49 finished, porting it to other system is easy using cross-compile, that means
50 compile it on the target (such as mobile) environment. Package it to RPM,
51 then push the RPM package to target machine, install the RPM on target
54 Compilation and installation
55 ============================
57 In order to compile Bluetooth-Frwk-NG you need following software packages:
63 - gio-unix-2.0 library
67 To compile and install:
68 cmake . && make && make install
70 The files are installed to right position. Goto 'Running and Test'
71 section to test the development feature.
73 Running Mode (on Target):
75 After test feature on PC, it can be ported to target. Pakaging RPM
78 Firstly build the target environment. Build cap-network-bluetooth
79 project that download from source code repo, using building tool
80 (such as gbs) with local that will create a local-target-environment.
81 With gbs it like this:
82 ~/GBS-ROOT/local/BUILD-ROOTS/scratch.i586.0/home/abuild/
83 named ${TARGET_ENVIRONMENT_DIR}
85 Secondly package cap-network-bluetooth-${version}.tar.gz from source
86 code, then push the tarball and .spec file in packaing dir in source
87 code to $(TARGET_ENVIRONMENT_DIR)/rpmbuild/SOURCES/
89 ${version}: project version, for example 0.1.39
91 To switch to target environment:
92 cd ${TARGET_ENVIRONMENT_DIR}
95 Now, in the target environment, compile and package RPM are all with
96 target (such as mobile).
99 rpmbuild -ba packaging/capi-network-bluetooth.spec
101 The step will create capi-network-bluetooth-0.1.39-1.i586.rpm in
102 $(TARGET_ENVIRONMENT_DIR)/rpmbuild/RPM/i586/
104 Push it to target and login target machine.
106 To install on target (such as mobile):
107 rpm -ivh capi-network-bluetooth-0.1.39-1.i586.rpm
112 In order to run and test you should compile the whole project and install them.
116 To test API (select one to test the corresponding API):
118 +-----------------------+---------------------------------------------------------------+
119 | test case | API & Interface | File name |
120 +-----------------------+-------------------------------+-------------------------------+
121 | bluez-capi-test | CAPI-Bluetooth API | include/bluetooth.h |
122 +-----------------------+-------------------------------+-------------------------------+
123 | bluez-lib-test | bluez-lib Interface | include/bluez.h |
124 +-----------------------+-------------------------------+-------------------------------+
125 | obex-lib-test | obex-lib Interface | include/obex.h |
126 +-----------------------+-------------------------------+-------------------------------+
127 | bt-serivce-lib-test | Bluetooth-Service Interface | include/bluetooth-service.h |
128 +-----------------------+-------------------------------+-------------------------------+
131 Development for Bluetooth-Frwk-NG
132 =================================
134 Develop Bluetooth-Frwk-NG on Linux and test it. See:
135 Compilation and installation==>Develop Mode (on PC)
137 Finally port it to target (such as mobile). See:
138 Compilation and installation==>Running Mode (on Target):
140 - Develop feature on PC
141 - Compile project on PC
142 - Run binary and Test on PC
143 - Port it to target and test.
145 Once those are finished, you can submit the patch to project owner:
146 - git add [modified files]
148 - git format-patch <util>..<since>
149 - checkpatch.pl [patch] --no-tree
150 - git send-email [patch] --to=martin.xu@linux.intel.com
151 --cc=<cc name> --from=your_email_addres
153 checkpatch.pl: download from kernel souce code checking patch.
155 Development apps basing on Bluetooth-Frwk-NG
156 ============================================
158 All APIs are contained in include/bluetooth.h. Applications must use those API
159 to finish the application's function. Most APIs have the returned value with
160 bt_error_e, so all the API that has returned value, should be checked.
162 bt_initialize() should be invoked before all other APIs to initialize Bluetooth
163 Framework, and bt_deinitialize() should be invoked after all other APIs to free
164 resouce with Bluetooth Framework.
166 Flowing is a simple application example:
171 #include "bluetooth.h"
176 int main(int argc, char **argv)
180 #if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
184 loop = g_main_loop_new(NULL, FALSE);
186 ret = bt_initialize();
187 if (ret != BT_SUCCESS) {
188 printf("initialize bluetooth framework failed %d", ret);
192 ret = bt_adapter_enable();
193 if (ret != BT_SUCCESS) {
194 printf("enable bluetooth adapter failed %d", ret);
198 printf("enable bluetooth adapter success");
200 g_main_loop_run(loop);
208 For additional information, contact:
211 jiangbox.wu@intel.com