Commit Graph

90 Commits

Author SHA1 Message Date
deadprogram
f3862f6230 build: add channelscan example to smoketests
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-10-01 02:20:17 +02:00
deadprogram
458028f7fd examples: add channelscan example that shows use of goroutines and channels
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-10-01 02:19:14 +02:00
deadprogram
9daf7205ab examples: discover should only wait on startup on baremetal, since macOS does not like that
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-24 14:30:13 +02:00
deadprogram
a2662956b8 gap/all: add Disconnect() to Driver
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-24 14:30:13 +02:00
deadprogram
281d195e75 gap: change signature for Addresser interface Set() function to accept string and then parse it as needed
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-20 14:56:48 +02:00
deadprogram
f04c1cbe78 docs: set correct pkg.go.dev path in README badge
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-17 18:48:00 +02:00
deadprogram
3e2ce45abc examples: extend HRS to perform notifications, add heartrate-monitor example that shows notifications
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-17 17:17:18 +02:00
deadprogram
c1d8db922f Prepare for release v0.1.0
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-17 12:33:56 +02:00
Ron Evans
fa16c65199 examples: let macos use rawterm to compile nusclient 2020-09-17 12:32:59 +02:00
deadprogram
a1e82ffa1f docs: adding go bluetooth gopher
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-16 22:46:42 +02:00
Ayke van Laethem
633d9b5aea nrf: keep advertisement payload alive
The memory from the advertisement payload must be kept alive until the
advertisement is stopped. Therefore, it is not allowed to use a local
variable for it. Instead, it is now part of the defaultAdvertisement
global which of course is alive as long as the program runs.
2020-09-16 17:20:05 +02:00
deadprogram
69aae6c6b9 gattc/linux: correct false positive error when using DiscoverServices with a specific list of UUID
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-16 13:22:09 +02:00
deadprogram
2e26f4cdc7 docs: update BBC micro:bit flash instructions
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-15 23:04:38 +02:00
Ron Evans
ca51250ccf
docs: a lot more information on how to install/use Go Bluetooth
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-15 15:26:45 +02:00
Ayke van Laethem
b70c118f1e ci: run unit tests 2020-09-15 08:48:08 +02:00
Olaf Flebbe
08afb74cfc add more test, fix uuid test (strings are lower case in implementation) 2020-09-14 23:19:52 +02:00
Olaf Flebbe
5bedd1dccc fix ParseUUID. Return error for invalid UUID strings 2020-09-14 23:19:52 +02:00
Ron Evans
ef90e5d337
gattc: use GetUUID() to allow for bare metal use of short UUID. (#14)
* gattc: use UUID() to allow for bare metal to permit clean use of short UUIDs

Signed-off-by: deadprogram <ron@hybridgroup.com>

* gattc/macos: correct usage of UUID wrapper type alias

Signed-off-by: Ron Evans <ron@hybridgroup.com>

* gattc/sd: correct usage of UUID wrapper type alias

Signed-off-by: Ron Evans <ron@hybridgroup.com>

* gattc/sd, uuid/sd: changes intended to reduce memory allocations for service and characteristic discovery

Signed-off-by: deadprogram <ron@hybridgroup.com>

* gattc/sd: partial improvements to DiscoverServices/DiscoverCharacteristics

Signed-off-by: deadprogram <ron@hybridgroup.com>

* gattc/sd: mostly getting uuid back for services in DiscoverServices

Signed-off-by: deadprogram <ron@hybridgroup.com>

* uuid/sd: correct way to calculate UUID from shortUUID

Signed-off-by: deadprogram <ron@hybridgroup.com>

* gattc/sd: able to discover services and characteristics

Signed-off-by: deadprogram <ron@hybridgroup.com>

* examples: updated discover example that can run with OS or bare metal

Signed-off-by: deadprogram <ron@hybridgroup.com>

* gattc/sd: ensure safe casts for length of returned struct when converting short UUID

Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-13 20:21:38 +02:00
Ron Evans
6dc1dff711
gap: add connection handler to be called on adapter connect/disconnect
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-10 17:17:45 +02:00
Ron Evans
6d20fc6472
examples: add example for Circuit Playground Bluefruit board to control built-in NeoPixels
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-10 15:24:22 +02:00
deadprogram
c3aeaf040e nrf528xx: correct returned MAC address in struct with global scan result
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-09 18:46:11 +02:00
deadprogram
a55e2194c5 domain: use custom domain for all uses of winbt subpackage
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-09 16:04:40 +02:00
deadprogram
97532eaed4 domain: use custom domain for go.mod and examples
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-09 16:04:40 +02:00
deadprogram
9647735fca docs,domain: use import for custom domain for package, also GoDocs format info for package
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-09 16:04:40 +02:00
Ron Evans
2d909712ee
docs: update README with lots of info/organization and also add CONTRIBUTING guidelines
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-03 15:40:52 +02:00
deadprogram
fd89ad24a8 linux: all for DiscoverServices and DiscoverCharacteristics to discover all when no specific list of UUIDs
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-03 15:26:43 +02:00
deadprogram
ac98835ed3 linux: add UUID to DeviceService and DeviceCharacteristic
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-03 15:26:43 +02:00
deadprogram
ad6f45a730 linux: correct use of Addresser when scanning
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-03 15:26:43 +02:00
Ron Evans
ada9076886 examples: add discover example that shows services/characteristics
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-03 15:26:43 +02:00
deadprogram
d570aa58a6 docs: better explanation of peripheral UUID on macOS
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
deadprogram
8bb26c24e6 gap: correct use of Address on Linux platform
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
95cabe86a1 macos: added characteristic notifications
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
a7844e1734 macos: remove unneeded functions to export internal implementaions.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
ea7ed874af gap: switch to use MACAddress struct when possible for shared implementation
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
dc738f9c47 macos: able to discover services and characteristics for a device
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
5f44bb4a96 macos: completed initial implementation
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
27cc0b725a docs: show that we can now scan on macOS
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
56c0c2ecda windows: use Addresser interface for the MAC address for a peripheral
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
c1114ad708 all: use Addresser interface to handle fact that macOS uses UUID instead of MAC as the BLE address for a peripheral
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
a620bacdb8 macos: able to retrieve some of the info when scanning
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ron Evans
51b2b4c2b2 macos: starting point for adding macOS support
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-09-02 08:37:04 +02:00
Ayke van Laethem
40e14a41fc nrf52: add support for S140 version 6
This is used on the Adafruit Circuit Playground Bluefruit bootloader,
for example.
2020-08-30 16:39:16 +02:00
Ayke van Laethem
de824e1884
nrf52: use low-frequency crystal oscillator when available
I couldn't measure a difference in my setup, apparently my multimeter is
not able to handle the high-to-low current transition when entering
sleep mode. But it _should_ reduce current consumption a little bit.
2020-08-01 18:39:34 +02:00
Ayke van Laethem
d2228b9e79
nrf52: use internal RC oscillator
This saves around 0.3mA according to my multimeter.
2020-07-30 15:12:28 +02:00
Ayke van Laethem
54cb2b25bb
linux: add GATT client support 2020-06-28 00:22:19 +02:00
Ayke van Laethem
602e656a6b
linux: improve scanning
By using the D-Bus APIs directly, I managed to avoid a deadlock that I
somehow couldn't work around with the go-bluetooth package.
2020-06-28 00:21:47 +02:00
Ayke van Laethem
15b3e8e3e2
nrf: add GATT client
This is not entirely complete (some errors are not handled properly) but
it's a start.
2020-06-28 00:21:40 +02:00
Ayke van Laethem
8129f7e092
linux: include IsRandom bit in Address type
Unlike what I previously thought, BlueZ does expose it. Unfortunately it
doesn't seem to respect it: the bit is not included in D-Bus paths.

Windows also supports the bit, which I hope to fix in a future commit.
Like BlueZ, it appears to ignore it when connecting to a device.
2020-06-11 15:53:36 +02:00
Ayke van Laethem
6c7d25c022
examples/nusserver: refactor terminal handling
The over-the-air newline format has been changed to LF always, for
simplicity. We might have used CR instead but LF works, and is the
newline format normally used on Unix (in files and stdio, except for raw
terminals).
2020-06-11 15:46:08 +02:00
Ayke van Laethem
ccb9c84db8
all: change advertisement interval type
Use a new Duration type, which is used throughout the BLE stack for
durations. The resolutions are sometimes different (connection
parameters have half the resolution) but overall it should improve the
ease of use of this type.

This commit also provides a default advertisement interval that is
recommended by Apple (which I think is as good as any recommendation).
This might help to speed up discovery by Apple (and Android?) phones.
2020-06-06 20:47:05 +02:00