-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsedSchema.ts
66 lines (51 loc) · 1.46 KB
/
parsedSchema.ts
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
export type OPENBLE_VERSION = "0.1.0"
export type OPENBLE_PROFILE = "gatt"
// TODO implement extended properties
export type CHARACTERISTIC_PERMISSION = "READ" | "WRITE" | "NOTIFY" | "INDICATE"
// TODO support other types
// export type CHARACTERISTIC_TYPE = "BOOL" | "UINT8" | "INT8" | "UINT16" | "INT16" | "UINT32" | "INT32" | "UINT64" | "INT64" | "FLOAT32" | "FLOAT64"
export type CHARACTERISTIC_TYPE = "INT32"
export interface ParsedSchema {
openble: OPENBLE_VERSION
info: {
title: string
description: string
version: string
}
services: {
// A service along with its full UUID
[fullUuid: string]: ParsedService
}
}
export interface ParsedService {
// The service name
name: string
// The full identifier
identifier: string
// The source of the UUID's definition. Equals `custom` if the UUID is not recorded in Nordic's database
source: string
// Service summary
summary?: string
characteristics: {
[fullUuid: string]: ParsedCharacteristic
}
}
export interface ParsedCharacteristic {
// The service name
name: string
// The full identifier
identifier: string
// The source of the UUID's definition. Equals `custom` if the UUID is not recorded in Nordic's database
source: string
// Service summary
summary?: string
// Characteristic permissions
permissions: Permissions
dataType: CHARACTERISTIC_TYPE
}
export interface Permissions {
read: boolean
write: boolean
notify: boolean
indicate: boolean
}