You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/02/01 02:42:53 UTC

[mynewt-newtmgr] 01/03: Replace currantlabs dep with go-ble.

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch go-ble
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git

commit 4d60209091b1aea3fdc0740afb0c4f43feb5d290
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Nov 29 13:57:29 2017 -0800

    Replace currantlabs dep with go-ble.
---
 Gopkg.lock                                         |  16 +-
 Gopkg.toml                                         |   4 -
 newtmgr/bll/bll_common.go                          |   2 +-
 newtmgr/bll/bll_sesn.go                            |   2 +-
 newtmgr/bll/bll_sesn_cfg.go                        |   2 +-
 newtmgr/bll/bll_util.go                            |   2 +-
 newtmgr/bll/bll_xport.go                           |   4 +-
 newtmgr/config/bll_config.go                       |   4 +-
 vendor/github.com/currantlabs/ble/README.md        |   3 -
 vendor/github.com/raff/goble/goble.go              |   8 +-
 .../{currantlabs => runtimeco}/ble/.gitignore      |   0
 vendor/github.com/runtimeco/ble/.travis.yml        |  25 +++
 .../{currantlabs => runtimeco}/ble/LICENSE         |   0
 vendor/github.com/runtimeco/ble/README.md          |  10 ++
 .../{currantlabs => runtimeco}/ble/addr.go         |   0
 .../{currantlabs => runtimeco}/ble/adv.go          |   2 +-
 .../{currantlabs => runtimeco}/ble/client.go       |   6 +-
 .../{currantlabs => runtimeco}/ble/conn.go         |   3 +-
 .../{currantlabs => runtimeco}/ble/const.go        |   0
 vendor/github.com/runtimeco/ble/context.go         |  11 ++
 .../{currantlabs => runtimeco}/ble/darwin/adv.go   |   6 +-
 .../ble/darwin/client.go                           | 110 ++++++++-----
 .../{currantlabs => runtimeco}/ble/darwin/conn.go  |  28 ++--
 .../ble/darwin/device.go                           | 161 ++++++++++++-------
 .../{currantlabs => runtimeco}/ble/darwin/log.go   |   0
 .../{currantlabs => runtimeco}/ble/darwin/msg.go   |   4 +-
 .../ble/darwin/option.go                           |   0
 .../{currantlabs => runtimeco}/ble/darwin/state.go |   0
 .../{currantlabs => runtimeco}/ble/darwin/util.go  |   2 +-
 vendor/github.com/runtimeco/ble/darwin/xpcid.go    | 170 +++++++++++++++++++++
 .../ble/dev.go => runtimeco/ble/device.go}         |   5 +-
 .../{currantlabs => runtimeco}/ble/error.go        |   2 +-
 .../ble/examples/basic/advertiser/main.go          |   7 +-
 .../ble/examples/basic/explorer/main.go            |  13 +-
 .../ble/examples/basic/scanner/main.go             |  11 +-
 .../ble/examples/basic/server/main.go              |   9 +-
 .../ble/examples/blesh/README.md                   |   0
 .../ble/examples/blesh/adv.go                      |   8 +-
 .../ble/examples/blesh/exp.go                      |   2 +-
 .../ble/examples/blesh/filter.go                   |   4 +-
 .../ble/examples/blesh/flg.go                      |   0
 .../ble/examples/blesh/lnx.go                      |   6 +-
 .../ble/examples/blesh/main.go                     |  24 ++-
 .../ble/examples/blesh/util.go                     |   4 +-
 .../ble/examples/lib/battery.go                    |   2 +-
 .../ble/examples/lib/count.go                      |   2 +-
 .../ble/examples/lib/dev/default_darwin.go         |   4 +-
 .../ble/examples/lib/dev/default_linux.go          |   4 +-
 .../ble/examples/lib/dev/dev.go                    |   2 +-
 .../ble/examples/lib/echo.go                       |   2 +-
 .../ble/examples/lib/uuids.go                      |   2 +-
 .../{currantlabs => runtimeco}/ble/gatt.go         |   9 +-
 .../{currantlabs => runtimeco}/ble/handler.go      |   3 +-
 .../ble/linux/adv/const.go                         |   0
 .../ble/linux/adv/packet.go                        |   2 +-
 .../ble/linux/att/README.md                        |   4 +-
 .../ble/linux/att/att.go                           |   0
 .../ble/linux/att/att_gen.go                       |   0
 .../ble/linux/att/attr.go                          |   2 +-
 .../ble/linux/att/client.go                        |   8 +-
 .../{currantlabs => runtimeco}/ble/linux/att/db.go |   2 +-
 .../ble/linux/att/log.go                           |   0
 .../ble/linux/att/server.go                        | 108 +++++++++++--
 .../{currantlabs => runtimeco}/ble/linux/device.go |  85 +++++++----
 .../ble/linux/gatt/README.md                       |   0
 .../ble/linux/gatt/client.go                       |  16 +-
 .../ble/linux/gatt/server.go                       |  46 ++++--
 .../ble/linux/hci/README.md                        |   0
 .../ble/linux/hci/adv.go                           |  10 +-
 .../ble/linux/hci/buffer.go                        |   0
 .../ble/linux/hci/cmd/cmd.go                       |   0
 .../ble/linux/hci/cmd/cmd_gen.go                   |   0
 .../ble/linux/hci/conn.go                          |  13 +-
 .../ble/linux/hci/const.go                         |   0
 .../ble/linux/hci/error.go                         |   0
 .../ble/linux/hci/evt/evt.go                       |   0
 .../ble/linux/hci/evt/evt_gen.go                   |   0
 .../ble/linux/hci/gap.go                           |  54 ++++++-
 .../ble/linux/hci/hci.go                           |  24 +--
 .../ble/linux/hci/log.go                           |   0
 .../ble/linux/hci/option.go                        |   2 +-
 .../ble/linux/hci/params.go                        |   2 +-
 .../ble/linux/hci/signal.go                        |   2 +-
 .../ble/linux/hci/signal_gen.go                    |   0
 .../ble/linux/hci/smp.go                           |   0
 .../ble/linux/hci/socket/dummy.go                  |   7 +-
 .../ble/linux/hci/socket/socket.go                 |   2 +-
 .../ble/linux/tools/codegen/Makefile               |   0
 .../ble/linux/tools/codegen/att.json               |   0
 .../ble/linux/tools/codegen/att.tmpl               |   0
 .../ble/linux/tools/codegen/cmd.json               |   0
 .../ble/linux/tools/codegen/cmd.tmpl               |   0
 .../ble/linux/tools/codegen/codegen.go             |   0
 .../ble/linux/tools/codegen/evt.json               |   0
 .../ble/linux/tools/codegen/evt.tmpl               |   0
 .../ble/linux/tools/codegen/signal.json            |   0
 .../ble/linux/tools/codegen/signal.tmpl            |   0
 .../{currantlabs => runtimeco}/ble/profile.go      |  35 ++++-
 .../{currantlabs => runtimeco}/ble/uuid.go         |   0
 99 files changed, 803 insertions(+), 331 deletions(-)

diff --git a/Gopkg.lock b/Gopkg.lock
index 7493071..74a6052 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -14,12 +14,6 @@
   version = "v1.0.18"
 
 [[projects]]
-  branch = "master"
-  name = "github.com/currantlabs/ble"
-  packages = [".","darwin","examples/lib/dev","linux","linux/adv","linux/att","linux/gatt","linux/hci","linux/hci/cmd","linux/hci/evt","linux/hci/socket"]
-  revision = "ba3b00e87511deec53b2d0e8df691426a1d37bf7"
-
-[[projects]]
   name = "github.com/fatih/structs"
   packages = ["."]
   revision = "a720dfa8df582c51dee1b36feabb906bde1588bd"
@@ -113,7 +107,13 @@
   branch = "master"
   name = "github.com/raff/goble"
   packages = ["xpc"]
-  revision = "b12b34f940c4cf4363660073539b5fa9fd96bd16"
+  revision = "591010bb87c136ee390f8f20529039fea824f737"
+
+[[projects]]
+  branch = "master"
+  name = "github.com/runtimeco/ble"
+  packages = [".","darwin","examples/lib/dev","linux","linux/adv","linux/att","linux/gatt","linux/hci","linux/hci/cmd","linux/hci/evt","linux/hci/socket"]
+  revision = "61d34ef746d366721629bfe83a549031fa1f78d8"
 
 [[projects]]
   branch = "master"
@@ -201,6 +201,6 @@
 [solve-meta]
   analyzer-name = "dep"
   analyzer-version = 1
-  inputs-digest = "006ff4573b02a7ab7a8170515b246f4e01c68c9a1b8dc4881ab5d6b3663a502d"
+  inputs-digest = "736490ccf463253de691a0c1e94cb7c24fd634734f711e68c25fa5cbc8123788"
   solver-name = "gps-cdcl"
   solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
index 81152be..debfb80 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -26,10 +26,6 @@
   version = "1.0.3"
 
 [[constraint]]
-  branch = "master"
-  name = "github.com/currantlabs/ble"
-
-[[constraint]]
   name = "github.com/fatih/structs"
   version = "1.0.0"
 
diff --git a/newtmgr/bll/bll_common.go b/newtmgr/bll/bll_common.go
index 59a49f2..13052b2 100644
--- a/newtmgr/bll/bll_common.go
+++ b/newtmgr/bll/bll_common.go
@@ -26,7 +26,7 @@ import (
 	"time"
 
 	log "github.com/Sirupsen/logrus"
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 
 	"mynewt.apache.org/newtmgr/nmxact/bledefs"
 )
