|
|
|
# AnW_BT_SRV
|
|
|
|
- AnW Bluetooth Service API, offered two sorts of releases
|
|
|
|
1. App Release: **btsrv**, excutable **BTDemo**, launcher **btsrv_client.sh**, essentails libraries (**.so**), and App configures (**.xml**)
|
|
|
|
2. SDK Release: **anwbtsrv_sdk**, open source with **AnWBTServiceDemo.cpp**, imported essentials libraries (**.so**), header (**anwbtservice.h**), and App configures (**.xml**)
|
|
|
|
|
|
|
|
# RELEASE NOTE
|
|
|
|
- 20220118 [TAG:TAMUL_BT_V2](http://192.168.1.51:8088/delly.chen/anw_bt_srv/-/tags/TAMUL_BT_V2)
|
|
|
|
1. [FUNC]supports iphone carplay connect & write carplay data to iphone
|
|
|
|
|
|
|
|
- 20220117 [TAG:TAMUL_BT_V1](http://192.168.1.51:8088/delly.chen/anw_bt_srv/-/tags/TAMUL_BT_V1)
|
|
|
|
1. [FUNC] supports basic BT pair & connect
|
|
|
|
|
|
|
|
<div style="page-break-after: always;"></div>
|
|
|
|
|
|
|
|
# Usage
|
|
|
|
1. Support HFP, A2DP, AVRCP, PBAP, .. AnW BT stack
|
|
|
|
2. Support Device Serarch & Pair, Call, Phonebook, Music, ...
|
|
|
|
|
|
|
|
## Pre-Requirement
|
|
|
|
Modify Combo module init script **/etc/init.d/ubloxinit.sh**
|
|
|
|
```
|
|
|
|
echo "[DDMISO] UBLOX Driver"
|
|
|
|
modprobe jody-w2-sdiouart
|
|
|
|
ifconfig uap0 192.168.1.10
|
|
|
|
hostapd /etc/ublox/hostapd.conf -B
|
|
|
|
udhcpd /etc/ublox/udhcpd.conf
|
|
|
|
ifconfig uap0 up
|
|
|
|
wpa_supplicant -B -D nl80211 -i mlan0 -c /etc/ublox/wpa_supplicant.conf
|
|
|
|
#modprobe jody-w2-sdiouart-bt
|
|
|
|
#hciattach /dev/ttyAMA1 any 3000000 flow
|
|
|
|
#hciconfig -a hci0 up
|
|
|
|
#hciconfig -a hci0
|
|
|
|
udhcpc -i mlan0
|
|
|
|
```
|
|
|
|
|
|
|
|
## Run App on targets (tamul_btsrv-.zip)
|
|
|
|
1. unzip
|
|
|
|
2. Copy results folder /build/btsrv to target /home/btsrv
|
|
|
|
3. go to target, in terminal entering /btsrv folder
|
|
|
|
4. run btsrv_client.sh to launch BTDemo demo app and following the menu commands or
|
|
|
|
```
|
|
|
|
> export LD_LIBRARY_PATH="/home/btsrv"
|
|
|
|
>./BTDemo
|
|
|
|
```
|
|
|
|
|
|
|
|
### Set Local Device Name
|
|
|
|
```
|
|
|
|
================bluetooth menu=================
|
|
|
|
1.EXIT
|
|
|
|
2.BTPowerOn
|
|
|
|
3.BTPowerOff
|
|
|
|
4.SetLocalDevAddrOrName
|
|
|
|
===============================================
|
|
|
|
> input num: 4
|
|
|
|
0.set local name
|
|
|
|
1.set local address
|
|
|
|
> 0
|
|
|
|
> input name: TAMUL_MARVELL (for example)
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
### Power On For BT INIT
|
|
|
|
```
|
|
|
|
================bluetooth menu=================
|
|
|
|
1.EXIT
|
|
|
|
2.BTPowerOn
|
|
|
|
3.BTPowerOff
|
|
|
|
4.SetLocalDevAddrOrName
|
|
|
|
===============================================
|
|
|
|
> input num: 2
|
|
|
|
BTPowerOn
|
|
|
|
...
|
|
|
|
```
|
|
|
|
Note: Looking for device name (e.g. TAMUL_MARVELL) from mobile, then pair the device with mobile
|
|
|
|
When mobile shows connected succeed, turn off the BT button from mobile, then turn on the BT button from mobile again.
|
|
|
|
At this time, mobile has paired storage with the device.
|
|
|
|
|
|
|
|
### Connect to SPP
|
|
|
|
```
|
|
|
|
================ BT Test Menu =================
|
|
|
|
1. Exit
|
|
|
|
2. StartInquiry
|
|
|
|
...
|
|
|
|
8. ConnectDevice
|
|
|
|
9. DisconnectDevice
|
|
|
|
10.SPP_Write
|
|
|
|
===============================================
|
|
|
|
> input num: 8
|
|
|
|
...
|
|
|
|
> input connect addr(xx:xx:xx:xx:xx:xx): 11:e8:14:da:61:d4 (for example)
|
|
|
|
...
|
|
|
|
```
|
|
|
|
Note: You can find mobile BT mac from **"Setting->General->About-> Bluetooth"**
|
|
|
|
|
|
|
|
```
|
|
|
|
> input profile_mask: 0x00000100
|
|
|
|
```
|
|
|
|
Note: Then, connected.
|
|
|
|
|
|
|
|
### Write SPP
|
|
|
|
```
|
|
|
|
================ BT Test Menu =================
|
|
|
|
1. Exit
|
|
|
|
2. StartInquiry
|
|
|
|
...
|
|
|
|
8. ConnectDevice
|
|
|
|
9. DisconnectDevice
|
|
|
|
10.SPP_Write
|
|
|
|
===============================================
|
|
|
|
> input num: 10
|
|
|
|
> input connect addr(xx:xx:xx:xx:xx:xx): 11:e8:14:da:61:d4 (for example)
|
|
|
|
```
|
|
|
|
Note: You can find mobile BT mac from **"Setting->General->About-> Bluetooth"**
|
|
|
|
|
|
|
|
```
|
|
|
|
>input IAP_data:**ff,55,2,0,ee,10** (for example)
|
|
|
|
```
|
|
|
|
Note: Then, you can receive data back from IPHONE, check log printed:
|
|
|
|
```
|
|
|
|
AnWBTService_SPP_DATA_IND_S sppData:
|
|
|
|
[ff] [55] [2] [0] [ee] [10]**
|
|
|
|
```
|
|
|
|
|
|
|
|
## Customize on SDK (tamul_release-.zip)
|
|
|
|
- unzip
|
|
|
|
- in terminal entering ./anwbtsrv_sdk/Demo folder
|
|
|
|
- setup tool-chain by command line (source ...) or edit in ./anwbtsrv_sdk/Demo/build_demo.sh
|
|
|
|
- run make or build_demo.sh
|
|
|
|
```
|
|
|
|
> cd ./build/anwbtsrv_sdk/Demo
|
|
|
|
> source /opt/poky-tamul/2.5.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
|
|
|
|
> make or ./build_demo.sh
|
|
|
|
```
|
|
|
|
then, result is collected in **./Demo/btsrv**
|
|
|
|
|
|
|
|
<div style="page-break-after: always;"></div>
|
|
|
|
|
|
|
|
# SDK Release Structure (tamul_release-.zip)
|
|
|
|
<pre>
|
|
|
|
.
|
|
|
|
└── Demo
|
|
|
|
├── AnWBTServiceDemo.cpp (examples to use anwbtservice)
|
|
|
|
├── build_demo.sh (build script, call to make)
|
|
|
|
├── makefile (makefile for BTDemo)
|
|
|
|
├── btsrv_client.sh (launcher for BTDemo)
|
|
|
|
├── *.xml, *.cfg (app settings)
|
|
|
|
├── import (anwbtservice)
|
|
|
|
│ ├── anwbtservice.h (service api header)
|
|
|
|
│ └── *.so (essentials libraries)
|
|
|
|
└── btsrv (ouput for produced, e.g. BTDemo)
|
|
|
|
</pre> |