-
Notifications
You must be signed in to change notification settings - Fork 3
/
adv.go
78 lines (71 loc) · 1.85 KB
/
adv.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package ble
// AdvHandler handles advertisement.
type AdvHandler func(a Advertisement)
// AdvFilter returns true if the advertisement matches specified condition.
type AdvFilter func(a Advertisement) bool
// Advertisement ...
type Advertisement interface {
LocalName() string
ManufacturerData() []byte
ServiceData() []ServiceData
Services() []UUID
OverflowService() []UUID
TxPowerLevel() int
Connectable() bool
SolicitedService() []UUID
RSSI() int
Addr() Addr
AddrType() uint8
Timestamp() int64
ToMap() (map[string]interface{}, error)
Data() []byte
SrData() []byte
}
var AdvertisementMapKeys = struct {
MAC string
RSSI string
Name string
MFG string
Services string
ServiceData string
Connectable string
Solicited string
EventType string
Flags string
TxPower string
AddressType string
Controller string
Timestamp string
AdvertisementError string
}{
MAC: "mac",
RSSI: "rssi",
Name: "name",
MFG: "mfg",
Services: "services",
ServiceData: "serviceData",
Connectable: "connectable",
Solicited: "solicited",
EventType: "eventType",
Flags: "flags",
TxPower: "txPower",
AddressType: "addressType",
Controller: "controllerMac",
Timestamp: "timestamp",
AdvertisementError: "advertisementError",
}
// ServiceData ...
type ServiceData struct {
UUID UUID
Data []byte
}
type AdvertisingParameters struct {
AdvertisingIntervalMin uint16
AdvertisingIntervalMax uint16
AdvertisingType uint8
OwnAddressType uint8
DirectAddressType uint8
DirectAddress [6]byte
AdvertisingChannelMap uint8
AdvertisingFilterPolicy uint8
}