diff --git a/newtmgr/bll/bll_sesn.go b/newtmgr/bll/bll_sesn.go
index 995b1c5..8ec2a56 100644
--- a/newtmgr/bll/bll_sesn.go
+++ b/newtmgr/bll/bll_sesn.go
@@ -26,7 +26,7 @@ import (
 	"sync"
 
 	log "github.com/Sirupsen/logrus"
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/runtimeco/go-coap"
 	"golang.org/x/net/context"
 
diff --git a/newtmgr/bll/bll_sesn_cfg.go b/newtmgr/bll/bll_sesn_cfg.go
index 954c921..6f216fb 100644
--- a/newtmgr/bll/bll_sesn_cfg.go
+++ b/newtmgr/bll/bll_sesn_cfg.go
@@ -24,7 +24,7 @@ package bll
 import (
 	"time"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 
 	"mynewt.apache.org/newtmgr/nmxact/sesn"
 )
diff --git a/newtmgr/bll/bll_util.go b/newtmgr/bll/bll_util.go
index af514e1..5e57a2a 100644
--- a/newtmgr/bll/bll_util.go
+++ b/newtmgr/bll/bll_util.go
@@ -25,7 +25,7 @@ import (
 	"encoding/binary"
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 
 	"mynewt.apache.org/newtmgr/nmxact/bledefs"
 )
diff --git a/newtmgr/bll/bll_xport.go b/newtmgr/bll/bll_xport.go
index d7b8e6e..6eb7afa 100644
--- a/newtmgr/bll/bll_xport.go
+++ b/newtmgr/bll/bll_xport.go
@@ -24,8 +24,8 @@ package bll
 import (
 	"fmt"
 
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib/dev"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib/dev"
 
 	"mynewt.apache.org/newtmgr/nmxact/sesn"
 )
diff --git a/newtmgr/config/bll_config.go b/newtmgr/config/bll_config.go
index d0b995b..7fb8a67 100644
--- a/newtmgr/config/bll_config.go
+++ b/newtmgr/config/bll_config.go
@@ -25,7 +25,7 @@ import (
 	"fmt"
 	"strings"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 
 	"mynewt.apache.org/newt/util"
 	"mynewt.apache.org/newtmgr/newtmgr/bll"
@@ -93,7 +93,7 @@ func BuildBllSesnCfg(bc *BllConfig) (bll.BllSesnCfg, error) {
 		}
 	} else if bc.PeerId != "" {
 		sc.AdvFilter = func(a ble.Advertisement) bool {
-			return a.Address().String() == bc.PeerId
+			return a.Addr().String() == bc.PeerId
 		}
 	} else {
 		return sc, util.NewNewtError("bll session lacks a peer specifier")
diff --git a/vendor/github.com/currantlabs/ble/README.md b/vendor/github.com/currantlabs/ble/README.md
deleted file mode 100644
index 28f954d..0000000
--- a/vendor/github.com/currantlabs/ble/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# bt
-
-bt is a Bluetooth library for Go; its API is still under active development, and may change without warning.
diff --git a/vendor/github.com/raff/goble/goble.go b/vendor/github.com/raff/goble/goble.go
index e664811..4b1986d 100644
--- a/vendor/github.com/raff/goble/goble.go
+++ b/vendor/github.com/raff/goble/goble.go
@@ -142,12 +142,15 @@ type BLE struct {
 	attributes             xpc.Array
 	lastServiceAttributeId int
 	allowDuplicates        bool
+
+	utsname xpc.Utsname
 }
 
 func New() *BLE {
 	ble := &BLE{peripherals: map[string]*Peripheral{}, Emitter: Emitter{}}
 	ble.Emitter.Init()
 	ble.conn = xpc.XpcConnect("com.apple.blued", ble)
+	xpc.Uname(&ble.utsname)
 	return ble
 }
 
@@ -462,10 +465,7 @@ func (ble *BLE) StartAdvertising(name string, serviceUuids []xpc.UUID) {
 
 // start advertising as IBeacon (raw data)
 func (ble *BLE) StartAdvertisingIBeaconData(data []byte) {
-	var utsname xpc.Utsname
-	xpc.Uname(&utsname)
-
-	if utsname.Release >= "14." {
+	if ble.utsname.Release >= "14." {
 		l := len(data)
 		buf := bytes.NewBuffer([]byte{byte(l + 5), 0xFF, 0x4C, 0x00, 0x02, byte(l)})
 		buf.Write(data)
diff --git a/vendor/github.com/currantlabs/ble/.gitignore b/vendor/github.com/runtimeco/ble/.gitignore
similarity index 100%
rename from vendor/github.com/currantlabs/ble/.gitignore
rename to vendor/github.com/runtimeco/ble/.gitignore
diff --git a/vendor/github.com/runtimeco/ble/.travis.yml b/vendor/github.com/runtimeco/ble/.travis.yml
new file mode 100644
index 0000000..37dfd94
--- /dev/null
+++ b/vendor/github.com/runtimeco/ble/.travis.yml
@@ -0,0 +1,25 @@
+language: go
+os:
+        - osx
+        - linux
+
+go:
+        - 1.7
+        - 1.8
+        - 1.9
+        - tip
+
+go_import_path: github.com/go-ble/ble
+
+install:
+        - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then go get ./...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GOOS=linux go get && GOOS=linux go get ./linux; fi
+
+
+script:
+        - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then go vet ./...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GOOS=linux go vet && GOOS=linux go vet ./linux/...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then go test ./...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GOOS=linux go test && GOOS=linux go test ./linux/...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then go build -v ./...; fi
+        - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then GOOS=linux go build -v && GOOS=linux go build -v ./linux/...; fi
diff --git a/vendor/github.com/currantlabs/ble/LICENSE b/vendor/github.com/runtimeco/ble/LICENSE
similarity index 100%
rename from vendor/github.com/currantlabs/ble/LICENSE
rename to vendor/github.com/runtimeco/ble/LICENSE
diff --git a/vendor/github.com/runtimeco/ble/README.md b/vendor/github.com/runtimeco/ble/README.md
new file mode 100644
index 0000000..cd41721
--- /dev/null
+++ b/vendor/github.com/runtimeco/ble/README.md
@@ -0,0 +1,10 @@
+# ble
+
+[![GoDoc](https://godoc.org/github.com/go-ble/ble?status.svg)](https://godoc.org/github.com/go-ble/ble)
+[![Go Report Card](https://goreportcard.com/badge/go-ble/ble)](https://goreportcard.com/report/go-ble/ble)
+[![codebeat badge](https://codebeat.co/badges/ba9fae6e-77d2-4173-8587-36ac8756676b)](https://codebeat.co/projects/github-com-go-ble-ble-master)
+
+
+
+**ble** is a [Bluetooth Low Energy](https://en.wikipedia.org/wiki/Bluetooth_Low_Energy) package for Linux and macOS.
+
diff --git a/vendor/github.com/currantlabs/ble/addr.go b/vendor/github.com/runtimeco/ble/addr.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/addr.go
rename to vendor/github.com/runtimeco/ble/addr.go
diff --git a/vendor/github.com/currantlabs/ble/adv.go b/vendor/github.com/runtimeco/ble/adv.go
similarity index 97%
rename from vendor/github.com/currantlabs/ble/adv.go
rename to vendor/github.com/runtimeco/ble/adv.go
index 24c1228..bf8115d 100644
--- a/vendor/github.com/currantlabs/ble/adv.go
+++ b/vendor/github.com/runtimeco/ble/adv.go
@@ -18,7 +18,7 @@ type Advertisement interface {
 	SolicitedService() []UUID
 
 	RSSI() int
-	Address() Addr
+	Addr() Addr
 }
 
 // ServiceData ...
diff --git a/vendor/github.com/currantlabs/ble/client.go b/vendor/github.com/runtimeco/ble/client.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/client.go
rename to vendor/github.com/runtimeco/ble/client.go
index e21ccf1..b8e4f31 100644
--- a/vendor/github.com/currantlabs/ble/client.go
+++ b/vendor/github.com/runtimeco/ble/client.go
@@ -2,8 +2,8 @@ package ble
 
 // A Client is a GATT client.
 type Client interface {
-	// Address returns platform specific unique ID of the remote peripheral, e.g. MAC on Linux, Client UUID on OS X.
-	Address() Addr
+	// Addr returns platform specific unique ID of the remote peripheral, e.g. MAC on Linux, Client UUID on OS X.
+	Addr() Addr
 
 	// Name returns the name of the remote peripheral.
 	// This can be the advertised name, if exists, or the GAP device name, which takes priority.
@@ -12,7 +12,7 @@ type Client interface {
 	// Profile returns discovered profile.
 	Profile() *Profile
 
-	// DiscoverProfile discovers the whole hierachy of a server.
+	// DiscoverProfile discovers the whole hierarchy of a server.
 	DiscoverProfile(force bool) (*Profile, error)
 
 	// DiscoverServices finds all the primary services on a server. [Vol 3, Part G, 4.4.1]
diff --git a/vendor/github.com/currantlabs/ble/conn.go b/vendor/github.com/runtimeco/ble/conn.go
similarity index 96%
rename from vendor/github.com/currantlabs/ble/conn.go
rename to vendor/github.com/runtimeco/ble/conn.go
index 1ddb3a9..750b04a 100644
--- a/vendor/github.com/currantlabs/ble/conn.go
+++ b/vendor/github.com/runtimeco/ble/conn.go
@@ -1,9 +1,8 @@
 package ble
 
 import (
+	"context"
 	"io"
-
-	"golang.org/x/net/context"
 )
 
 // Conn implements a L2CAP connection.
diff --git a/vendor/github.com/currantlabs/ble/const.go b/vendor/github.com/runtimeco/ble/const.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/const.go
rename to vendor/github.com/runtimeco/ble/const.go
diff --git a/vendor/github.com/runtimeco/ble/context.go b/vendor/github.com/runtimeco/ble/context.go
new file mode 100644
index 0000000..a11ef84
--- /dev/null
+++ b/vendor/github.com/runtimeco/ble/context.go
@@ -0,0 +1,11 @@
+package ble
+
+// ContextKey is a type used for keys of a context
+type ContextKey string
+
+var (
+	// ContextKeySig for SigHandler context
+	ContextKeySig = ContextKey("sig")
+	// ContextKeyCCC for per connection contexts
+	ContextKeyCCC = ContextKey("ccc")
+)
diff --git a/vendor/github.com/currantlabs/ble/darwin/adv.go b/vendor/github.com/runtimeco/ble/darwin/adv.go
similarity index 91%
rename from vendor/github.com/currantlabs/ble/darwin/adv.go
rename to vendor/github.com/runtimeco/ble/darwin/adv.go
index b7af334..5247012 100644
--- a/vendor/github.com/currantlabs/ble/darwin/adv.go
+++ b/vendor/github.com/runtimeco/ble/darwin/adv.go
@@ -1,7 +1,7 @@
 package darwin
 
 import (
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/raff/goble/xpc"
 )
 
@@ -68,6 +68,6 @@ func (a *adv) RSSI() int {
 	return a.args.GetInt("kCBMsgArgRssi", 0)
 }
 
-func (a *adv) Address() ble.Addr {
-	return xpc.UUID(a.args.MustGetUUID("kCBMsgArgDeviceUUID"))
+func (a *adv) Addr() ble.Addr {
+	return a.args.MustGetUUID("kCBMsgArgDeviceUUID")
 }
diff --git a/vendor/github.com/currantlabs/ble/darwin/client.go b/vendor/github.com/runtimeco/ble/darwin/client.go
similarity index 78%
rename from vendor/github.com/currantlabs/ble/darwin/client.go
rename to vendor/github.com/runtimeco/ble/darwin/client.go
index 668b408..e16dcbb 100644
--- a/vendor/github.com/currantlabs/ble/darwin/client.go
+++ b/vendor/github.com/runtimeco/ble/darwin/client.go
@@ -3,7 +3,7 @@ package darwin
 import (
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/raff/goble/xpc"
 )
 
@@ -24,8 +24,8 @@ func NewClient(c ble.Conn) (*Client, error) {
 	}, nil
 }
 
-// Address returns UUID of the remote peripheral.
-func (cln *Client) Address() ble.Addr {
+// Addr returns UUID of the remote peripheral.
+func (cln *Client) Addr() ble.Addr {
 	return cln.conn.RemoteAddr()
 }
 
@@ -40,24 +40,24 @@ func (cln *Client) Profile() *ble.Profile {
 	return cln.profile
 }
 
-// DiscoverProfile discovers the whole hierachy of a server.
+// DiscoverProfile discovers the whole hierarchy of a server.
 func (cln *Client) DiscoverProfile(force bool) (*ble.Profile, error) {
 	if cln.profile != nil && !force {
 		return cln.profile, nil
 	}
 	ss, err := cln.DiscoverServices(nil)
 	if err != nil {
-		return nil, fmt.Errorf("can't discover services: %s\n", err)
+		return nil, fmt.Errorf("can't discover services: %s", err)
 	}
 	for _, s := range ss {
 		cs, err := cln.DiscoverCharacteristics(nil, s)
 		if err != nil {
-			return nil, fmt.Errorf("can't discover characteristics: %s\n", err)
+			return nil, fmt.Errorf("can't discover characteristics: %s", err)
 		}
 		for _, c := range cs {
 			_, err := cln.DiscoverDescriptors(nil, c)
 			if err != nil {
-				return nil, fmt.Errorf("can't discover descriptors: %s\n", err)
+				return nil, fmt.Errorf("can't discover descriptors: %s", err)
 			}
 		}
 	}
@@ -68,12 +68,15 @@ func (cln *Client) DiscoverProfile(force bool) (*ble.Profile, error) {
 // DiscoverServices finds all the primary services on a server. [Vol 3, Part G, 4.4.1]
 // If filter is specified, only filtered services are returned.
 func (cln *Client) DiscoverServices(ss []ble.UUID) ([]*ble.Service, error) {
-	rsp := cln.conn.sendReq(45, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdDiscoverServices, xpc.Dict{
 		"kCBMsgArgDeviceUUID": cln.id,
 		"kCBMsgArgUUIDs":      uuidSlice(ss),
 	})
-	if rsp.err() != nil {
-		return nil, rsp.err()
+	if err != nil {
+		return nil, err
+	}
+	if err := rsp.err(); err != nil {
+		return nil, err
 	}
 	svcs := []*ble.Service{}
 	for _, xss := range rsp.services() {
@@ -93,14 +96,17 @@ func (cln *Client) DiscoverServices(ss []ble.UUID) ([]*ble.Service, error) {
 // DiscoverIncludedServices finds the included services of a service. [Vol 3, Part G, 4.5.1]
 // If filter is specified, only filtered services are returned.
 func (cln *Client) DiscoverIncludedServices(ss []ble.UUID, s *ble.Service) ([]*ble.Service, error) {
-	rsp := cln.conn.sendReq(60, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdDiscoverIncludedServices, xpc.Dict{
 		"kCBMsgArgDeviceUUID":         cln.id,
 		"kCBMsgArgServiceStartHandle": s.Handle,
 		"kCBMsgArgServiceEndHandle":   s.EndHandle,
 		"kCBMsgArgUUIDs":              uuidSlice(ss),
 	})
-	if rsp.err() != nil {
-		return nil, rsp.err()
+	if err != nil {
+		return nil, err
+	}
+	if err := rsp.err(); err != nil {
+		return nil, err
 	}
 	return nil, ble.ErrNotImplemented
 }
@@ -108,14 +114,17 @@ func (cln *Client) DiscoverIncludedServices(ss []ble.UUID, s *ble.Service) ([]*b
 // DiscoverCharacteristics finds all the characteristics within a service. [Vol 3, Part G, 4.6.1]
 // If filter is specified, only filtered characteristics are returned.
 func (cln *Client) DiscoverCharacteristics(cs []ble.UUID, s *ble.Service) ([]*ble.Characteristic, error) {
-	rsp := cln.conn.sendReq(62, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdDiscoverCharacteristics, xpc.Dict{
 		"kCBMsgArgDeviceUUID":         cln.id,
 		"kCBMsgArgServiceStartHandle": s.Handle,
 		"kCBMsgArgServiceEndHandle":   s.EndHandle,
 		"kCBMsgArgUUIDs":              uuidSlice(cs),
 	})
-	if rsp.err() != nil {
-		return nil, rsp.err()
+	if err != nil {
+		return nil, err
+	}
+	if err := rsp.err(); err != nil {
+		return nil, err
 	}
 	for _, xcs := range rsp.characteristics() {
 		xc := msg(xcs.(xpc.Dict))
@@ -132,12 +141,18 @@ func (cln *Client) DiscoverCharacteristics(cs []ble.UUID, s *ble.Service) ([]*bl
 // DiscoverDescriptors finds all the descriptors within a characteristic. [Vol 3, Part G, 4.7.1]
 // If filter is specified, only filtered descriptors are returned.
 func (cln *Client) DiscoverDescriptors(ds []ble.UUID, c *ble.Characteristic) ([]*ble.Descriptor, error) {
-	rsp := cln.conn.sendReq(70, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdDiscoverDescriptors, xpc.Dict{
 		"kCBMsgArgDeviceUUID":                cln.id,
 		"kCBMsgArgCharacteristicHandle":      c.Handle,
 		"kCBMsgArgCharacteristicValueHandle": c.ValueHandle,
 		"kCBMsgArgUUIDs":                     uuidSlice(ds),
 	})
+	if err != nil {
+		return nil, err
+	}
+	if err := rsp.err(); err != nil {
+		return nil, err
+	}
 	for _, xds := range rsp.descriptors() {
 		xd := msg(xds.(xpc.Dict))
 		c.Descriptors = append(c.Descriptors, &ble.Descriptor{
@@ -150,11 +165,14 @@ func (cln *Client) DiscoverDescriptors(ds []ble.UUID, c *ble.Characteristic) ([]
 
 // ReadCharacteristic reads a characteristic value from a server. [Vol 3, Part G, 4.8.1]
 func (cln *Client) ReadCharacteristic(c *ble.Characteristic) ([]byte, error) {
-	rsp := cln.conn.sendReq(65, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdReadCharacteristic, xpc.Dict{
 		"kCBMsgArgDeviceUUID":                cln.id,
 		"kCBMsgArgCharacteristicHandle":      c.Handle,
 		"kCBMsgArgCharacteristicValueHandle": c.ValueHandle,
 	})
+	if err != nil {
+		return nil, err
+	}
 	if rsp.err() != nil {
 		return nil, rsp.err()
 	}
@@ -176,37 +194,49 @@ func (cln *Client) WriteCharacteristic(c *ble.Characteristic, b []byte, noRsp bo
 		"kCBMsgArgType":                      map[bool]int{false: 0, true: 1}[noRsp],
 	}
 	if noRsp {
-		cln.conn.sendCmd(66, args)
-		return nil
+		return cln.conn.sendCmd(cmdWriteCharacteristic, args)
+	}
+	m, err := cln.conn.sendReq(cmdWriteCharacteristic, args)
+	if err != nil {
+		return err
 	}
-	return cln.conn.sendReq(66, args).err()
+	return m.err()
 }
 
 // ReadDescriptor reads a characteristic descriptor from a server. [Vol 3, Part G, 4.12.1]
 func (cln *Client) ReadDescriptor(d *ble.Descriptor) ([]byte, error) {
-	rsp := cln.conn.sendReq(77, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdReadDescriptor, xpc.Dict{
 		"kCBMsgArgDeviceUUID":       cln.id,
 		"kCBMsgArgDescriptorHandle": d.Handle,
 	})
-	if rsp.err() != nil {
-		return nil, rsp.err()
+	if err != nil {
+		return nil, err
+	}
+	if err := rsp.err(); err != nil {
+		return nil, err
 	}
 	return rsp.data(), nil
 }
 
 // WriteDescriptor writes a characteristic descriptor to a server. [Vol 3, Part G, 4.12.3]
 func (cln *Client) WriteDescriptor(d *ble.Descriptor, b []byte) error {
-	rsp := cln.conn.sendReq(78, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdWriteDescriptor, xpc.Dict{
 		"kCBMsgArgDeviceUUID":       cln.id,
 		"kCBMsgArgDescriptorHandle": d.Handle,
 		"kCBMsgArgData":             b,
 	})
+	if err != nil {
+		return err
+	}
 	return rsp.err()
 }
 
 // ReadRSSI retrieves the current RSSI value of remote peripheral. [Vol 2, Part E, 7.5.4]
 func (cln *Client) ReadRSSI() int {
-	rsp := cln.conn.sendReq(44, xpc.Dict{"kCBMsgArgDeviceUUID": cln.id})
+	rsp, err := cln.conn.sendReq(cmdReadRSSI, xpc.Dict{"kCBMsgArgDeviceUUID": cln.id})
+	if err != nil {
+		return 0
+	}
 	if rsp.err() != nil {
 		return 0
 	}
@@ -226,15 +256,19 @@ func (cln *Client) Subscribe(c *ble.Characteristic, ind bool, fn ble.Notificatio
 	cln.conn.Lock()
 	defer cln.conn.Unlock()
 	cln.conn.subs[c.Handle] = &sub{fn: fn, char: c}
-	rsp := cln.conn.sendReq(68, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdSubscribeCharacteristic, xpc.Dict{
 		"kCBMsgArgDeviceUUID":                cln.id,
 		"kCBMsgArgCharacteristicHandle":      c.Handle,
 		"kCBMsgArgCharacteristicValueHandle": c.ValueHandle,
 		"kCBMsgArgState":                     1,
 	})
-	if rsp.err() != nil {
+	if err != nil {
+		delete(cln.conn.subs, c.Handle)
+		return err
+	}
+	if err := rsp.err(); err != nil {
 		delete(cln.conn.subs, c.Handle)
-		return rsp.err()
+		return err
 	}
 	return nil
 }
@@ -242,14 +276,17 @@ func (cln *Client) Subscribe(c *ble.Characteristic, ind bool, fn ble.Notificatio
 // Unsubscribe unsubscribes to indication (if ind is set true), or notification
 // of a specified characteristic value. [Vol 3, Part G, 4.10 & 4.11]
 func (cln *Client) Unsubscribe(c *ble.Characteristic, ind bool) error {
-	rsp := cln.conn.sendReq(68, xpc.Dict{
+	rsp, err := cln.conn.sendReq(cmdSubscribeCharacteristic, xpc.Dict{
 		"kCBMsgArgDeviceUUID":                cln.id,
 		"kCBMsgArgCharacteristicHandle":      c.Handle,
 		"kCBMsgArgCharacteristicValueHandle": c.ValueHandle,
 		"kCBMsgArgState":                     0,
 	})
-	if rsp.err() != nil {
-		return rsp.err()
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
+		return err
 	}
 	cln.conn.Lock()
 	defer cln.conn.Unlock()
@@ -260,14 +297,19 @@ func (cln *Client) Unsubscribe(c *ble.Characteristic, ind bool) error {
 // ClearSubscriptions clears all subscriptions to notifications and indications.
 func (cln *Client) ClearSubscriptions() error {
 	for _, s := range cln.conn.subs {
-		cln.Unsubscribe(s.char, false)
+		if err := cln.Unsubscribe(s.char, false); err != nil {
+			return err
+		}
 	}
 	return nil
 }
 
 // CancelConnection disconnects the connection.
 func (cln *Client) CancelConnection() error {
-	rsp := cln.conn.sendReq(32, xpc.Dict{"kCBMsgArgDeviceUUID": cln.id})
+	rsp, err := cln.conn.sendReq(cmdDisconnect, xpc.Dict{"kCBMsgArgDeviceUUID": cln.id})
+	if err != nil {
+		return err
+	}
 	return rsp.err()
 }
 
diff --git a/vendor/github.com/currantlabs/ble/darwin/conn.go b/vendor/github.com/runtimeco/ble/darwin/conn.go
similarity index 81%
rename from vendor/github.com/currantlabs/ble/darwin/conn.go
rename to vendor/github.com/runtimeco/ble/darwin/conn.go
index c0abf35..4f3e6dc 100644
--- a/vendor/github.com/currantlabs/ble/darwin/conn.go
+++ b/vendor/github.com/runtimeco/ble/darwin/conn.go
@@ -1,11 +1,11 @@
 package darwin
 
 import (
+	"context"
+	"log"
 	"sync"
 
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/raff/goble/xpc"
 )
 
@@ -28,7 +28,6 @@ type conn struct {
 	sync.RWMutex
 
 	dev   *Device
-	role  int
 	ctx   context.Context
 	rxMTU int
 	txMTU int
@@ -103,12 +102,12 @@ func (c *conn) subscribed(char *ble.Characteristic) {
 		return
 	}
 	send := func(b []byte) (int, error) {
-		c.dev.sendCmd(c.dev.pm, 15, xpc.Dict{
+		err := c.dev.sendCmd(c.dev.pm, cmdSubscribed, xpc.Dict{
 			"kCBMsgArgUUIDs":       [][]byte{},
 			"kCBMsgArgAttributeID": h,
 			"kCBMsgArgData":        b,
 		})
-		return len(b), nil
+		return len(b), err
 	}
 	n := ble.NewNotifier(send)
 	c.notifiers[h] = n
@@ -119,17 +118,22 @@ func (c *conn) subscribed(char *ble.Characteristic) {
 // server (peripheral)
 func (c *conn) unsubscribed(char *ble.Characteristic) {
 	if n, found := c.notifiers[char.Handle]; found {
-		n.Close()
+		if err := n.Close(); err != nil {
+			log.Printf("failed to clone notifier: %v", err)
+		}
 		delete(c.notifiers, char.Handle)
 	}
 }
 
-func (c *conn) sendReq(id int, args xpc.Dict) msg {
-	c.dev.sendCmd(c.dev.cm, id, args)
+func (c *conn) sendReq(id int, args xpc.Dict) (msg, error) {
+	err := c.dev.sendCmd(c.dev.cm, id, args)
+	if err != nil {
+		return msg{}, err
+	}
 	m := <-c.rspc
-	return msg(m.args())
+	return msg(m.args()), nil
 }
 
-func (c *conn) sendCmd(id int, args xpc.Dict) {
-	c.dev.sendCmd(c.dev.pm, id, args)
+func (c *conn) sendCmd(id int, args xpc.Dict) error {
+	return c.dev.sendCmd(c.dev.pm, id, args)
 }
diff --git a/vendor/github.com/currantlabs/ble/darwin/device.go b/vendor/github.com/runtimeco/ble/darwin/device.go
similarity index 81%
rename from vendor/github.com/currantlabs/ble/darwin/device.go
rename to vendor/github.com/runtimeco/ble/darwin/device.go
index b60a48d..27adebc 100644
--- a/vendor/github.com/currantlabs/ble/darwin/device.go
+++ b/vendor/github.com/runtimeco/ble/darwin/device.go
@@ -2,47 +2,19 @@ package darwin
 
 import (
 	"bytes"
+	"context"
 	"encoding/binary"
 	"fmt"
 	"log"
 	"time"
 
+	"github.com/runtimeco/ble"
 	"github.com/pkg/errors"
 	"github.com/raff/goble/xpc"
-	"golang.org/x/net/context"
 
-	"github.com/currantlabs/ble"
 	"sync"
 )
 
-const (
-	evtStateChanged               = 6
-	evtAdvertisingStarted         = 16
-	evtAdvertisingStopped         = 17
-	evtServiceAdded               = 18
-	evtReadRequest                = 19
-	evtWriteRequest               = 20
-	evtSubscribe                  = 21
-	evtUnubscribe                 = 22
-	evtConfirmation               = 23
-	evtPeripheralDiscovered       = 37
-	evtPeripheralConnected        = 38
-	evtPeripheralDisconnected     = 40
-	evtATTMTU                     = 53
-	evtRSSIRead                   = 55
-	evtServiceDiscovered          = 56
-	evtIncludedServicesDiscovered = 63
-	evtCharacteristicsDiscovered  = 64
-	evtCharacteristicRead         = 71
-	evtCharacteristicWritten      = 72
-	evtNotificationValueSet       = 74
-	evtDescriptorsDiscovered      = 76
-	evtDescriptorRead             = 79
-	evtDescriptorWritten          = 80
-	evtSleveConnectionComplete    = 81
-	evtMasterConnectionComplete   = 82
-)
-
 // Device is either a Peripheral or Central device.
 type Device struct {
 	pm xpc.XPC // peripheralManager
@@ -52,7 +24,7 @@ type Device struct {
 
 	rspc chan msg
 
-	conns map[string]*conn
+	conns    map[string]*conn
 	connLock sync.Mutex
 
 	// Only used in client/centralManager implementation
@@ -66,6 +38,11 @@ type Device struct {
 
 // NewDevice returns a BLE device.
 func NewDevice(opts ...Option) (*Device, error) {
+	err := initXpcIDs()
+	if err != nil {
+		return nil, err
+	}
+
 	d := &Device{
 		rspc:   make(chan msg),
 		conns:  make(map[string]*conn),
@@ -77,8 +54,8 @@ func NewDevice(opts ...Option) (*Device, error) {
 		return nil, err
 	}
 
-	d.pm = xpc.XpcConnect("com.apple.blued", d)
-	d.cm = xpc.XpcConnect("com.apple.blued", d)
+	d.pm = xpc.XpcConnect(serviceID, d)
+	d.cm = xpc.XpcConnect(serviceID, d)
 
 	return d, errors.Wrap(d.Init(), "can't init")
 }
@@ -94,25 +71,31 @@ func (d *Device) Option(opts ...Option) error {
 
 // Init ...
 func (d *Device) Init() error {
-	rsp := d.sendReq(d.cm, 1, xpc.Dict{
+	rsp, err := d.sendReq(d.cm, cmdInit, xpc.Dict{
 		"kCBMsgArgName": fmt.Sprintf("gopher-%v", time.Now().Unix()),
 		"kCBMsgArgOptions": xpc.Dict{
 			"kCBInitOptionShowPowerAlert": 1,
 		},
 		"kCBMsgArgType": 0,
 	})
+	if err != nil {
+		return err
+	}
 	s := State(rsp.state())
 	if s != StatePoweredOn {
 		return fmt.Errorf("state: %s", s)
 	}
 
-	rsp = d.sendReq(d.pm, 1, xpc.Dict{
+	rsp, err = d.sendReq(d.pm, cmdInit, xpc.Dict{
 		"kCBMsgArgName": fmt.Sprintf("gopher-%v", time.Now().Unix()),
 		"kCBMsgArgOptions": xpc.Dict{
 			"kCBInitOptionShowPowerAlert": 1,
 		},
 		"kCBMsgArgType": 1,
 	})
+	if err != nil {
+		return err
+	}
 	s = State(rsp.state())
 	if s != StatePoweredOn {
 		return fmt.Errorf("state: %s", s)
@@ -120,13 +103,36 @@ func (d *Device) Init() error {
 	return nil
 }
 
+// Advertise advertises the given Advertisement
+func (d *Device) Advertise(ctx context.Context, adv ble.Advertisement) error {
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStart, xpc.Dict{
+		"kCBAdvDataLocalName":    adv.LocalName(),
+		"kCBAdvDataServiceUUIDs": adv.Services(),
+		"kCBAdvDataAppleMfgData": adv.ManufacturerData(),
+	})
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
+		return err
+	}
+	<-ctx.Done()
+	_ = d.stopAdvertising()
+	return ctx.Err()
+
+}
+
 // AdvertiseMfgData ...
 func (d *Device) AdvertiseMfgData(ctx context.Context, id uint16, md []byte) error {
 	l := len(md)
 	b := []byte{byte(l + 3), 0xFF, uint8(id), uint8(id >> 8)}
-	if err := d.sendReq(d.pm, 8, xpc.Dict{
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStart, xpc.Dict{
 		"kCBAdvDataAppleMfgData": append(b, md...),
-	}).err(); err != nil {
+	})
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
 		return errors.Wrap(err, "can't advertise")
 	}
 	<-ctx.Done()
@@ -140,9 +146,13 @@ func (d *Device) AdvertiseServiceData16(ctx context.Context, id uint16, b []byte
 		0x03, 0x03, uint8(id), uint8(id >> 8),
 		byte(l + 3), 0x16, uint8(id), uint8(id >> 8),
 	}
-	if err := d.sendReq(d.pm, 8, xpc.Dict{
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStart, xpc.Dict{
 		"kCBAdvDataAppleMfgData": append(prefix, b...),
-	}).err(); err != nil {
+	})
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
 		return errors.Wrap(err, "can't advertise")
 	}
 	<-ctx.Done()
@@ -151,27 +161,38 @@ func (d *Device) AdvertiseServiceData16(ctx context.Context, id uint16, b []byte
 
 // AdvertiseNameAndServices advertises name and specifid service UUIDs.
 func (d *Device) AdvertiseNameAndServices(ctx context.Context, name string, ss ...ble.UUID) error {
-	if err := d.sendReq(d.pm, 8, xpc.Dict{
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStart, xpc.Dict{
 		"kCBAdvDataLocalName":    name,
 		"kCBAdvDataServiceUUIDs": uuidSlice(ss)},
-	).err(); err != nil {
+	)
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
 		return err
 	}
 	<-ctx.Done()
-	d.stopAdvertising()
+	_ = d.stopAdvertising()
 	return ctx.Err()
 }
 
 // AdvertiseIBeaconData advertises iBeacon packet with specified manufacturer data.
 func (d *Device) AdvertiseIBeaconData(ctx context.Context, md []byte) error {
 	var utsname xpc.Utsname
-	xpc.Uname(&utsname)
+	err := xpc.Uname(&utsname)
+	if err != nil {
+		return err
+	}
 
 	if utsname.Release >= "14." {
 		ibeaconCode := []byte{0x02, 0x15}
 		return d.AdvertiseMfgData(ctx, 0x004C, append(ibeaconCode, md...))
 	}
-	if err := d.sendReq(d.pm, 8, xpc.Dict{"kCBAdvDataAppleBeaconKey": md}).err(); err != nil {
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStart, xpc.Dict{"kCBAdvDataAppleBeaconKey": md})
+	if err != nil {
+		return err
+	}
+	if err := rsp.err(); err != nil {
 		return err
 	}
 	<-ctx.Done()
@@ -190,13 +211,20 @@ func (d *Device) AdvertiseIBeacon(ctx context.Context, u ble.UUID, major, minor
 
 // stopAdvertising stops advertising.
 func (d *Device) stopAdvertising() error {
-	return errors.Wrap(d.sendReq(d.pm, 9, nil).err(), "can't stop advertising")
+	rsp, err := d.sendReq(d.pm, cmdAdvertiseStop, nil)
+	if err != nil {
+		return errors.Wrap(err, "can't send stop advertising")
+	}
+	if err := rsp.err(); err != nil {
+		return errors.Wrap(err, "can't stop advertising")
+	}
+	return nil
 }
 
 // Scan ...
 func (d *Device) Scan(ctx context.Context, allowDup bool, h ble.AdvHandler) error {
 	d.advHandler = h
-	if err := d.sendCmd(d.cm, 29, xpc.Dict{
+	if err := d.sendCmd(d.cm, cmdScanningStart, xpc.Dict{
 		// "kCBMsgArgUUIDs": uuidSlice(ss),
 		"kCBMsgArgOptions": xpc.Dict{
 			"kCBScanOptionAllowDuplicates": map[bool]int{true: 1, false: 0}[allowDup],
@@ -213,12 +241,12 @@ func (d *Device) Scan(ctx context.Context, allowDup bool, h ble.AdvHandler) erro
 
 // stopAdvertising stops advertising.
 func (d *Device) stopScanning() error {
-	return errors.Wrap(d.sendCmd(d.cm, 30, nil), "can't stop scanning")
+	return errors.Wrap(d.sendCmd(d.cm, cmdScanningStop, nil), "can't stop scanning")
 }
 
 // RemoveAllServices removes all services of device's
 func (d *Device) RemoveAllServices() error {
-	return d.sendCmd(d.pm, 12, nil)
+	return d.sendCmd(d.pm, cmdServicesRemove, nil)
 }
 
 // AddService adds a service to device's database.
@@ -319,7 +347,11 @@ func (d *Device) AddService(s *ble.Service) error {
 	}
 	xs["kCBMsgArgCharacteristics"] = xcs
 
-	return d.sendReq(d.pm, 10, xs).err()
+	rsp, err := d.sendReq(d.pm, cmdServicesAdd, xs)
+	if err != nil {
+		return err
+	}
+	return rsp.err()
 }
 
 // SetServices ...
@@ -337,12 +369,15 @@ func (d *Device) SetServices(ss []*ble.Service) error {
 
 // Dial ...
 func (d *Device) Dial(ctx context.Context, a ble.Addr) (ble.Client, error) {
-	d.sendCmd(d.cm, 31, xpc.Dict{
+	err := d.sendCmd(d.cm, cmdConnect, xpc.Dict{
 		"kCBMsgArgDeviceUUID": xpc.MakeUUID(a.String()),
 		"kCBMsgArgOptions": xpc.Dict{
 			"kCBConnectOptionNotifyOnDisconnection": 1,
 		},
 	})
+	if err != nil {
+		return nil, err
+	}
 	select {
 	case <-ctx.Done():
 		return nil, ctx.Err()
@@ -388,7 +423,7 @@ func (d *Device) HandleXpcEvent(event xpc.Dict, err error) {
 	case evtATTMTU:
 		d.conn(args).SetTxMTU(args.attMTU())
 
-	case evtSleveConnectionComplete:
+	case evtSlaveConnectionComplete:
 		// remote peripheral is connected.
 		fallthrough
 	case evtMasterConnectionComplete:
@@ -413,13 +448,16 @@ func (d *Device) HandleXpcEvent(event xpc.Dict, err error) {
 			v = buf.Bytes()
 		}
 
-		d.sendCmd(d.pm, 13, xpc.Dict{
+		err := d.sendCmd(d.pm, cmdSendData, xpc.Dict{
 			"kCBMsgArgAttributeID":   aid,
 			"kCBMsgArgData":          v,
 			"kCBMsgArgTransactionID": args.transactionID(),
 			"kCBMsgArgResult":        0,
 		})
-
+		if err != nil {
+			log.Printf("error: %v", err)
+			return
+		}
 	case evtWriteRequest:
 		for _, xxw := range args.attWrites() {
 			xw := msg(xxw.(xpc.Dict))
@@ -430,19 +468,23 @@ func (d *Device) HandleXpcEvent(event xpc.Dict, err error) {
 			if xw.ignoreResponse() == 1 {
 				continue
 			}
-			d.sendCmd(d.pm, 13, xpc.Dict{
+			err := d.sendCmd(d.pm, cmdSendData, xpc.Dict{
 				"kCBMsgArgAttributeID":   aid,
 				"kCBMsgArgData":          nil,
 				"kCBMsgArgTransactionID": args.transactionID(),
 				"kCBMsgArgResult":        0,
 			})
+			if err != nil {
+				log.Println("error:", err)
+				return
+			}
 		}
 
 	case evtSubscribe:
 		// characteristic is subscribed by remote central.
 		d.conn(args).subscribed(d.chars[args.attributeID()])
 
-	case evtUnubscribe:
+	case evtUnsubscribe:
 		// characteristic is unsubscribed by remote central.
 		d.conn(args).unsubscribed(d.chars[args.attributeID()])
 
@@ -509,9 +551,12 @@ func (d *Device) conn(m msg) *conn {
 }
 
 // sendReq sends a message and waits for its reply.
-func (d *Device) sendReq(x xpc.XPC, id int, args xpc.Dict) msg {
-	d.sendCmd(x, id, args)
-	return <-d.rspc
+func (d *Device) sendReq(x xpc.XPC, id int, args xpc.Dict) (msg, error) {
+	err := d.sendCmd(x, id, args)
+	if err != nil {
+		return msg{}, err
+	}
+	return <-d.rspc, nil
 }
 
 func (d *Device) sendCmd(x xpc.XPC, id int, args xpc.Dict) error {
diff --git a/vendor/github.com/currantlabs/ble/darwin/log.go b/vendor/github.com/runtimeco/ble/darwin/log.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/darwin/log.go
rename to vendor/github.com/runtimeco/ble/darwin/log.go
diff --git a/vendor/github.com/currantlabs/ble/darwin/msg.go b/vendor/github.com/runtimeco/ble/darwin/msg.go
similarity index 96%
rename from vendor/github.com/currantlabs/ble/darwin/msg.go
rename to vendor/github.com/runtimeco/ble/darwin/msg.go
index 7ad170b..04557c1 100644
--- a/vendor/github.com/currantlabs/ble/darwin/msg.go
+++ b/vendor/github.com/runtimeco/ble/darwin/msg.go
@@ -1,7 +1,7 @@
 package darwin
 
 import (
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/raff/goble/xpc"
 )
 
@@ -35,7 +35,7 @@ func (m msg) deviceUUID() xpc.UUID       { return xpc.Dict(m).MustGetUUID("kCBMs
 func (m msg) ignoreResponse() int        { return xpc.Dict(m).MustGetInt("kCBMsgArgIgnoreResponse") }
 func (m msg) offset() int                { return xpc.Dict(m).MustGetInt("kCBMsgArgOffset") }
 func (m msg) isNotification() int        { return xpc.Dict(m).GetInt("kCBMsgArgIsNotification", 0) }
-func (m msg) result() int                { return xpc.Dict(m).MustGetInt("kCBMsgArgResult") }
+func (m msg) result() int                { return xpc.Dict(m).GetInt("kCBMsgArgResult", 0) }
 func (m msg) state() int                 { return xpc.Dict(m).MustGetInt("kCBMsgArgState") }
 func (m msg) rssi() int                  { return xpc.Dict(m).MustGetInt("kCBMsgArgData") }
 func (m msg) transactionID() int         { return xpc.Dict(m).MustGetInt("kCBMsgArgTransactionID") }
diff --git a/vendor/github.com/currantlabs/ble/darwin/option.go b/vendor/github.com/runtimeco/ble/darwin/option.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/darwin/option.go
rename to vendor/github.com/runtimeco/ble/darwin/option.go
diff --git a/vendor/github.com/currantlabs/ble/darwin/state.go b/vendor/github.com/runtimeco/ble/darwin/state.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/darwin/state.go
rename to vendor/github.com/runtimeco/ble/darwin/state.go
diff --git a/vendor/github.com/currantlabs/ble/darwin/util.go b/vendor/github.com/runtimeco/ble/darwin/util.go
similarity index 80%
rename from vendor/github.com/currantlabs/ble/darwin/util.go
rename to vendor/github.com/runtimeco/ble/darwin/util.go
index 8fdb251..6471b13 100644
--- a/vendor/github.com/currantlabs/ble/darwin/util.go
+++ b/vendor/github.com/runtimeco/ble/darwin/util.go
@@ -1,6 +1,6 @@
 package darwin
 
-import "github.com/currantlabs/ble"
+import "github.com/runtimeco/ble"
 
 func uuidSlice(uu []ble.UUID) [][]byte {
 	us := [][]byte{}
diff --git a/vendor/github.com/runtimeco/ble/darwin/xpcid.go b/vendor/github.com/runtimeco/ble/darwin/xpcid.go
new file mode 100644
index 0000000..12aac65
--- /dev/null
+++ b/vendor/github.com/runtimeco/ble/darwin/xpcid.go
@@ -0,0 +1,170 @@
+package darwin
+
+import (
+	"github.com/raff/goble/xpc"
+)
+
+// xpc command IDs are OS X version specific, so we will use a map
+// to be able to handle arbitrary versions
+var (
+	cmdInit,
+	cmdAdvertiseStart,
+	cmdAdvertiseStop,
+	cmdScanningStart,
+	cmdScanningStop,
+	cmdServicesAdd,
+	cmdServicesRemove,
+	cmdSendData,
+	cmdSubscribed,
+	cmdConnect,
+	cmdDisconnect,
+	cmdReadRSSI,
+	cmdDiscoverServices,
+	cmdDiscoverIncludedServices,
+	cmdDiscoverCharacteristics,
+	cmdReadCharacteristic,
+	cmdWriteCharacteristic,
+	cmdSubscribeCharacteristic,
+	cmdDiscoverDescriptors,
+	cmdReadDescriptor,
+	cmdWriteDescriptor,
+	evtStateChanged,
+	evtAdvertisingStarted,
+	evtAdvertisingStopped,
+	evtServiceAdded,
+	evtReadRequest,
+	evtWriteRequest,
+	evtSubscribe,
+	evtUnsubscribe,
+	evtConfirmation,
+	evtPeripheralDiscovered,
+	evtPeripheralConnected,
+	evtPeripheralDisconnected,
+	evtATTMTU,
+	evtRSSIRead,
+	evtServiceDiscovered,
+	evtIncludedServicesDiscovered,
+	evtCharacteristicsDiscovered,
+	evtCharacteristicRead,
+	evtCharacteristicWritten,
+	evtNotificationValueSet,
+	evtDescriptorsDiscovered,
+	evtDescriptorRead,
+	evtDescriptorWritten,
+	evtSlaveConnectionComplete,
+	evtMasterConnectionComplete int
+)
+
+var serviceID string
+
+func initXpcIDs() error {
+	var utsname xpc.Utsname
+	err := xpc.Uname(&utsname)
+	if err != nil {
+		return err
+	}
+
+	cmdInit = 1
+	cmdAdvertiseStart = 8
+	cmdAdvertiseStop = 9
+	cmdServicesAdd = 10
+	cmdServicesRemove = 12
+
+	if utsname.Release < "17." {
+		// yosemite
+		cmdSendData = 13
+		cmdSubscribed = 15
+		cmdScanningStart = 29
+		cmdScanningStop = 30
+		cmdConnect = 31
+		cmdDisconnect = 32
+		cmdReadRSSI = 44
+		cmdDiscoverServices = 45
+		cmdDiscoverIncludedServices = 60
+		cmdDiscoverCharacteristics = 62
+		cmdReadCharacteristic = 65
+		cmdWriteCharacteristic = 66
+		cmdSubscribeCharacteristic = 68
+		cmdDiscoverDescriptors = 70
+		cmdReadDescriptor = 77
+		cmdWriteDescriptor = 78
+
+		evtStateChanged = 6
+		evtAdvertisingStarted = 16
+		evtAdvertisingStopped = 17
+		evtServiceAdded = 18
+		evtReadRequest = 19
+		evtWriteRequest = 20
+		evtSubscribe = 21
+		evtUnsubscribe = 22
+		evtConfirmation = 23
+		evtPeripheralDiscovered = 37
+		evtPeripheralConnected = 38
+		evtPeripheralDisconnected = 40
+		evtATTMTU = 53
+		evtRSSIRead = 55
+		evtServiceDiscovered = 56
+		evtIncludedServicesDiscovered = 63
+		evtCharacteristicsDiscovered = 64
+		evtCharacteristicRead = 71
+		evtCharacteristicWritten = 72
+		evtNotificationValueSet = 74
+		evtDescriptorsDiscovered = 76
+		evtDescriptorRead = 79
+		evtDescriptorWritten = 80
+		evtSlaveConnectionComplete = 81
+		evtMasterConnectionComplete = 82
+
+		serviceID = "com.apple.blued"
+	} else {
+		// high sierra
+		cmdSendData = 13 // TODO: find out the correct value for this
+		cmdScanningStart = 44
+		cmdScanningStop = 45
+		cmdConnect = 46
+		cmdDisconnect = 47
+		cmdReadRSSI = 61
+		cmdDiscoverServices = 62
+		cmdDiscoverIncludedServices = 74
+		cmdDiscoverCharacteristics = 75
+		cmdReadCharacteristic = 78
+		cmdWriteCharacteristic = 79
+		cmdSubscribeCharacteristic = 81
+		cmdDiscoverDescriptors = 82
+		cmdReadDescriptor = 88
+		cmdWriteDescriptor = 89
+
+		evtStateChanged = 4
+		evtPeripheralDiscovered = 48
+		evtPeripheralConnected = 49
+		evtPeripheralDisconnected = 50
+		evtRSSIRead = 71
+		evtServiceDiscovered = 72
+		evtCharacteristicsDiscovered = 77
+		evtCharacteristicRead = 83
+		evtCharacteristicWritten = 84
+		evtNotificationValueSet = 86
+		evtDescriptorsDiscovered = 87
+		evtDescriptorRead = 90
+		evtDescriptorWritten = 91
+
+		// TODO: find out the correct values for the following items.
+		// They have all just been copied from Yosemite values
+		evtAdvertisingStarted = 16
+		evtAdvertisingStopped = 17
+		evtServiceAdded = 18
+		evtReadRequest = 19
+		evtWriteRequest = 20
+		evtSubscribe = 21
+		evtUnsubscribe = 22
+		evtConfirmation = 23
+		evtATTMTU = 53
+		evtSlaveConnectionComplete = 81
+		evtMasterConnectionComplete = 82
+		evtIncludedServicesDiscovered = 87
+
+		serviceID = "com.apple.bluetoothd"
+	}
+
+	return nil
+}
diff --git a/vendor/github.com/currantlabs/ble/dev.go b/vendor/github.com/runtimeco/ble/device.go
similarity index 92%
rename from vendor/github.com/currantlabs/ble/dev.go
rename to vendor/github.com/runtimeco/ble/device.go
index 8d293cd..ced686e 100644
--- a/vendor/github.com/currantlabs/ble/dev.go
+++ b/vendor/github.com/runtimeco/ble/device.go
@@ -1,6 +1,6 @@
 package ble
 
-import "golang.org/x/net/context"
+import "context"
 
 // Device ...
 type Device interface {
@@ -17,6 +17,9 @@ type Device interface {
 	// Stop detatch the GATT server from a peripheral device.
 	Stop() error
 
+	// Advertise advertises a given Advertisement
+	Advertise(ctx context.Context, adv Advertisement) error
+
 	// AdvertiseNameAndServices advertises device name, and specified service UUIDs.
 	// It tres to fit the UUIDs in the advertising packet as much as possi
 	// If name doesn't fit in the advertising packet, it will be put in scan response.
diff --git a/vendor/github.com/currantlabs/ble/error.go b/vendor/github.com/runtimeco/ble/error.go
similarity index 99%
rename from vendor/github.com/currantlabs/ble/error.go
rename to vendor/github.com/runtimeco/ble/error.go
index b66295e..f79a5b4 100644
--- a/vendor/github.com/currantlabs/ble/error.go
+++ b/vendor/github.com/runtimeco/ble/error.go
@@ -50,7 +50,7 @@ func (e ATTError) Error() string {
 	case i >= 0xE0 && i <= 0xFF: // Common profile and service error codes.
 		return "profile or service error"
 	}
-	return "unkown error"
+	return "unknown error"
 }
 
 var errName = map[ATTError]string{
diff --git a/vendor/github.com/currantlabs/ble/examples/basic/advertiser/main.go b/vendor/github.com/runtimeco/ble/examples/basic/advertiser/main.go
similarity index 88%
rename from vendor/github.com/currantlabs/ble/examples/basic/advertiser/main.go
rename to vendor/github.com/runtimeco/ble/examples/basic/advertiser/main.go
index f9aad6b..e1797c5 100644
--- a/vendor/github.com/currantlabs/ble/examples/basic/advertiser/main.go
+++ b/vendor/github.com/runtimeco/ble/examples/basic/advertiser/main.go
@@ -1,16 +1,15 @@
 package main
 
 import (
+	"context"
 	"flag"
 	"fmt"
 	"log"
 	"time"
 
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib/dev"
 	"github.com/pkg/errors"
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib/dev"
 )
 
 var (
diff --git a/vendor/github.com/currantlabs/ble/examples/basic/explorer/main.go b/vendor/github.com/runtimeco/ble/examples/basic/explorer/main.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/examples/basic/explorer/main.go
rename to vendor/github.com/runtimeco/ble/examples/basic/explorer/main.go
index 4ff3777..5c29042 100644
--- a/vendor/github.com/currantlabs/ble/examples/basic/explorer/main.go
+++ b/vendor/github.com/runtimeco/ble/examples/basic/explorer/main.go
@@ -1,17 +1,16 @@
 package main
 
 import (
+	"context"
 	"flag"
 	"fmt"
 	"log"
 	"strings"
 	"time"
 
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib/dev"
 	"github.com/pkg/errors"
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib/dev"
 )
 
 var (
@@ -39,7 +38,7 @@ func main() {
 	// If addr is specified, search for addr instead.
 	if len(*addr) != 0 {
 		filter = func(a ble.Advertisement) bool {
-			return strings.ToUpper(a.Address().String()) == strings.ToUpper(*addr)
+			return strings.ToUpper(a.Addr().String()) == strings.ToUpper(*addr)
 		}
 	}
 
@@ -58,7 +57,7 @@ func main() {
 	// So we wait(detect) the disconnection in the go routine.
 	go func() {
 		<-cln.Disconnected()
-		fmt.Printf("[ %s ] is disconnected \n", cln.Address())
+		fmt.Printf("[ %s ] is disconnected \n", cln.Addr())
 		close(done)
 	}()
 
@@ -72,7 +71,7 @@ func main() {
 	explore(cln, p)
 
 	// Disconnect the connection. (On OS X, this might take a while.)
-	fmt.Printf("Disconnecting [ %s ]... (this might take up to few seconds on OS X)\n", cln.Address())
+	fmt.Printf("Disconnecting [ %s ]... (this might take up to few seconds on OS X)\n", cln.Addr())
 	cln.CancelConnection()
 
 	<-done
diff --git a/vendor/github.com/currantlabs/ble/examples/basic/scanner/main.go b/vendor/github.com/runtimeco/ble/examples/basic/scanner/main.go
similarity index 85%
rename from vendor/github.com/currantlabs/ble/examples/basic/scanner/main.go
rename to vendor/github.com/runtimeco/ble/examples/basic/scanner/main.go
index 4445e92..216b0e5 100644
--- a/vendor/github.com/currantlabs/ble/examples/basic/scanner/main.go
+++ b/vendor/github.com/runtimeco/ble/examples/basic/scanner/main.go
@@ -1,16 +1,15 @@
 package main
 
 import (
+	"context"
 	"flag"
 	"fmt"
 	"log"
 	"time"
 
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib/dev"
 	"github.com/pkg/errors"
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib/dev"
 )
 
 var (
@@ -36,9 +35,9 @@ func main() {
 
 func advHandler(a ble.Advertisement) {
 	if a.Connectable() {
-		fmt.Printf("[%s] C %3d:", a.Address(), a.RSSI())
+		fmt.Printf("[%s] C %3d:", a.Addr(), a.RSSI())
 	} else {
-		fmt.Printf("[%s] N %3d:", a.Address(), a.RSSI())
+		fmt.Printf("[%s] N %3d:", a.Addr(), a.RSSI())
 	}
 	comma := ""
 	if len(a.LocalName()) > 0 {
diff --git a/vendor/github.com/currantlabs/ble/examples/basic/server/main.go b/vendor/github.com/runtimeco/ble/examples/basic/server/main.go
similarity index 88%
rename from vendor/github.com/currantlabs/ble/examples/basic/server/main.go
rename to vendor/github.com/runtimeco/ble/examples/basic/server/main.go
index 39e0737..9830adc 100644
--- a/vendor/github.com/currantlabs/ble/examples/basic/server/main.go
+++ b/vendor/github.com/runtimeco/ble/examples/basic/server/main.go
@@ -1,17 +1,16 @@
 package main
 
 import (
+	"context"
 	"flag"
 	"fmt"
 	"log"
 	"time"
 
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib"
+	"github.com/runtimeco/ble/examples/lib/dev"
 	"github.com/pkg/errors"
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib"
-	"github.com/currantlabs/ble/examples/lib/dev"
 )
 
 var (
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/README.md b/vendor/github.com/runtimeco/ble/examples/blesh/README.md
similarity index 100%
rename from vendor/github.com/currantlabs/ble/examples/blesh/README.md
rename to vendor/github.com/runtimeco/ble/examples/blesh/README.md
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/adv.go b/vendor/github.com/runtimeco/ble/examples/blesh/adv.go
similarity index 77%
rename from vendor/github.com/currantlabs/ble/examples/blesh/adv.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/adv.go
index 25b1770..6da98fe 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/adv.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/adv.go
@@ -3,15 +3,15 @@ package main
 import (
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 func advHandler(a ble.Advertisement) {
-	curr.addr = a.Address()
+	curr.addr = a.Addr()
 	if a.Connectable() {
-		fmt.Printf("[%s] C %3d:", a.Address(), a.RSSI())
+		fmt.Printf("[%s] C %3d:", a.Addr(), a.RSSI())
 	} else {
-		fmt.Printf("[%s] N %3d:", a.Address(), a.RSSI())
+		fmt.Printf("[%s] N %3d:", a.Addr(), a.RSSI())
 	}
 	comma := ""
 	if len(a.LocalName()) > 0 {
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/exp.go b/vendor/github.com/runtimeco/ble/examples/blesh/exp.go
similarity index 97%
rename from vendor/github.com/currantlabs/ble/examples/blesh/exp.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/exp.go
index 47fe634..6a42d78 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/exp.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/exp.go
@@ -3,7 +3,7 @@ package main
 import (
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 func explore(cln ble.Client, p *ble.Profile) error {
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/filter.go b/vendor/github.com/runtimeco/ble/examples/blesh/filter.go
similarity index 85%
rename from vendor/github.com/currantlabs/ble/examples/blesh/filter.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/filter.go
index 52283c2..7a24fcc 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/filter.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/filter.go
@@ -3,7 +3,7 @@ package main
 import (
 	"strings"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/urfave/cli"
 )
 
@@ -15,7 +15,7 @@ func filter(c *cli.Context) ble.AdvFilter {
 	}
 	if c.String("addr") != "" {
 		return func(a ble.Advertisement) bool {
-			return a.Address().String() == strings.ToLower(c.String("addr"))
+			return a.Addr().String() == strings.ToLower(c.String("addr"))
 		}
 	}
 	if svc := strings.ToLower(c.String("svc")); svc != "" {
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/flg.go b/vendor/github.com/runtimeco/ble/examples/blesh/flg.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/examples/blesh/flg.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/flg.go
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/lnx.go b/vendor/github.com/runtimeco/ble/examples/blesh/lnx.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/examples/blesh/lnx.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/lnx.go
index f68ba49..db8717a 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/lnx.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/lnx.go
@@ -1,9 +1,9 @@
 package main
 
 import (
-	"github.com/currantlabs/ble/linux"
-	"github.com/currantlabs/ble/linux/hci"
-	"github.com/currantlabs/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux"
+	"github.com/runtimeco/ble/linux/hci"
+	"github.com/runtimeco/ble/linux/hci/cmd"
 	"github.com/pkg/errors"
 )
 
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/main.go b/vendor/github.com/runtimeco/ble/examples/blesh/main.go
similarity index 95%
rename from vendor/github.com/currantlabs/ble/examples/blesh/main.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/main.go
index b7f9363..e149574 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/main.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/main.go
@@ -2,21 +2,19 @@ package main
 
 import (
 	"bufio"
+	"context"
 	"fmt"
 	"os"
 	"os/signal"
 	"strings"
 	"syscall"
 
-	"golang.org/x/net/context"
-
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/examples/lib"
+	"github.com/runtimeco/ble/examples/lib/dev"
+	"github.com/runtimeco/ble/linux"
 	"github.com/pkg/errors"
 	"github.com/urfave/cli"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/examples/lib"
-	"github.com/currantlabs/ble/examples/lib/dev"
-	"github.com/currantlabs/ble/linux"
 )
 
 var curr struct {
@@ -243,7 +241,7 @@ func cmdConnect(c *cli.Context) error {
 	} else if filter(c) != nil {
 		fmt.Printf("Scanning with filter...\n")
 		if cln, err = ble.Connect(ctx, filter(c)); err == nil {
-			curr.addr = cln.Address()
+			curr.addr = cln.Addr()
 			fmt.Printf("Connected to %s\n", curr.addr)
 
 		}
@@ -255,13 +253,13 @@ func cmdConnect(c *cli.Context) error {
 	}
 	if err == nil {
 		curr.client = cln
-		curr.clients[cln.Address().String()] = cln
+		curr.clients[cln.Addr().String()] = cln
 	}
 	go func() {
 		<-cln.Disconnected()
-		delete(curr.clients, cln.Address().String())
+		delete(curr.clients, cln.Addr().String())
 		curr.client = nil
-		fmt.Printf("\n%s disconnected\n", cln.Address().String())
+		fmt.Printf("\n%s disconnected\n", cln.Addr().String())
 	}()
 	return err
 }
@@ -274,12 +272,12 @@ func cmdDisconnect(c *cli.Context) error {
 		return errNotConnected
 	}
 	defer func() {
-		delete(curr.clients, curr.client.Address().String())
+		delete(curr.clients, curr.client.Addr().String())
 		curr.client = nil
 		curr.profile = nil
 	}()
 
-	fmt.Printf("Disconnecting [ %s ]... (this might take up to few seconds on OS X)\n", curr.client.Address())
+	fmt.Printf("Disconnecting [ %s ]... (this might take up to few seconds on OS X)\n", curr.client.Addr())
 	return curr.client.CancelConnection()
 }
 
diff --git a/vendor/github.com/currantlabs/ble/examples/blesh/util.go b/vendor/github.com/runtimeco/ble/examples/blesh/util.go
similarity index 93%
rename from vendor/github.com/currantlabs/ble/examples/blesh/util.go
rename to vendor/github.com/runtimeco/ble/examples/blesh/util.go
index 34e3741..5cd7e17 100644
--- a/vendor/github.com/currantlabs/ble/examples/blesh/util.go
+++ b/vendor/github.com/runtimeco/ble/examples/blesh/util.go
@@ -1,12 +1,12 @@
 package main
 
 import (
+	"context"
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/pkg/errors"
 	"github.com/urfave/cli"
-	"golang.org/x/net/context"
 )
 
 func doGetUUID(c *cli.Context) error {
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/battery.go b/vendor/github.com/runtimeco/ble/examples/lib/battery.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/examples/lib/battery.go
rename to vendor/github.com/runtimeco/ble/examples/lib/battery.go
index 47a0b1f..3ef5d4a 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/battery.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/battery.go
@@ -1,6 +1,6 @@
 package lib
 
-import "github.com/currantlabs/ble"
+import "github.com/runtimeco/ble"
 
 // NewBatteryService ...
 func NewBatteryService() *ble.Service {
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/count.go b/vendor/github.com/runtimeco/ble/examples/lib/count.go
similarity index 98%
rename from vendor/github.com/currantlabs/ble/examples/lib/count.go
rename to vendor/github.com/runtimeco/ble/examples/lib/count.go
index ea1e2c7..6f57f75 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/count.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/count.go
@@ -5,7 +5,7 @@ import (
 	"log"
 	"time"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 // NewCountChar ...
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/dev/default_darwin.go b/vendor/github.com/runtimeco/ble/examples/lib/dev/default_darwin.go
similarity index 64%
rename from vendor/github.com/currantlabs/ble/examples/lib/dev/default_darwin.go
rename to vendor/github.com/runtimeco/ble/examples/lib/dev/default_darwin.go
index 5200989..cb9c04e 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/dev/default_darwin.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/dev/default_darwin.go
@@ -1,8 +1,8 @@
 package dev
 
 import (
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/darwin"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/darwin"
 )
 
 // DefaultDevice ...
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/dev/default_linux.go b/vendor/github.com/runtimeco/ble/examples/lib/dev/default_linux.go
similarity index 65%
rename from vendor/github.com/currantlabs/ble/examples/lib/dev/default_linux.go
rename to vendor/github.com/runtimeco/ble/examples/lib/dev/default_linux.go
index 7d31388..75523b2 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/dev/default_linux.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/dev/default_linux.go
@@ -1,8 +1,8 @@
 package dev
 
 import (
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux"
 )
 
 // DefaultDevice ...
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/dev/dev.go b/vendor/github.com/runtimeco/ble/examples/lib/dev/dev.go
similarity index 75%
rename from vendor/github.com/currantlabs/ble/examples/lib/dev/dev.go
rename to vendor/github.com/runtimeco/ble/examples/lib/dev/dev.go
index 6ff46c3..3acf807 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/dev/dev.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/dev/dev.go
@@ -1,6 +1,6 @@
 package dev
 
-import "github.com/currantlabs/ble"
+import "github.com/runtimeco/ble"
 
 // NewDevice ...
 func NewDevice(impl string) (d ble.Device, err error) {
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/echo.go b/vendor/github.com/runtimeco/ble/examples/lib/echo.go
similarity index 97%
rename from vendor/github.com/currantlabs/ble/examples/lib/echo.go
rename to vendor/github.com/runtimeco/ble/examples/lib/echo.go
index 472471d..56b7a86 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/echo.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/echo.go
@@ -5,7 +5,7 @@ import (
 	"sync"
 	"time"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 // NewEchoChar ...
diff --git a/vendor/github.com/currantlabs/ble/examples/lib/uuids.go b/vendor/github.com/runtimeco/ble/examples/lib/uuids.go
similarity index 91%
rename from vendor/github.com/currantlabs/ble/examples/lib/uuids.go
rename to vendor/github.com/runtimeco/ble/examples/lib/uuids.go
index 15d546d..f90c037 100644
--- a/vendor/github.com/currantlabs/ble/examples/lib/uuids.go
+++ b/vendor/github.com/runtimeco/ble/examples/lib/uuids.go
@@ -1,6 +1,6 @@
 package lib
 
-import "github.com/currantlabs/ble"
+import "github.com/runtimeco/ble"
 
 // Private 128-bit UUIDs, which avoids the base of pre-defined 16/32-bits UUIDS
 // xxxxxxxx-0000-1000-8000-00805F9B34FB [Vol 3, Part B, 2.5.1].
diff --git a/vendor/github.com/currantlabs/ble/gatt.go b/vendor/github.com/runtimeco/ble/gatt.go
similarity index 96%
rename from vendor/github.com/currantlabs/ble/gatt.go
rename to vendor/github.com/runtimeco/ble/gatt.go
index e157d29..ae8fcc0 100644
--- a/vendor/github.com/currantlabs/ble/gatt.go
+++ b/vendor/github.com/runtimeco/ble/gatt.go
@@ -1,13 +1,12 @@
 package ble
 
 import (
+	"context"
 	"os"
 	"os/signal"
 	"syscall"
 
 	"github.com/pkg/errors"
-
-	"golang.org/x/net/context"
 )
 
 // ErrDefaultDevice ...
@@ -145,7 +144,7 @@ func Connect(ctx context.Context, f AdvFilter) (Client, error) {
 		}
 	}
 
-	cln, err := Dial(ctx, (<-ch).Address())
+	cln, err := Dial(ctx, (<-ch).Addr())
 	return cln, errors.Wrap(err, "can't dial")
 }
 
@@ -154,12 +153,12 @@ type NotificationHandler func(req []byte)
 
 // WithSigHandler ...
 func WithSigHandler(ctx context.Context, cancel func()) context.Context {
-	return context.WithValue(ctx, "sig", cancel)
+	return context.WithValue(ctx, ContextKeySig, cancel)
 }
 
 // Cleanup for the interrupted case.
 func trap(ctx context.Context) chan<- os.Signal {
-	v := ctx.Value("sig")
+	v := ctx.Value(ContextKeySig)
 	if v == nil {
 		return nil
 	}
diff --git a/vendor/github.com/currantlabs/ble/handler.go b/vendor/github.com/runtimeco/ble/handler.go
similarity index 99%
rename from vendor/github.com/currantlabs/ble/handler.go
rename to vendor/github.com/runtimeco/ble/handler.go
index b3673fb..6bfab3e 100644
--- a/vendor/github.com/currantlabs/ble/handler.go
+++ b/vendor/github.com/runtimeco/ble/handler.go
@@ -2,9 +2,8 @@ package ble
 
 import (
 	"bytes"
+	"context"
 	"io"
-
-	"golang.org/x/net/context"
 )
 
 // A ReadHandler handles GATT requests.
diff --git a/vendor/github.com/currantlabs/ble/linux/adv/const.go b/vendor/github.com/runtimeco/ble/linux/adv/const.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/adv/const.go
rename to vendor/github.com/runtimeco/ble/linux/adv/const.go
diff --git a/vendor/github.com/currantlabs/ble/linux/adv/packet.go b/vendor/github.com/runtimeco/ble/linux/adv/packet.go
similarity index 99%
rename from vendor/github.com/currantlabs/ble/linux/adv/packet.go
rename to vendor/github.com/runtimeco/ble/linux/adv/packet.go
index 9f38e4b..00b006a 100644
--- a/vendor/github.com/currantlabs/ble/linux/adv/packet.go
+++ b/vendor/github.com/runtimeco/ble/linux/adv/packet.go
@@ -3,7 +3,7 @@ package adv
 import (
 	"encoding/binary"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 // Packet is an implemntation of ble.AdvPacket for crafting or parsing an advertising packet or scan response.
diff --git a/vendor/github.com/currantlabs/ble/linux/att/README.md b/vendor/github.com/runtimeco/ble/linux/att/README.md
similarity index 94%
rename from vendor/github.com/currantlabs/ble/linux/att/README.md
rename to vendor/github.com/runtimeco/ble/linux/att/README.md
index 25024f8..e5d8c3d 100644
--- a/vendor/github.com/currantlabs/ble/linux/att/README.md
+++ b/vendor/github.com/runtimeco/ble/linux/att/README.md
@@ -15,8 +15,8 @@ This package implement Attribute Protocol (ATT) [Vol 3, Part F]
   - [x] Write Request [3.4.5.1 & 3.4.5.2]
   - [x] Write Command [3.4.5.3]
   - [ ] Signed Write Command [3.4.5.4]
-  - [ ] Prepare Write Request [3.4.6.1 & 3.4.6.2]
-  - [ ] Execute Write Request [3.4.6.3]
+  - [x] Prepare Write Request [3.4.6.1 & 3.4.6.2]
+  - [x] Execute Write Request [3.4.6.3]
   - [x] Handle Value Notification [3.4.7.1]
   - [x] Handle Value Indication [3.4.7.2 & 3.4.7.3]
 
diff --git a/vendor/github.com/currantlabs/ble/linux/att/att.go b/vendor/github.com/runtimeco/ble/linux/att/att.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/att/att.go
rename to vendor/github.com/runtimeco/ble/linux/att/att.go
diff --git a/vendor/github.com/currantlabs/ble/linux/att/att_gen.go b/vendor/github.com/runtimeco/ble/linux/att/att_gen.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/att/att_gen.go
rename to vendor/github.com/runtimeco/ble/linux/att/att_gen.go
diff --git a/vendor/github.com/currantlabs/ble/linux/att/attr.go b/vendor/github.com/runtimeco/ble/linux/att/attr.go
similarity index 81%
rename from vendor/github.com/currantlabs/ble/linux/att/attr.go
rename to vendor/github.com/runtimeco/ble/linux/att/attr.go
index 94b0fe2..b699d4e 100644
--- a/vendor/github.com/currantlabs/ble/linux/att/attr.go
+++ b/vendor/github.com/runtimeco/ble/linux/att/attr.go
@@ -1,6 +1,6 @@
 package att
 
-import "github.com/currantlabs/ble"
+import "github.com/runtimeco/ble"
 
 // attr is a BLE attribute.
 type attr struct {
diff --git a/vendor/github.com/currantlabs/ble/linux/att/client.go b/vendor/github.com/runtimeco/ble/linux/att/client.go
similarity index 98%
rename from vendor/github.com/currantlabs/ble/linux/att/client.go
rename to vendor/github.com/runtimeco/ble/linux/att/client.go
index fa6c9c4..c336d5f 100644
--- a/vendor/github.com/currantlabs/ble/linux/att/client.go
+++ b/vendor/github.com/runtimeco/ble/linux/att/client.go
@@ -5,7 +5,7 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 	"github.com/pkg/errors"
 )
 
@@ -498,7 +498,7 @@ func (c *Client) sendReq(b []byte) (rsp []byte, err error) {
 			logger.Debug("client", "req", fmt.Sprintf("% X", b))
 			_, err := c.l2c.Write(errRsp)
 			if err != nil {
-				return nil, errors.Wrap(err, "unexpected ATT response recieved")
+				return nil, errors.Wrap(err, "unexpected ATT response received")
 			}
 		case err := <-c.chErr:
 			return nil, errors.Wrap(err, "ATT request failed")
@@ -548,13 +548,13 @@ func (c *Client) Loop() {
 		case ch <- asyncWork{handle: c.handler.HandleNotification, data: b}:
 		default:
 			// If this really happens, especially on a slow machine, enlarge the channel buffer.
-			logger.Error("client", "req", "can't enqueue incoming notification.")
+			_ = logger.Error("client", "req", "can't enqueue incoming notification.")
 		}
 
 		// Always write aknowledgement for an indication, even it was an invalid request.
 		if b[0] == HandleValueIndicationCode {
 			logger.Debug("client", "req", fmt.Sprintf("% X", b))
-			c.l2c.Write(confirmation)
+			_, _ = c.l2c.Write(confirmation)
 		}
 	}
 }
diff --git a/vendor/github.com/currantlabs/ble/linux/att/db.go b/vendor/github.com/runtimeco/ble/linux/att/db.go
similarity index 99%
rename from vendor/github.com/currantlabs/ble/linux/att/db.go
rename to vendor/github.com/runtimeco/ble/linux/att/db.go
index 6ddb55d..96d31fd 100644
--- a/vendor/github.com/currantlabs/ble/linux/att/db.go
+++ b/vendor/github.com/runtimeco/ble/linux/att/db.go
@@ -4,7 +4,7 @@ import (
 	"encoding/binary"
 	"fmt"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 // A DB is a contiguous range of attributes.
diff --git a/vendor/github.com/currantlabs/ble/linux/att/log.go b/vendor/github.com/runtimeco/ble/linux/att/log.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/att/log.go
rename to vendor/github.com/runtimeco/ble/linux/att/log.go
diff --git a/vendor/github.com/currantlabs/ble/linux/att/server.go b/vendor/github.com/runtimeco/ble/linux/att/server.go
similarity index 82%
rename from vendor/github.com/currantlabs/ble/linux/att/server.go
rename to vendor/github.com/runtimeco/ble/linux/att/server.go
index 21006ac..1c3bd38 100644
--- a/vendor/github.com/currantlabs/ble/linux/att/server.go
+++ b/vendor/github.com/runtimeco/ble/linux/att/server.go
@@ -7,7 +7,7 @@ import (
 	"io"
 	"time"
 
-	"github.com/currantlabs/ble"
+	"github.com/runtimeco/ble"
 )
 
 type conn struct {
@@ -18,7 +18,7 @@ type conn struct {
 	in   map[uint16]ble.Notifier
 }
 
-// Server implementas an ATT (Attribute Protocol) server.
+// Server implements an ATT (Attribute Protocol) server.
 type Server struct {
 	conn *conn
 	db   *DB
@@ -32,6 +32,10 @@ type Server struct {
 	chConfirm chan bool
 
 	dummyRspWriter ble.ResponseWriter
+
+	// Store a write handler for defer execute once receiving ExecuteWriteRequest
+	prepareWriteRequestAttr *attr
+	prepareWriteRequestData bytes.Buffer
 }
 
 // NewServer returns an ATT (Attribute Protocol) server.
@@ -139,7 +143,7 @@ func (s *Server) Loop() {
 				select {
 				case s.chConfirm <- true:
 				default:
-					logger.Error("server", "recieved a spurious confirmation", nil)
+					logger.Error("server", "received a spurious confirmation", nil)
 				}
 				continue
 			}
@@ -158,7 +162,7 @@ func (s *Server) Loop() {
 	}
 	for h, ccc := range s.conn.cccs {
 		if ccc != 0 {
-			logger.Info("cleanup", "ccc", fmt.Sprintf("0x%02X", ccc))
+			logger.Info("cleanup", ble.ContextKeyCCC, fmt.Sprintf("0x%02X", ccc))
 		}
 		if ccc&cccIndicate != 0 {
 			s.conn.in[h].Close()
@@ -191,9 +195,11 @@ func (s *Server) handleRequest(b []byte) []byte {
 		resp = s.handleWriteRequest(b)
 	case WriteCommandCode:
 		s.handleWriteCommand(b)
+	case PrepareWriteRequestCode:
+		resp = s.handlePrepareWriteRequest(b)
+	case ExecuteWriteRequestCode:
+		resp = s.handleExecuteWriteRequest(b)
 	case ReadMultipleRequestCode,
-		PrepareWriteRequestCode,
-		ExecuteWriteRequestCode,
 		SignedWriteCommandCode:
 		fallthrough
 	default:
@@ -304,7 +310,7 @@ func (s *Server) handleFindByTypeValueRequest(r FindByTypeValueRequest) []byte {
 			// Since ResponseWriter caps the value at the capacity,
 			// we allocate one extra byte, and the written length.
 			buf2 := bytes.NewBuffer(make([]byte, 0, len(s.txBuf)-7+1))
-			e := handleATT(a, s.conn, r, ble.NewResponseWriter(buf2))
+			e := handleATT(a, s, r, ble.NewResponseWriter(buf2))
 			if e != ble.ErrSuccess || buf2.Len() > len(s.txBuf)-7 {
 				return newErrorResponse(r.AttributeOpcode(), r.StartingHandle(), ble.ErrInvalidHandle)
 			}
@@ -352,7 +358,7 @@ func (s *Server) handleReadByTypeRequest(r ReadByTypeRequest) []byte {
 		v := a.v
 		if v == nil {
 			buf2 := bytes.NewBuffer(make([]byte, 0, len(s.txBuf)-2))
-			if e := handleATT(a, s.conn, r, ble.NewResponseWriter(buf2)); e != ble.ErrSuccess {
+			if e := handleATT(a, s, r, ble.NewResponseWriter(buf2)); e != ble.ErrSuccess {
 				// Return if the first value read cause an error.
 				if dlen == 0 {
 					return newErrorResponse(r.AttributeOpcode(), r.StartingHandle(), e)
@@ -414,7 +420,7 @@ func (s *Server) handleReadRequest(r ReadRequest) []byte {
 
 	// Pass the request to upper layer with the ResponseWriter, which caps
 	// the buffer to a valid length of payload.
-	if e := handleATT(a, s.conn, r, ble.NewResponseWriter(buf)); e != ble.ErrSuccess {
+	if e := handleATT(a, s, r, ble.NewResponseWriter(buf)); e != ble.ErrSuccess {
 		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), e)
 	}
 	return rsp[:1+buf.Len()]
@@ -446,7 +452,7 @@ func (s *Server) handleReadBlobRequest(r ReadBlobRequest) []byte {
 
 	// Pass the request to upper layer with the ResponseWriter, which caps
 	// the buffer to a valid length of payload.
-	if e := handleATT(a, s.conn, r, ble.NewResponseWriter(buf)); e != ble.ErrSuccess {
+	if e := handleATT(a, s, r, ble.NewResponseWriter(buf)); e != ble.ErrSuccess {
 		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), e)
 	}
 	return rsp[:1+buf.Len()]
@@ -472,7 +478,7 @@ func (s *Server) handleReadByGroupRequest(r ReadByGroupTypeRequest) []byte {
 		v := a.v
 		if v == nil {
 			buf2 := bytes.NewBuffer(make([]byte, buf.Cap()-buf.Len()-4))
-			if e := handleATT(a, s.conn, r, ble.NewResponseWriter(buf2)); e != ble.ErrSuccess {
+			if e := handleATT(a, s, r, ble.NewResponseWriter(buf2)); e != ble.ErrSuccess {
 				return newErrorResponse(r.AttributeOpcode(), r.StartingHandle(), e)
 			}
 			v = buf2.Bytes()
@@ -520,12 +526,62 @@ func (s *Server) handleWriteRequest(r WriteRequest) []byte {
 	if a == nil {
 		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), ble.ErrWriteNotPerm)
 	}
-	if e := handleATT(a, s.conn, r, ble.NewResponseWriter(nil)); e != ble.ErrSuccess {
+	if e := handleATT(a, s, r, ble.NewResponseWriter(nil)); e != ble.ErrSuccess {
 		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), e)
 	}
 	return []byte{WriteResponseCode}
 }
 
+func (s *Server) handlePrepareWriteRequest(r PrepareWriteRequest) []byte {
+	logger.Debug("handlePrepareWriteRequest ->", "r.AttributeHandle", r.AttributeHandle())
+	// Validate the request.
+	switch {
+	case len(r) < 3:
+		return newErrorResponse(r.AttributeOpcode(), 0x0000, ble.ErrInvalidPDU)
+	}
+
+	a, ok := s.db.at(r.AttributeHandle())
+	if !ok {
+		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), ble.ErrInvalidHandle)
+	}
+
+	// We don't support write to static value. Pass the request to upper layer.
+	if a == nil {
+		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), ble.ErrWriteNotPerm)
+	}
+
+	if e := handleATT(a, s, r, ble.NewResponseWriter(nil)); e != ble.ErrSuccess {
+		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), e)
+	}
+
+	// Convert and validate the response.
+	rsp := PrepareWriteResponse(r)
+	rsp.SetAttributeOpcode()
+	return rsp
+}
+
+func (s *Server) handleExecuteWriteRequest(r ExecuteWriteRequest) []byte {
+	// Validate the request.
+	switch {
+	case len(r) < 2:
+		return newErrorResponse(r.AttributeOpcode(), 0x0000, ble.ErrInvalidPDU)
+	}
+
+	switch r.Flags() {
+	case 0:
+		// 0x00 – Cancel all prepared writes
+		s.prepareWriteRequestAttr = nil
+	case 1:
+		// 0x01 – Immediately write all pending prepared values
+		a := s.prepareWriteRequestAttr
+		if e := handleATT(a, s, r, ble.NewResponseWriter(nil)); e != ble.ErrSuccess {
+			return newErrorResponse(r.AttributeOpcode(), 0, e)
+		}
+	}
+
+	return []byte{ExecuteWriteResponseCode}
+}
+
 // handle Write command. [Vol 3, Part F, 3.4.5.3]
 func (s *Server) handleWriteCommand(r WriteCommand) []byte {
 	// Validate the request.
@@ -543,7 +599,7 @@ func (s *Server) handleWriteCommand(r WriteCommand) []byte {
 	if a == nil {
 		return nil
 	}
-	if e := handleATT(a, s.conn, r, s.dummyRspWriter); e != ble.ErrSuccess {
+	if e := handleATT(a, s, r, s.dummyRspWriter); e != ble.ErrSuccess {
 		return nil
 	}
 	return nil
@@ -558,10 +614,11 @@ func newErrorResponse(op byte, h uint16, s ble.ATTError) []byte {
 	return r
 }
 
-func handleATT(a *attr, conn ble.Conn, req []byte, rsp ble.ResponseWriter) ble.ATTError {
+func handleATT(a *attr, s *Server, req []byte, rsp ble.ResponseWriter) ble.ATTError {
 	rsp.SetStatus(ble.ErrSuccess)
 	var offset int
 	var data []byte
+	conn := s.conn
 	switch req[0] {
 	case ReadByTypeRequestCode:
 		fallthrough
@@ -576,6 +633,27 @@ func handleATT(a *attr, conn ble.Conn, req []byte, rsp ble.ResponseWriter) ble.A
 		}
 		offset = int(ReadBlobRequest(req).ValueOffset())
 		a.rh.ServeRead(ble.NewRequest(conn, data, offset), rsp)
+	case PrepareWriteRequestCode:
+		if a.wh == nil {
+			return ble.ErrWriteNotPerm
+		}
+		data = PrepareWriteRequest(req).PartAttributeValue()
+		logger.Debug("handleATT", "PartAttributeValue",
+			fmt.Sprintf("data: %x, offset: %d, %p\n", data, int(PrepareWriteRequest(req).ValueOffset()), s.prepareWriteRequestAttr))
+
+		if s.prepareWriteRequestAttr == nil {
+			s.prepareWriteRequestAttr = a
+			s.prepareWriteRequestData.Reset()
+		}
+		s.prepareWriteRequestData.Write(data)
+
+	case ExecuteWriteRequestCode:
+		if a.wh == nil {
+			return ble.ErrWriteNotPerm
+		}
+		data = s.prepareWriteRequestData.Bytes()
+		a.wh.ServeWrite(ble.NewRequest(conn, data, offset), rsp)
+		s.prepareWriteRequestAttr = nil
 	case WriteRequestCode:
 		fallthrough
 	case WriteCommandCode:
@@ -584,8 +662,6 @@ func handleATT(a *attr, conn ble.Conn, req []byte, rsp ble.ResponseWriter) ble.A
 		}
 		data = WriteRequest(req).AttributeValue()
 		a.wh.ServeWrite(ble.NewRequest(conn, data, offset), rsp)
-	// case PrepareWriteRequestCode:
-	// case ExecuteWriteRequestCode:
 	// case SignedWriteCommandCode:
 	// case ReadByGroupTypeRequestCode:
 	// case ReadMultipleRequestCode:
diff --git a/vendor/github.com/currantlabs/ble/linux/device.go b/vendor/github.com/runtimeco/ble/linux/device.go
similarity index 73%
rename from vendor/github.com/currantlabs/ble/linux/device.go
rename to vendor/github.com/runtimeco/ble/linux/device.go
index 52a6fbd..b392693 100644
--- a/vendor/github.com/currantlabs/ble/linux/device.go
+++ b/vendor/github.com/runtimeco/ble/linux/device.go
@@ -1,19 +1,27 @@
 package linux
 
 import (
+	"context"
 	"log"
 
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/att"
+	"github.com/runtimeco/ble/linux/gatt"
+	"github.com/runtimeco/ble/linux/hci"
 	"github.com/pkg/errors"
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/att"
-	"github.com/currantlabs/ble/linux/gatt"
-	"github.com/currantlabs/ble/linux/hci"
 )
 
 // NewDevice returns the default HCI device.
 func NewDevice() (*Device, error) {
+	return NewDeviceWithName("Gopher")
+}
+
+// NewDeviceWithName returns the default HCI device.
+func NewDeviceWithName(name string) (*Device, error) {
+	return NewDeviceWithNameAndHandler(name, nil)
+}
+
+func NewDeviceWithNameAndHandler(name string, handler ble.NotifyHandler) (*Device, error) {
 	dev, err := hci.NewHCI()
 	if err != nil {
 		return nil, errors.Wrap(err, "can't create hci")
@@ -22,41 +30,44 @@ func NewDevice() (*Device, error) {
 		return nil, errors.Wrap(err, "can't init hci")
 	}
 
-	s, err := gatt.NewServer()
+	srv, err := gatt.NewServerWithNameAndHandler(name, handler)
 	if err != nil {
 		return nil, errors.Wrap(err, "can't create server")
 	}
 
-	mtu := ble.DefaultMTU
-	mtu = ble.MaxMTU // TODO: get this from user using Option.
+	// mtu := ble.DefaultMTU
+	mtu := ble.MaxMTU // TODO: get this from user using Option.
 	if mtu > ble.MaxMTU {
 		return nil, errors.Wrapf(err, "maximum ATT_MTU is %d", ble.MaxMTU)
 	}
 
-	go func() {
-		for {
-			l2c, err := dev.Accept()
-			if err != nil {
-				log.Printf("can't accept: %s", err)
-				return
-			}
-
-			// Initialize the per-connection cccd values.
-			l2c.SetContext(context.WithValue(l2c.Context(), "ccc", make(map[uint16]uint16)))
-			l2c.SetRxMTU(mtu)
-
-			s.Lock()
-			as, err := att.NewServer(s.DB(), l2c)
-			s.Unlock()
-			if err != nil {
-				log.Printf("can't create ATT server: %s", err)
-				continue
-
-			}
-			go as.Loop()
+	go loop(dev, srv, mtu)
+
+	return &Device{HCI: dev, Server: srv}, nil
+}
+
+func loop(dev *hci.HCI, s *gatt.Server, mtu int) {
+	for {
+		l2c, err := dev.Accept()
+		if err != nil {
+			log.Printf("can't accept: %s", err)
+			return
 		}
-	}()
-	return &Device{HCI: dev, Server: s}, nil
+
+		// Initialize the per-connection cccd values.
+		l2c.SetContext(context.WithValue(l2c.Context(), ble.ContextKeyCCC, make(map[uint16]uint16)))
+		l2c.SetRxMTU(mtu)
+
+		s.Lock()
+		as, err := att.NewServer(s.DB(), l2c)
+		s.Unlock()
+		if err != nil {
+			log.Printf("can't create ATT server: %s", err)
+			continue
+
+		}
+		go as.Loop()
+	}
 }
 
 // Device ...
@@ -86,6 +97,16 @@ func (d *Device) Stop() error {
 	return d.HCI.Close()
 }
 
+func (d *Device) Advertise(ctx context.Context, adv ble.Advertisement) error {
+	if err := d.HCI.AdvertiseAdv(adv); err != nil {
+		return err
+	}
+	<-ctx.Done()
+	d.HCI.StopAdvertising()
+	return ctx.Err()
+
+}
+
 // AdvertiseNameAndServices advertises device name, and specified service UUIDs.
 // It tres to fit the UUIDs in the advertising packet as much as possible.
 // If name doesn't fit in the advertising packet, it will be put in scan response.
diff --git a/vendor/github.com/currantlabs/ble/linux/gatt/README.md b/vendor/github.com/runtimeco/ble/linux/gatt/README.md
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/gatt/README.md
rename to vendor/github.com/runtimeco/ble/linux/gatt/README.md
diff --git a/vendor/github.com/currantlabs/ble/linux/gatt/client.go b/vendor/github.com/runtimeco/ble/linux/gatt/client.go
similarity index 95%
rename from vendor/github.com/currantlabs/ble/linux/gatt/client.go
rename to vendor/github.com/runtimeco/ble/linux/gatt/client.go
index a5c4e15..3678d48 100644
--- a/vendor/github.com/currantlabs/ble/linux/gatt/client.go
+++ b/vendor/github.com/runtimeco/ble/linux/gatt/client.go
@@ -6,8 +6,8 @@ import (
 	"log"
 	"sync"
 
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/att"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/att"
 )
 
 const (
@@ -38,8 +38,8 @@ type Client struct {
 	conn ble.Conn
 }
 
-// Address returns the address of the client.
-func (p *Client) Address() ble.Addr {
+// Addr returns the address of the client.
+func (p *Client) Addr() ble.Addr {
 	p.RLock()
 	defer p.RUnlock()
 	return p.conn.RemoteAddr()
@@ -59,24 +59,24 @@ func (p *Client) Profile() *ble.Profile {
 	return p.profile
 }
 
-// DiscoverProfile discovers the whole hierachy of a server.
+// DiscoverProfile discovers the whole hierarchy of a server.
 func (p *Client) DiscoverProfile(force bool) (*ble.Profile, error) {
 	if p.profile != nil && !force {
 		return p.profile, nil
 	}
 	ss, err := p.DiscoverServices(nil)
 	if err != nil {
-		return nil, fmt.Errorf("can't discover services: %s\n", err)
+		return nil, fmt.Errorf("can't discover services: %s", err)
 	}
 	for _, s := range ss {
 		cs, err := p.DiscoverCharacteristics(nil, s)
 		if err != nil {
-			return nil, fmt.Errorf("can't discover characteristics: %s\n", err)
+			return nil, fmt.Errorf("can't discover characteristics: %s", err)
 		}
 		for _, c := range cs {
 			_, err := p.DiscoverDescriptors(nil, c)
 			if err != nil {
-				return nil, fmt.Errorf("can't discover descriptors: %s\n", err)
+				return nil, fmt.Errorf("can't discover descriptors: %s", err)
 			}
 		}
 	}
diff --git a/vendor/github.com/currantlabs/ble/linux/gatt/server.go b/vendor/github.com/runtimeco/ble/linux/gatt/server.go
similarity index 66%
rename from vendor/github.com/currantlabs/ble/linux/gatt/server.go
rename to vendor/github.com/runtimeco/ble/linux/gatt/server.go
index 23f3a18..ec5cf97 100644
--- a/vendor/github.com/currantlabs/ble/linux/gatt/server.go
+++ b/vendor/github.com/runtimeco/ble/linux/gatt/server.go
@@ -4,15 +4,20 @@ import (
 	"log"
 	"sync"
 
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/att"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/att"
 )
 
-// NewServer ...
+// NewServerWithName creates a new Server with the specified name
 func NewServerWithName(name string) (*Server, error) {
+	return NewServerWithNameAndHandler(name, nil)
+}
+
+// NewServerWithNameAndHandler allow to specify a custom NotifyHandler
+func NewServerWithNameAndHandler(name string, notifyHandler ble.NotifyHandler) (*Server, error) {
 	return &Server{
-		name:name,
-		svcs: defaultServices(name),
+		name: name,
+		svcs: defaultServicesWithHandler(name, notifyHandler),
 		db:   att.NewDB(defaultServices(name), uint16(1)),
 	}, nil
 }
@@ -64,6 +69,9 @@ func (s *Server) DB() *att.DB {
 }
 
 func defaultServices(name string) []*ble.Service {
+	return defaultServicesWithHandler(name, nil)
+}
+func defaultServicesWithHandler(name string, handler ble.NotifyHandler) []*ble.Service {
 	// https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.ble.appearance.xml
 	var gapCharAppearanceGenericComputer = []byte{0x00, 0x80}
 
@@ -75,16 +83,22 @@ func defaultServices(name string) []*ble.Service {
 	gapSvc.NewCharacteristic(ble.PeferredParamsUUID).SetValue([]byte{0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0xd0, 0x07})
 
 	gattSvc := ble.NewService(ble.GATTUUID)
-	gattSvc.NewCharacteristic(ble.ServiceChangedUUID).HandleIndicate(
-		ble.NotifyHandlerFunc(func(r ble.Request, n ble.Notifier) {
-			log.Printf("TODO: indicate client when the services are changed")
-			for {
-				select {
-				case <-n.Context().Done():
-					log.Printf("count: Notification unsubscribed")
-					return
-				}
-			}
-		}))
+	var indicationHandler ble.NotifyHandlerFunc
+	indicationHandler = defaultHanderFunc
+	if handler != nil {
+		indicationHandler = handler.ServeNotify
+	}
+	gattSvc.NewCharacteristic(ble.ServiceChangedUUID).HandleIndicate(indicationHandler)
 	return []*ble.Service{gapSvc, gattSvc}
 }
+
+func defaultHanderFunc(r ble.Request, n ble.Notifier) {
+	log.Printf("TODO: indicate client when the services are changed")
+	for {
+		select {
+		case <-n.Context().Done():
+			log.Printf("count: Notification unsubscribed")
+			return
+		}
+	}
+}
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/README.md b/vendor/github.com/runtimeco/ble/linux/hci/README.md
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/README.md
rename to vendor/github.com/runtimeco/ble/linux/hci/README.md
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/adv.go b/vendor/github.com/runtimeco/ble/linux/hci/adv.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/linux/hci/adv.go
rename to vendor/github.com/runtimeco/ble/linux/hci/adv.go
index eb0f7f7..84be9df 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/adv.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/adv.go
@@ -3,9 +3,9 @@ package hci
 import (
 	"net"
 
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/adv"
-	"github.com/currantlabs/ble/linux/hci/evt"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/adv"
+	"github.com/runtimeco/ble/linux/hci/evt"
 )
 
 // RandomAddress is a Random Device Address.
@@ -97,8 +97,8 @@ func (a *Advertisement) RSSI() int {
 	return int(a.e.RSSI(a.i))
 }
 
-// Address returns the address of the remote peripheral.
-func (a *Advertisement) Address() ble.Addr {
+// Addr returns the address of the remote peripheral.
+func (a *Advertisement) Addr() ble.Addr {
 	b := a.e.Address(a.i)
 	addr := net.HardwareAddr([]byte{b[5], b[4], b[3], b[2], b[1], b[0]})
 	if a.e.AddressType(a.i) == 1 {
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/buffer.go b/vendor/github.com/runtimeco/ble/linux/hci/buffer.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/buffer.go
rename to vendor/github.com/runtimeco/ble/linux/hci/buffer.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/cmd/cmd.go b/vendor/github.com/runtimeco/ble/linux/hci/cmd/cmd.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/cmd/cmd.go
rename to vendor/github.com/runtimeco/ble/linux/hci/cmd/cmd.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/cmd/cmd_gen.go b/vendor/github.com/runtimeco/ble/linux/hci/cmd/cmd_gen.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/cmd/cmd_gen.go
rename to vendor/github.com/runtimeco/ble/linux/hci/cmd/cmd_gen.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/conn.go b/vendor/github.com/runtimeco/ble/linux/hci/conn.go
similarity index 97%
rename from vendor/github.com/currantlabs/ble/linux/hci/conn.go
rename to vendor/github.com/runtimeco/ble/linux/hci/conn.go
index af7d652..c71637e 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/conn.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/conn.go
@@ -2,16 +2,15 @@ package hci
 
 import (
 	"bytes"
+	"context"
 	"encoding/binary"
 	"fmt"
 	"io"
 	"net"
 
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/hci/cmd"
-	"github.com/currantlabs/ble/linux/hci/evt"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux/hci/evt"
 	"github.com/pkg/errors"
 )
 
@@ -122,7 +121,7 @@ func (c *Conn) Read(sdu []byte) (n int, err error) {
 		return 0, errors.Wrap(io.ErrClosedPipe, "input channel closed")
 	}
 	if len(p) == 0 {
-		return 0, errors.Wrap(io.ErrUnexpectedEOF, "recieved empty packet")
+		return 0, errors.Wrap(io.ErrUnexpectedEOF, "received empty packet")
 	}
 
 	// Assume it's a B-Frame.
@@ -134,7 +133,7 @@ func (c *Conn) Read(sdu []byte) (n int, err error) {
 		data = leFrameHdr(p).payload()
 	}
 	if cap(sdu) < slen {
-		return 0, errors.Wrapf(io.ErrShortBuffer, "payload recieved exceeds sdu buffer")
+		return 0, errors.Wrapf(io.ErrShortBuffer, "payload received exceeds sdu buffer")
 	}
 	buf := bytes.NewBuffer(sdu)
 	buf.Reset()
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/const.go b/vendor/github.com/runtimeco/ble/linux/hci/const.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/const.go
rename to vendor/github.com/runtimeco/ble/linux/hci/const.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/error.go b/vendor/github.com/runtimeco/ble/linux/hci/error.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/error.go
rename to vendor/github.com/runtimeco/ble/linux/hci/error.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/evt/evt.go b/vendor/github.com/runtimeco/ble/linux/hci/evt/evt.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/evt/evt.go
rename to vendor/github.com/runtimeco/ble/linux/hci/evt/evt.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/evt/evt_gen.go b/vendor/github.com/runtimeco/ble/linux/hci/evt/evt_gen.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/evt/evt_gen.go
rename to vendor/github.com/runtimeco/ble/linux/hci/evt/evt_gen.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/gap.go b/vendor/github.com/runtimeco/ble/linux/hci/gap.go
similarity index 81%
rename from vendor/github.com/currantlabs/ble/linux/hci/gap.go
rename to vendor/github.com/runtimeco/ble/linux/hci/gap.go
index 0a0e0f0..6688682 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/gap.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/gap.go
@@ -1,15 +1,14 @@
 package hci
 
 import (
+	"context"
 	"fmt"
 	"net"
 	"time"
 
-	"golang.org/x/net/context"
-
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/adv"
-	"github.com/currantlabs/ble/linux/gatt"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/adv"
+	"github.com/runtimeco/ble/linux/gatt"
 	"github.com/pkg/errors"
 )
 
@@ -40,6 +39,51 @@ func (h *HCI) StopScanning() error {
 	return h.Send(&h.params.scanEnable, nil)
 }
 
+// AdvertiseAdv advertises a given Advertisement
+func (h *HCI) AdvertiseAdv(a ble.Advertisement) error {
+	ad, err := adv.NewPacket(adv.Flags(adv.FlagGeneralDiscoverable | adv.FlagLEOnly))
+	if err != nil {
+		return err
+	}
+	f := adv.AllUUID
+
+	// Current length of ad packet plus two bytes of length and tag.
+	l := ad.Len() + 1 + 1
+	for _, u := range a.Services() {
+		l += u.Len()
+	}
+	if l > adv.MaxEIRPacketLength {
+		f = adv.SomeUUID
+	}
+	for _, u := range a.Services() {
+		if err := ad.Append(f(u)); err != nil {
+			if err == adv.ErrNotFit {
+				break
+			}
+			return err
+		}
+	}
+	sr, _ := adv.NewPacket()
+	switch {
+	case ad.Append(adv.CompleteName(a.LocalName())) == nil:
+	case sr.Append(adv.CompleteName(a.LocalName())) == nil:
+	case sr.Append(adv.ShortName(a.LocalName())) == nil:
+	}
+
+	if a.ManufacturerData() != nil {
+		manufacuturerData := adv.ManufacturerData(1337, a.ManufacturerData())
+		switch {
+		case ad.Append(manufacuturerData) == nil:
+		case sr.Append(manufacuturerData) == nil:
+		}
+	}
+	if err := h.SetAdvertisement(ad.Bytes(), sr.Bytes()); err != nil {
+		return nil
+	}
+	return h.Advertise()
+
+}
+
 // AdvertiseNameAndServices advertises device name, and specified service UUIDs.
 // It tries to fit the UUIDs in the advertising data as much as possible.
 // If name doesn't fit in the advertising data, it will be put in scan response.
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/hci.go b/vendor/github.com/runtimeco/ble/linux/hci/hci.go
similarity index 95%
rename from vendor/github.com/currantlabs/ble/linux/hci/hci.go
rename to vendor/github.com/runtimeco/ble/linux/hci/hci.go
index 42240cd..8767d4f 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/hci.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/hci.go
@@ -7,10 +7,10 @@ import (
 	"sync"
 	"time"
 
-	"github.com/currantlabs/ble"
-	"github.com/currantlabs/ble/linux/hci/cmd"
-	"github.com/currantlabs/ble/linux/hci/evt"
-	"github.com/currantlabs/ble/linux/hci/socket"
+	"github.com/runtimeco/ble"
+	"github.com/runtimeco/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux/hci/evt"
+	"github.com/runtimeco/ble/linux/hci/socket"
 	"github.com/pkg/errors"
 )
 
@@ -88,9 +88,9 @@ type HCI struct {
 
 	// adHist and adLast track the history of past scannable advertising packets.
 	// Controller delivers AD(Advertising Data) and SR(Scan Response) separately
-	// through HCI. Upon recieving an AD, no matter it's scannable or not, we
-	// pass a Advertisment (AD only) to advHandler immediately.
-	// Upon recieving a SR, we search the AD history for the AD from the same
+	// through HCI. Upon receiving an AD, no matter it's scannable or not, we
+	// pass a Advertisement (AD only) to advHandler immediately.
+	// Upon receiving a SR, we search the AD history for the AD from the same
 	// device, and pass the Advertisiement (AD+SR) to advHandler.
 	// The adHist and adLast are allocated in the Scan().
 	advHandler ble.AdvHandler
@@ -144,7 +144,9 @@ func (h *HCI) Init() error {
 	h.chCmdBufs <- make([]byte, 64)
 
 	go h.sktLoop()
-	h.init()
+	if err := h.init(); err != nil {
+		return err
+	}
 
 	// Pre-allocate buffers with additional head room for lower layer headers.
 	// HCI header (1 Byte) + ACL Data Header (4 bytes) + L2CAP PDU (or fragment)
@@ -373,15 +375,15 @@ func (h *HCI) handleLEAdvertisingReport(b []byte) error {
 				if h.adHist[idx] == nil {
 					break
 				}
-				if h.adHist[idx].Address().String() == sr.Address().String() {
+				if h.adHist[idx].Addr().String() == sr.Addr().String() {
 					h.adHist[idx].setScanResponse(sr)
 					a = h.adHist[idx]
 					break
 				}
 			}
-			// Got a SR without having recieved an associated AD before?
+			// Got a SR without having received an associated AD before?
 			if a == nil {
-				return fmt.Errorf("recieved scan response %s with no associated Advertising Data packet", sr.Address())
+				return fmt.Errorf("received scan response %s with no associated Advertising Data packet", sr.Addr())
 			}
 		default:
 			a = newAdvertisement(e, i)
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/log.go b/vendor/github.com/runtimeco/ble/linux/hci/log.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/log.go
rename to vendor/github.com/runtimeco/ble/linux/hci/log.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/option.go b/vendor/github.com/runtimeco/ble/linux/hci/option.go
similarity index 94%
rename from vendor/github.com/currantlabs/ble/linux/hci/option.go
rename to vendor/github.com/runtimeco/ble/linux/hci/option.go
index 5d1ca26..edb297a 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/option.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/option.go
@@ -3,7 +3,7 @@ package hci
 import (
 	"time"
 
-	"github.com/currantlabs/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux/hci/cmd"
 )
 
 // An Option is a configuration function, which configures the device.
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/params.go b/vendor/github.com/runtimeco/ble/linux/hci/params.go
similarity index 98%
rename from vendor/github.com/currantlabs/ble/linux/hci/params.go
rename to vendor/github.com/runtimeco/ble/linux/hci/params.go
index bbf36f6..b24b61d 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/params.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/params.go
@@ -3,7 +3,7 @@ package hci
 import (
 	"sync"
 
-	"github.com/currantlabs/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux/hci/cmd"
 )
 
 type params struct {
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/signal.go b/vendor/github.com/runtimeco/ble/linux/hci/signal.go
similarity index 99%
rename from vendor/github.com/currantlabs/ble/linux/hci/signal.go
rename to vendor/github.com/runtimeco/ble/linux/hci/signal.go
index 81d4998..8d4d1d8 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/signal.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/signal.go
@@ -7,7 +7,7 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/currantlabs/ble/linux/hci/cmd"
+	"github.com/runtimeco/ble/linux/hci/cmd"
 )
 
 // Signal ...
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/signal_gen.go b/vendor/github.com/runtimeco/ble/linux/hci/signal_gen.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/signal_gen.go
rename to vendor/github.com/runtimeco/ble/linux/hci/signal_gen.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/smp.go b/vendor/github.com/runtimeco/ble/linux/hci/smp.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/hci/smp.go
rename to vendor/github.com/runtimeco/ble/linux/hci/smp.go
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/socket/dummy.go b/vendor/github.com/runtimeco/ble/linux/hci/socket/dummy.go
similarity index 66%
rename from vendor/github.com/currantlabs/ble/linux/hci/socket/dummy.go
rename to vendor/github.com/runtimeco/ble/linux/hci/socket/dummy.go
index 6062008..8038d88 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/socket/dummy.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/socket/dummy.go
@@ -2,9 +2,12 @@
 
 package socket
 
-import "io"
+import (
+	"fmt"
+	"io"
+)
 
 // NewSocket is a dummy function for non-Linux platform.
 func NewSocket(id int) (io.ReadWriteCloser, error) {
-	return nil, nil
+	return nil, fmt.Errorf("only available on linux")
 }
diff --git a/vendor/github.com/currantlabs/ble/linux/hci/socket/socket.go b/vendor/github.com/runtimeco/ble/linux/hci/socket/socket.go
similarity index 98%
rename from vendor/github.com/currantlabs/ble/linux/hci/socket/socket.go
rename to vendor/github.com/runtimeco/ble/linux/hci/socket/socket.go
index 312f600..1404818 100644
--- a/vendor/github.com/currantlabs/ble/linux/hci/socket/socket.go
+++ b/vendor/github.com/runtimeco/ble/linux/hci/socket/socket.go
@@ -108,7 +108,7 @@ func open(fd, id int) (*Socket, error) {
 	}
 
 	// poll for 20ms to see if any data becomes available, then clear it
-	pfds := []unix.PollFd{unix.PollFd{Fd: int32(fd), Events: unix.POLLIN}}
+	pfds := []unix.PollFd{{Fd: int32(fd), Events: unix.POLLIN}}
 	unix.Poll(pfds, 20)
 	if pfds[0].Revents&unix.POLLIN > 0 {
 		b := make([]byte, 100)
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/Makefile b/vendor/github.com/runtimeco/ble/linux/tools/codegen/Makefile
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/Makefile
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/Makefile
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/att.json b/vendor/github.com/runtimeco/ble/linux/tools/codegen/att.json
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/att.json
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/att.json
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/att.tmpl b/vendor/github.com/runtimeco/ble/linux/tools/codegen/att.tmpl
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/att.tmpl
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/att.tmpl
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/cmd.json b/vendor/github.com/runtimeco/ble/linux/tools/codegen/cmd.json
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/cmd.json
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/cmd.json
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/cmd.tmpl b/vendor/github.com/runtimeco/ble/linux/tools/codegen/cmd.tmpl
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/cmd.tmpl
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/cmd.tmpl
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/codegen.go b/vendor/github.com/runtimeco/ble/linux/tools/codegen/codegen.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/codegen.go
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/codegen.go
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/evt.json b/vendor/github.com/runtimeco/ble/linux/tools/codegen/evt.json
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/evt.json
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/evt.json
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/evt.tmpl b/vendor/github.com/runtimeco/ble/linux/tools/codegen/evt.tmpl
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/evt.tmpl
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/evt.tmpl
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/signal.json b/vendor/github.com/runtimeco/ble/linux/tools/codegen/signal.json
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/signal.json
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/signal.json
diff --git a/vendor/github.com/currantlabs/ble/linux/tools/codegen/signal.tmpl b/vendor/github.com/runtimeco/ble/linux/tools/codegen/signal.tmpl
similarity index 100%
rename from vendor/github.com/currantlabs/ble/linux/tools/codegen/signal.tmpl
rename to vendor/github.com/runtimeco/ble/linux/tools/codegen/signal.tmpl
diff --git a/vendor/github.com/currantlabs/ble/profile.go b/vendor/github.com/runtimeco/ble/profile.go
similarity index 89%
rename from vendor/github.com/currantlabs/ble/profile.go
rename to vendor/github.com/runtimeco/ble/profile.go
index a59772d..1e3bb28 100644
--- a/vendor/github.com/currantlabs/ble/profile.go
+++ b/vendor/github.com/runtimeco/ble/profile.go
@@ -38,27 +38,46 @@ type Profile struct {
 // Find searches discovered profile for the specified target's type and UUID.
 // The target must has the type of *Service, *Characteristic, or *Descriptor.
 func (p *Profile) Find(target interface{}) interface{} {
-	switch target.(type) {
+	switch t := target.(type) {
 	case *Service:
+		return p.FindService(t)
 	case *Characteristic:
+		return p.FindCharacteristic(t)
 	case *Descriptor:
+		return p.FindDescriptor(t)
 	default:
 		return nil
 	}
+}
+
+// FindService searches discoverd profile for the specified service and UUID
+func (p *Profile) FindService(service *Service) *Service {
 	for _, s := range p.Services {
-		ts, ok := target.(*Service)
-		if ok && s.UUID.Equal(ts.UUID) {
-			target = s
+		if s.UUID.Equal(service.UUID) {
 			return s
 		}
+	}
+	return nil
+}
+
+// FindCharacteristic searches discoverd profile for the specified characteristic and UUID
+func (p *Profile) FindCharacteristic(char *Characteristic) *Characteristic {
+	for _, s := range p.Services {
 		for _, c := range s.Characteristics {
-			tc, ok := target.(*Characteristic)
-			if ok && c.UUID.Equal(tc.UUID) {
+			if c.UUID.Equal(char.UUID) {
 				return c
 			}
+		}
+	}
+	return nil
+}
+
+// FindDescriptor searches discoverd profile for the specified descriptor and UUID
+func (p *Profile) FindDescriptor(desc *Descriptor) *Descriptor {
+	for _, s := range p.Services {
+		for _, c := range s.Characteristics {
 			for _, d := range c.Descriptors {
-				td, ok := target.(*Descriptor)
-				if ok && d.UUID.Equal(td.UUID) {
+				if d.UUID.Equal(desc.UUID) {
 					return d
 				}
 			}
diff --git a/vendor/github.com/currantlabs/ble/uuid.go b/vendor/github.com/runtimeco/ble/uuid.go
similarity index 100%
rename from vendor/github.com/currantlabs/ble/uuid.go
rename to vendor/github.com/runtimeco/ble/uuid.go

-- 
To stop receiving notification emails like this one, please contact
ccollins@apache.org.