|
1032
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
|
2 /// -*- coding: UTF-8 -*-
|
|
|
3 ///
|
|
|
4 /// \file Discovery/Inc/cv_heartbeat.h
|
|
|
5 /// \brief Function definitions for connecting to a Polar HC10 heartbeat sensor
|
|
|
6 /// \date 3 July 2025
|
|
|
7
|
|
|
8 ///////////////////////////////////////////////////////////////////////////////
|
|
|
9 /// \par Copyright (c) 2014-2015 Heinrichs Weikamp gmbh
|
|
|
10 ///
|
|
|
11 /// This program is free software: you can redistribute it and/or modify
|
|
|
12 /// it under the terms of the GNU General Public License as published by
|
|
|
13 /// the Free Software Foundation, either version 3 of the License, or
|
|
|
14 /// (at your option) any later version.
|
|
|
15 ///
|
|
|
16 /// This program is distributed in the hope that it will be useful,
|
|
|
17 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
18 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
19 /// GNU General Public License for more details.
|
|
|
20 ///
|
|
|
21 /// You should have received a copy of the GNU General Public License
|
|
|
22 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
23 //////////////////////////////////////////////////////////////////////////////
|
|
|
24
|
|
|
25 #ifndef INC_CV_HEARTBEAT_H_
|
|
|
26 #define INC_CV_HEARTBEAT_H_
|
|
|
27
|
|
|
28 #include <stdint.h>
|
|
|
29
|
|
|
30
|
|
|
31 #define BLUEMOD_ADDR_SIZE (20u) /* length of address respond */
|
|
|
32 #define BLUEMOD_RSSI_SIZE (5u)
|
|
|
33 #define BLUEMOD_NAME_SIZE (40u)
|
|
|
34
|
|
|
35 void openEdit_Heartbeat(void);
|
|
|
36
|
|
|
37 typedef enum
|
|
|
38 {
|
|
|
39 NO_INDICATOR = 0,
|
|
|
40 DEVICE_INDICATOR,
|
|
|
41 CONNECTION_INDICATOR,
|
|
|
42 SERVICE_INDICATOR,
|
|
|
43 OK_INDICATOR, /* module control */
|
|
|
44 ERROR_INDICATOR /* module control */
|
|
|
45 } indicatior_t;
|
|
|
46
|
|
|
47 typedef enum
|
|
|
48 {
|
|
|
49 BT_READ_NOTHING = 0,
|
|
|
50 BT_READ_DEVICE_ADDR,
|
|
|
51 BT_READ_DEVICE_RSSI,
|
|
|
52 BT_READ_DEVICE_NAME,
|
|
|
53 BT_READ_CON_DETAILS,
|
|
|
54 BT_READ_SERV_HANDLE,
|
|
|
55 BT_READ_SERV_START,
|
|
|
56 BT_READ_SERV_END,
|
|
|
57 BT_READ_SERV_UUID
|
|
|
58 } readDataType_t;
|
|
|
59
|
|
|
60 typedef enum
|
|
|
61 {
|
|
|
62 SENSOR_HB_OFFLINE = 0, /* Default Status no data available */
|
|
|
63 SENSOR_HB_ENABLE_BLE,
|
|
|
64 SENSOR_HB_CHECK_CONFIG,
|
|
|
65 SENSOR_HB_DISCOVER,
|
|
|
66 SENSOR_HB_CONNECT,
|
|
|
67 SENSOR_HB_SERVICES,
|
|
|
68 SENSOR_HB_RESTART,
|
|
|
69 SENSOR_HB_DETECTION_INDICATOR, /* searching for indicators to identify data items */
|
|
|
70 SENSOR_HB_DETECTION_RSSI,
|
|
|
71 SENSOR_HB_DETECTION_NAME,
|
|
|
72 SENSOR_HB_DETECTION_MAN,
|
|
|
73 SENSOR_HB_DETECTION_UUID,
|
|
|
74 SENSOR_HB_FOUND, /* A device providing the requested service was found */
|
|
|
75 SENSOR_HB_CONNECTED, /* Connection to heartbeat sensor established */
|
|
|
76 SENSOR_HB_OFFLINEMODE, /* Oflline measurement started */
|
|
|
77 } sensorHeartbeat_State_t;
|
|
|
78
|
|
|
79 typedef struct
|
|
|
80 {
|
|
|
81 uint8_t address[BLUEMOD_ADDR_SIZE];
|
|
|
82 uint8_t rssi[BLUEMOD_RSSI_SIZE];
|
|
|
83 uint8_t name[BLUEMOD_NAME_SIZE];
|
|
|
84 } btDdeviceData_t;
|
|
|
85
|
|
|
86
|
|
|
87 typedef struct
|
|
|
88 {
|
|
|
89 uint8_t handle;
|
|
|
90 uint8_t start[6];
|
|
|
91 uint8_t end[6];
|
|
|
92 uint8_t uuid[50];
|
|
|
93 } btDeviceService_t;
|
|
|
94
|
|
|
95
|
|
|
96
|
|
|
97 sensorHeartbeat_State_t cv_heartbeat_getState();
|
|
|
98 void refresh_Heartbeat(void);
|
|
|
99 void cv_heartbeat_Control(void);
|
|
|
100
|
|
|
101 #endif /* INC_CV_HEARTBEAT_H_ */
|