From 7223b8c3802fbdb5b11220ba68d3d2312893564f Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 27 Nov 2019 11:06:42 -0500 Subject: [PATCH] Documentation --- .gitignore | 2 +- Ble.jar | Bin 0 -> 10631 bytes README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 Ble.jar create mode 100644 README.md diff --git a/.gitignore b/.gitignore index 302266c..8b13789 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -Ble.jar + diff --git a/Ble.jar b/Ble.jar new file mode 100644 index 0000000000000000000000000000000000000000..ce0a62498ad82e4ff03c57d7a204752a01f8a370 GIT binary patch literal 10631 zcmbt)WmH^Qvo`J!+=4^n(zsg_Ah^5JXt3b!5}XhSNwCnkyIXK~cXtAT1c$&!CUf6O z=6*9j-n)DCTDwf$Uiic)O% z15i+~P|9+MNIxWC{uERGM`heciT@}oh%3rSNvf%{DoA}(7#ft9V__Xfmt$cZ85*rp z1x|6UZ9B2bDlp3^jJp=XA#3jubv;ccVz9a*0MPDcGxF^c;B65AlAxw-zB-*cLI1Ie zl6U15&mONK`S|^@3KS@)$Cds47GNL$b#`I?oPXg6BSUL_sg6SW4%@ z#3-z?J#ru;B?BDnE0-XBOXL0I&AW>)*ttQ#UCRgh)7GJJB}LeV%bn%~=i`>OWDph3sd9Y9R8^ zl1wSPuNeVvUqAfFKtTfiGY`8Y_Y{=g@6wiPB> z;)*^h?yY?+rB_rOm4>$}w>q8y>cxAA$u6*k#^uUR2Au3-AA0iiR5NGW)dbSA5Ab~7 zG4S3Es{#EFaRCn`+c-g13Aiz6Cn=dx1x+7k7@k%iKY;ep-hKf$8tgq#jxtT8vEEq# zqkz!9PC&|88Ku|1t2QY^NBe@ZwBvj}_ZW zi975JV-F%ZoMd|@l{!4$>ZFCW)&?t0%8h|+(ONM1nsh`${#m~q1!t9|(#VJT;lX(n0AN3_vJvU0RAPg%aafL(>x;L&VZ^O;?Qzx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ceH{mH%gJKV2b_21#p9?Sgy4EHDfYYkxG;Kg0dmnEyN6 zukD84;Uo zaKkwN2KQ$n^Y3uKhW;NVt-l5w{=dNe4EBEq`!#a>zP1ahe*vTU^XyQTgGcyreay#? N-D7Nl1N`{){{W`k>I?t? literal 0 HcmV?d00001 diff --git a/README.md b/README.md new file mode 100644 index 0000000..fc07c55 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# BLE + +A modern, cross-platform Go library for Bluetooth Low Energy + +This package is a working but incomplete interface for access to Bluetooth +Low Energy devices. It is intended to support multiple operating systems +with a uniform API. Currently, MacOS and Android are supported. Android +support requires the use of [Gio](https://gioui.org). + +The API is asyncrhonous and event driven. To access Bluetooth hardware, +first create a `BLE` variable with `NewBLE()`. On Android, you must also +call `Enable` with a pointer to your Gio Window. + +```go +import ( + ... + "git.wow.st/gmp/ble" + "gioui.org/app" +) + +func runloop() { + b := ble.NewBle() + w := app.NewWindow() + b.Enable(w) + ... +``` + +Once enabled, you can call the primary API functions, `Scan`, `StopScan`, +`Connect`, and `CancelConnection`. You can also query the state of the +Bluetooth hardware by calling `State`. + +Calling `Events` on your `BLE` object returns a channel on which API events +are delivered. These events notify your program when the state of the +BLE hardware changes (e.g. powered on or off), peripherals are connected, +services or characteristics are discovered, or values for characteristics +are updated. + +Using Gio, your main event loop will look something like this: + +``` + for { + select { + case e := <-b.Events(): + switch e := e.(type) { + // Handle BLE Events + } + } + case e := <-w.Events(): + switch e := e.(type) { + // Handle Gio events + } + } + } +```