|
@@ -54,41 +54,69 @@ static uint8_t uuid_base2[16] = {
|
54
|
54
|
0x5a, 0x26, 0x42, 0x49, 0x43, 0x4b, 0x45, 0x4c,
|
55
|
55
|
};
|
56
|
56
|
|
57
|
|
-int8_t volcano_discover_characteristics(void) {
|
58
|
|
- uuid_base[1] = UUID_SRVC_2;
|
59
|
|
- uuid_base2[1] = UUID_SRVC_2;
|
|
57
|
+int8_t volcano_discover_characteristics(bool wf, bool conf) {
|
|
58
|
+ if (wf) {
|
|
59
|
+ uuid_base[1] = UUID_SRVC_2;
|
|
60
|
+ uuid_base2[1] = UUID_SRVC_2;
|
60
|
61
|
|
61
|
|
- uuid_base[3] = UUID_WRITE_SRVC;
|
62
|
|
- int8_t r;
|
|
62
|
+ uuid_base[3] = UUID_WRITE_SRVC;
|
|
63
|
+ int8_t r;
|
63
|
64
|
|
64
|
|
- uuid_base2[3] = UUID_TARGET_TEMP;
|
65
|
|
- r = ble_discover(uuid_base, uuid_base2);
|
66
|
|
- if (r < 0) {
|
67
|
|
- return r;
|
68
|
|
- }
|
|
65
|
+ uuid_base2[3] = UUID_TARGET_TEMP;
|
|
66
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
67
|
+ if (r < 0) {
|
|
68
|
+ return r;
|
|
69
|
+ }
|
69
|
70
|
|
70
|
|
- uuid_base2[3] = UUID_HEATER_ON;
|
71
|
|
- r = ble_discover(uuid_base, uuid_base2);
|
72
|
|
- if (r < 0) {
|
73
|
|
- return r;
|
74
|
|
- }
|
|
71
|
+ uuid_base2[3] = UUID_HEATER_ON;
|
|
72
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
73
|
+ if (r < 0) {
|
|
74
|
+ return r;
|
|
75
|
+ }
|
75
|
76
|
|
76
|
|
- uuid_base2[3] = UUID_HEATER_OFF;
|
77
|
|
- r = ble_discover(uuid_base, uuid_base2);
|
78
|
|
- if (r < 0) {
|
79
|
|
- return r;
|
80
|
|
- }
|
|
77
|
+ uuid_base2[3] = UUID_HEATER_OFF;
|
|
78
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
79
|
+ if (r < 0) {
|
|
80
|
+ return r;
|
|
81
|
+ }
|
81
|
82
|
|
82
|
|
- uuid_base2[3] = UUID_PUMP_ON;
|
83
|
|
- r = ble_discover(uuid_base, uuid_base2);
|
84
|
|
- if (r < 0) {
|
85
|
|
- return r;
|
|
83
|
+ uuid_base2[3] = UUID_PUMP_ON;
|
|
84
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
85
|
+ if (r < 0) {
|
|
86
|
+ return r;
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ uuid_base2[3] = UUID_PUMP_OFF;
|
|
90
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
91
|
+ if (r < 0) {
|
|
92
|
+ return r;
|
|
93
|
+ }
|
86
|
94
|
}
|
87
|
95
|
|
88
|
|
- uuid_base2[3] = UUID_PUMP_OFF;
|
89
|
|
- r = ble_discover(uuid_base, uuid_base2);
|
90
|
|
- if (r < 0) {
|
91
|
|
- return r;
|
|
96
|
+ if (conf) {
|
|
97
|
+ uuid_base[1] = UUID_SRVC_1;
|
|
98
|
+ uuid_base2[1] = UUID_SRVC_1;
|
|
99
|
+
|
|
100
|
+ uuid_base[3] = UUID_WRITE_SRVC;
|
|
101
|
+ int8_t r;
|
|
102
|
+
|
|
103
|
+ uuid_base2[3] = UUID_PRJSTAT1;
|
|
104
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
105
|
+ if (r < 0) {
|
|
106
|
+ return r;
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ uuid_base2[3] = UUID_PRJSTAT2;
|
|
110
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
111
|
+ if (r < 0) {
|
|
112
|
+ return r;
|
|
113
|
+ }
|
|
114
|
+
|
|
115
|
+ uuid_base2[3] = UUID_PRJSTAT3;
|
|
116
|
+ r = ble_discover(uuid_base, uuid_base2);
|
|
117
|
+ if (r < 0) {
|
|
118
|
+ return r;
|
|
119
|
+ }
|
92
|
120
|
}
|
93
|
121
|
|
94
|
122
|
return 0;
|