目次

freebsd-bluetooth


FreeBSD 7 Release において。
usb bluetooth を利用。利用可能なデバイスは Release note 参照。ただし、usb bluetooth はリストに載っていなくても利用できた。チップが rel note に載っているものを利用しているのかもしれない。未調査。

インストール

カーネルモジュールをロードする。

ng_ubt_load="YES"
# kldload ng_ubt

いろんなものの起動

# /etc/rc.d/bluetooth start 

hcsecd の準備

hcsecd_enable="YES"

sdpd の準備

sdpd_enable="YES"
# /etc/rc.d/sdpd start

スタック

HCI

l2cap

プロファイル

コマンドとか

hccontrol

hccontrol -n ubt0hci read_bd_addr

hccontrol -n ubt0hci inquiry

hccontrol -n ubt0hci read_remote_name_request <bdaddr>

obexapp

サーバモード

# obexapp -s -C 1 -r /var/spool/obex/ 

クライアントモード

# obexapp -c -a <bd addr> -C <channel number> -n put <file name>

プログラミング

socket

socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI); 

inquiry

関数

bt_gethostbyaddr()

データ構造

バイトオーダー

自分のホストのbdアドレスを取得する場合

+----------------+
|ng_hci_cmd_pkt_t|
+----------------+
+-----------------------+
|ng_hci_event_pkt_t     |
+-----------------------+
|ng_hci_command_compl_ep|
+-----------------------+
|ng_hci_read_bdaddr_rp  |
+-----------------------+
#define NG_HCI_OCF_READ_BDADDR                  0x0009
typedef struct {
        u_int8_t        status; /* 0x00 - success */
        bdaddr_t        bdaddr; /* unit address */
} __attribute__ ((packed)) ng_hci_read_bdaddr_rp;

ドキュメント

man