newton板已经发布了,下面接着整理我调试的一个小小的方面,蓝牙的功能实现以及测试:
转载请注明出处:http://blog.csdn.net/wang_zheng_kai
下面是我写的newton开发板中bluetooth阅读文档README的一部分。
主要是涉及到linux系统下,蓝牙各功能的测试:
197 6)Bluetooth pairing:agent -a hci0 0000 xx:xx:xx:xx:xx:xx
198
199 1>Match other Bluetooth devices
200
201 eg:
202
203 [root@Ingenic /]# agent -a hci0 0000 78:CA:04:81:74:6F
204 FPincode request for device /org/bluez/118/hci0/dev_78_CA_04_81_74_6F
205 Agent has been released
206
207 /*Note: 0000 is pin code,and 78:CA:04:81:74:6F is the MAC Address of target Bluetooth device.*/
208
209 2>matched by Other devices
210
211 /*
212 *Creat "pincodes" file under /usr/share/Bluetooth/var/lib/blutooth/xx:xx:xx:xx:xx:xx/,the contents are as follows: "yy:yy:yy:yy: yy:yy zzzz".then the device can be matched.
214 */
216 7)File transfer
217
218 1>Send the file
219
220 /*Note: Before the test, please get the Channel Number of target device's OPUSH(0x1105) service.*/
221
222 eg:
223
224 [root@Ingenic /]# sdptool browse 49:F2:1C:4E:66:12
225 Service Name: OBEX Object Push
226 Service RecHandle: 0x10019
227 Service Class ID List:
228 "OBEX Object Push" (0x1105)
229 Protocol Descriptor List:
230 "L2CAP" (0x0100)
231 "RFCOMM" (0x0003)
232 Channel: 4
233 "OBEX" (0x0008)
234
235 /*Note: We can known that the Channel Number of the OPUSH(0x1105) service that the device's MAC is "49:F2:1C:4E:66:12" is 4.*/
236
237 [root@Ingenic /]# obex_test -b 49:F2:1C:4E:66:12 4
238 Using Bluetooth RFCOMM transport
239 OBEX Interactive test client/server.
240
241 > c //connect
242
243 Connect OK!
244 Version: 0x10. Flags: 0x00
245
246 > x // Send the file
247
248 PUSH filename>123.wav // File name
249
250 >q //exit
251
252 2>Accept files
253
254 /*
255 *first,you need to add local OPUSH service please excute this command : sdptool add OPUSH
256 *and then get the Channel Number of local device's OPUSH(0x1105) service.
257 */
258
259 [root@Ingenic /opt]# sdptool add OPUSH
260 OBEX Object Push service registered
261
262 [root@Ingenic /]# sdptool browse local
263 Service Name: OBEX Object Push
264 Service RecHandle: 0x10019
265 Service Class ID List:
266 "OBEX Object Push" (0x1105)
267 Protocol Descriptor List:
268 "L2CAP" (0x0100)
269 "RFCOMM" (0x0003)
270 Channel: 9
271 "OBEX" (0x0008)
272
273 /*Note: You can known that the Channel Number of local device's OPUSH(0x1105) is 9.*/
274
275 [root@Ingenic /etc]# obex_test -b local 9
276 Using Bluetooth RFCOMM transport
277 OBEX Interactive test client/server.
278
279 > s /* First register server */
280 Timeout while doing OBEX_HandleInput()
281
282 >s /*recive file*/
283
284 >q /* exit */
285
286 8)Read the original HCI data in the background
287
288 eg:
289 [root@Ingenic /etc]#hcidump -Xt&
290
291 /*Writed by zkwang_bj@ingenic.cn*/