Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
forks
ble
Commits
9898fb04
Commit
9898fb04
authored
Oct 17, 2017
by
Kevin Seidel
Browse files
More linting...
parent
bb20df5f
Changes
5
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
9898fb04
# bt
# ble
--
[

](https://godoc.org/github.com/go-ble/ble)
[

](https://goreportcard.com/report/go-ble/ble)
[

](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.
bt is a Bluetooth library for Go; its API is still under active development, and may change without warning.
context.go
View file @
9898fb04
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"
)
)
darwin/client.go
View file @
9898fb04
...
...
@@ -47,17 +47,17 @@ func (cln *Client) DiscoverProfile(force bool) (*ble.Profile, error) {
}
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
)
}
}
}
...
...
linux/gatt/client.go
View file @
9898fb04
...
...
@@ -66,17 +66,17 @@ func (p *Client) DiscoverProfile(force bool) (*ble.Profile, error) {
}
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
)
}
}
}
...
...
linux/gatt/server.go
View file @
9898fb04
...
...
@@ -8,7 +8,7 @@ import (
"github.com/go-ble/ble/linux/att"
)
// NewServer
...
// NewServer
WithName creates a new Server with the specified name
func
NewServerWithName
(
name
string
)
(
*
Server
,
error
)
{
return
&
Server
{
name
:
name
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment