-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
97 lines (95 loc) · 2.21 KB
/
api.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package xdripgo
func TransmitterStatusString(status byte) string {
s := "--"
switch status {
case 0x00:
s = "OK"
case 0x81:
s = "Low battery"
case 0x83:
s = "Expired"
default:
s = "Unknown: 0x" + string(status)
}
return s
}
func SensorStateString(state byte) string {
s := "--"
switch state {
case 0x00:
s = "None"
case 0x01:
s = "Stopped"
case 0x02:
s = "Warmup"
case 0x03:
s = "Unused"
case 0x04:
s = "First calibration"
case 0x05:
s = "Second calibration"
case 0x06:
s = "OK"
case 0x07:
s = "Needs calibration"
case 0x08:
s = "Calibration Error 1"
case 0x09:
s = "Calibration Error 0"
case 0x0a:
s = "Calibration Linearity Fit Failure"
case 0x0b:
s = "Sensor Failed Due to Counts Aberration"
case 0x0c:
s = "Sensor Failed Due to Residual Aberration"
case 0x0d:
s = "Out of Calibration Due To Outlier"
case 0x0e:
s = "Outlier Calibration Request - Need a Calibration"
case 0x0f:
s = "Session Expired"
case 0x10:
s = "Session Failed Due To Unrecoverable Error"
case 0x11:
s = "Session Failed Due To Transmitter Error"
case 0x12:
s = "Temporary Session Failure"
case 0x13:
s = "Reserved"
case 0x80:
s = "Calibration State - Start"
case 0x81:
s = "Calibration State - Start Up"
case 0x82:
s = "Calibration State - First of Two Calibrations Needed"
case 0x83:
s = "Calibration State - High Wedge Display With First BG"
case 0x84:
s = "Unused Calibration State - Low Wedge Display With First BG"
case 0x85:
s = "Calibration State - Second of Two Calibrations Needed"
case 0x86:
s = "Calibration State - In Calibration Transmitter"
case 0x87:
s = "Calibration State - In Calibration Display"
case 0x88:
s = "Calibration State - High Wedge Transmitter"
case 0x89:
s = "Calibration State - Low Wedge Transmitter"
case 0x8a:
s = "Calibration State - Linearity Fit Transmitter"
case 0x8b:
s = "Calibration State - Out of Cal Due to Outlier Transmitter"
case 0x8c:
s = "Calibration State - High Wedge Display"
case 0x8d:
s = "Calibration State - Low Wedge Display"
case 0x8e:
s = "Calibration State - Linearity Fit Display"
case 0x8f:
s = "Calibration State - Session Not in Progress"
default:
s = "Unknown: 0x" + string(state)
}
return s
}