Using Bluetooth LE with Go

 

Gatt is a Go package, which provides developers to create BLE applications for Linux and OS X.
 
Developers install Go language on the host machine, and cross-compile the applications for RPi.
 
The package accesses HCI devices directly via HCI sockets provided by BlueZ core (kernel space), so it doesn't require the BlueZ userland package.
To test the example programs (sample GATT server and clients):
 
Cross-compile the server example for an ARMv6 target device.
 
 GOARCH=arm GOARM=6 GOOS=linux go build examples/server.go
 cp server <target device>
 
Start the server on the target device
 
 sudo ./server
 
Cross-compile the client example (discoverer) for an ARMv6 target device.
 
 GOARCH=arm GOARM=6 GOOS=linux go build examples/discoverer.go
 cp discoverer <target device>
 
Run the discoverer to scan surrounding peripheral devices.
 
sudo ./discoverer
 

https://www.elinux.org/RPi_Bluetooth_LE
https://github.com/paypal/gatt
 

posted @ 2018-04-04 08:52  dong1  阅读(585)  评论(0编辑  收藏  举报