-
Notifications
You must be signed in to change notification settings - Fork 1
/
uuids.go
48 lines (44 loc) · 2.5 KB
/
uuids.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
package tapgosdk
import "tinygo.org/x/bluetooth"
var (
tapService = bluetooth.NewUUID([16]byte{0xc3, 0xff, 0x00, 0x01, 0x1d, 0x8b, 0x40, 0xfd, 0xa5, 0x6f, 0xc7, 0xbd, 0x5d, 0x0f, 0x33, 0x70})
nusService = bluetooth.NewUUID([16]byte{0x6E, 0x40, 0x00, 0x01, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E})
deviceInfoService = bluetooth.NewUUID([16]byte{0x00, 0x00, 0x18, 0x0A, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB})
tapDataCharacteristic = bluetooth.NewUUID([16]byte{0xC3, 0xFF, 0x00, 0x05, 0x1D, 0x8B, 0x40, 0xFD, 0xA5, 0x6F, 0xC7, 0xBD, 0x5D, 0x0F, 0x33, 0x70})
mouseDataCharacteristic = bluetooth.NewUUID([16]byte{0xC3, 0xFF, 0x00, 0x06, 0x1D, 0x8B, 0x40, 0xFD, 0xA5, 0x6F, 0xC7, 0xBD, 0x5D, 0x0F, 0x33, 0x70})
uiCmdCharacteristic = bluetooth.NewUUID([16]byte{0xC3, 0xFF, 0x00, 0x09, 0x1D, 0x8B, 0x40, 0xFD, 0xA5, 0x6F, 0xC7, 0xBD, 0x5D, 0x0F, 0x33, 0x70})
airGestureDataCharacteristic = bluetooth.NewUUID([16]byte{0xC3, 0xFF, 0x00, 0x0A, 0x1D, 0x8B, 0x40, 0xFD, 0xA5, 0x6F, 0xC7, 0xBD, 0x5D, 0x0F, 0x33, 0x70})
tapModeCharacteristic = bluetooth.NewUUID([16]byte{0x6E, 0x40, 0x00, 0x02, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E})
rawSensorsCharacteristic = bluetooth.NewUUID([16]byte{0x6E, 0x40, 0x00, 0x03, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E})
fwVersionCharacteristic = bluetooth.NewUUID([16]byte{0x00, 0x00, 0x2A, 0x26, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB})
)
func getServiceNameByUUID(service bluetooth.UUID) string {
if service == tapService {
return "TAP"
} else if service == nusService {
return "NUS"
} else if service == deviceInfoService {
return "DEVICE INFORMATION"
} else {
return service.String()
}
}
func getCharacteristicNameByUUID(characteristic bluetooth.UUID) string {
if characteristic == bluetooth.CharacteristicUUIDThingyFWVersion {
return "FW Version"
} else if characteristic == mouseDataCharacteristic {
return "MOUSE DATA"
} else if characteristic == tapModeCharacteristic {
return "NUS_RX"
} else if characteristic == tapDataCharacteristic {
return "TAP DATA"
} else if characteristic == rawSensorsCharacteristic {
return "NUS_TX"
} else if characteristic == airGestureDataCharacteristic {
return "AIR GESTURES DATA"
} else if characteristic == uiCmdCharacteristic {
return "TAP UI COMMANDS"
} else {
return characteristic.String()
}
}