hrrcps.h
Go to the documentation of this file.
1
57 #ifndef __HRRCPS_H__
58 #define __HRRCPS_H__
59
60 #include "ble_prf_types.h"
61 #include "gr55xx_sys.h"
62 #include "custom_config.h"
63 #include <stdint.h>
64 #include <stdbool.h>
65
70 #define HRRCPS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
71 10 : CFG_MAX_CONNECTIONS)
72 #define HRRCPS_CTRL_PT_VAL_LEN 2
73 #define HRRCPS_CTRL_PT_RSP_VAL_LEN 4
74 #define HRRCPS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\
75 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x06, 0xED, 0xA6
83 typedef enum
84 {
85 HRRCPS_CTRL_PT_SCAN_HRS = 0x01,
86 HRRCPS_CTRL_PT_SCAN_RSCS,
87 HRRCPS_CTRL_PT_HRS_SEN_LOC_READ,
88 HRRCPS_CTRL_PT_RSCS_SEN_LOC_READ,
89 HRRCPS_CTRL_PT_HRS_NTF_ENABLE,
90 HRRCPS_CTRL_PT_HRS_NTF_DISABLE,
91 HRRCPS_CTRL_PT_RSCS_NTF_ENABLE,
92 HRRCPS_CTRL_PT_RSCS_NTF_DISABLE,
93 HRRCPS_CTRL_PT_HRS_CONN_STA_REPORT,
94 HRRCPS_CTRL_PT_RSCS_CONN_STA_REPORT,
95 HRRCPS_CTRL_PT_HRS_DISCONN,
96 HRRCPS_CTRL_PT_RSCS_DISCONN,
97 HRRCPS_CTRL_PT_RSP_CODE = 0xff,
98 } hrrcps_ctrl_pt_id_t;
99
101 typedef enum
102 {
103 HRRCPS_RSP_ID_OK = 0x01,
104 HRRCPS_RSP_ID_ERROR,
105 } hrrcps_rsp_id_t;
106
108 typedef enum
109 {
110 HRRCPS_EVT_INVALID,
111 HRRCPS_EVT_CTRL_PT_IND_ENABLE,
112 HRRCPS_EVT_CTRL_PT_IND_DISABLE,
113 HRRCPS_EVT_SCAN_HRS,
114 HRRCPS_EVT_SCAN_RSCS,
115 HRRCPS_EVT_ENABLE_HRS_NTF,
116 HRRCPS_EVT_DISABLE_HRS_NTF,
117 HRRCPS_EVT_ENABLE_RSCS_NTF,
118 HRRCPS_EVT_DISABLE_RSCS_NTF,
119 HRRCPS_EVT_HRS_SENSOR_LOC_READ,
120 HRRCPS_EVT_RSCS_SENSOR_LOC_READ,
121 HRRCPS_EVT_DISCONN_HRS_LINK,
122 HRRCPS_EVT_DISCONN_RSCS_LINK,
123 } hrrcps_evt_type_t;
131 typedef struct
132 {
133 hrrcps_ctrl_pt_id_t cmd_id;
134 hrrcps_rsp_id_t rsp_id;
135 bool is_inc_prama;
136 uint8_t rsp_param;
137 } hrrcps_rsp_val_t;
138
140 typedef struct
141 {
142 uint8_t conn_idx;
143 hrrcps_evt_type_t evt_type;
144 } hrrcps_evt_t;
152 typedef void (*hrrcps_evt_handler_t)(hrrcps_evt_t *p_evt);
168 sdk_err_t hrrcps_service_init(hrrcps_evt_handler_t evt_handler);
169
180 sdk_err_t hrrcps_ctrl_pt_rsp_send(uint8_t conn_idx, hrrcps_rsp_val_t *p_rsp_val);
183 #endif
184
HRRCPS_CTRL_PT_HRS_NTF_ENABLE
@ HRRCPS_CTRL_PT_HRS_NTF_ENABLE
Definition: hrrcps.h:89
hrrcps_rsp_val_t::is_inc_prama
bool is_inc_prama
Definition: hrrcps.h:135
hrrcps_rsp_id_t
hrrcps_rsp_id_t
HRS RSCS Relay Control Point Service Response IDs of Control Point.
Definition: hrrcps.h:102
HRRCPS_CTRL_PT_SCAN_RSCS
@ HRRCPS_CTRL_PT_SCAN_RSCS
Definition: hrrcps.h:86
HRRCPS_EVT_DISABLE_RSCS_NTF
@ HRRCPS_EVT_DISABLE_RSCS_NTF
Definition: hrrcps.h:118
hrrcps_rsp_val_t
HRS RSCS Relay Control Point Response value.
Definition: hrrcps.h:132
HRRCPS_CTRL_PT_RSCS_NTF_DISABLE
@ HRRCPS_CTRL_PT_RSCS_NTF_DISABLE
Definition: hrrcps.h:92
HRRCPS_EVT_DISCONN_RSCS_LINK
@ HRRCPS_EVT_DISCONN_RSCS_LINK
Definition: hrrcps.h:122
HRRCPS_CTRL_PT_HRS_SEN_LOC_READ
@ HRRCPS_CTRL_PT_HRS_SEN_LOC_READ
Definition: hrrcps.h:87
HRRCPS_EVT_ENABLE_HRS_NTF
@ HRRCPS_EVT_ENABLE_HRS_NTF
Definition: hrrcps.h:115
HRRCPS_CTRL_PT_HRS_CONN_STA_REPORT
@ HRRCPS_CTRL_PT_HRS_CONN_STA_REPORT
Definition: hrrcps.h:93
hrrcps_ctrl_pt_rsp_send
sdk_err_t hrrcps_ctrl_pt_rsp_send(uint8_t conn_idx, hrrcps_rsp_val_t *p_rsp_val)
Send Control Point Response if its indicaiton has been enabled.
gr55xx_sys.h
GR55XX System API.
hrrcps_evt_t::conn_idx
uint8_t conn_idx
Definition: hrrcps.h:142
hrrcps_rsp_val_t::cmd_id
hrrcps_ctrl_pt_id_t cmd_id
Definition: hrrcps.h:133
HRRCPS_EVT_INVALID
@ HRRCPS_EVT_INVALID
Definition: hrrcps.h:110
HRRCPS_RSP_ID_OK
@ HRRCPS_RSP_ID_OK
Definition: hrrcps.h:103
HRRCPS_CTRL_PT_RSCS_SEN_LOC_READ
@ HRRCPS_CTRL_PT_RSCS_SEN_LOC_READ
Definition: hrrcps.h:88
HRRCPS_EVT_CTRL_PT_IND_ENABLE
@ HRRCPS_EVT_CTRL_PT_IND_ENABLE
Definition: hrrcps.h:111
hrrcps_evt_type_t
hrrcps_evt_type_t
HRS RSCS Relay Control Point Service event type.
Definition: hrrcps.h:109
HRRCPS_EVT_HRS_SENSOR_LOC_READ
@ HRRCPS_EVT_HRS_SENSOR_LOC_READ
Definition: hrrcps.h:119
HRRCPS_EVT_RSCS_SENSOR_LOC_READ
@ HRRCPS_EVT_RSCS_SENSOR_LOC_READ
Definition: hrrcps.h:120
HRRCPS_CTRL_PT_RSCS_DISCONN
@ HRRCPS_CTRL_PT_RSCS_DISCONN
Definition: hrrcps.h:96
HRRCPS_RSP_ID_ERROR
@ HRRCPS_RSP_ID_ERROR
Definition: hrrcps.h:104
hrrcps_ctrl_pt_id_t
hrrcps_ctrl_pt_id_t
HRS RSCS Relay Control Point Service Control Point IDs.
Definition: hrrcps.h:84
hrrcps_service_init
sdk_err_t hrrcps_service_init(hrrcps_evt_handler_t evt_handler)
Initialize an Alert Notification Service instance and add in the DB.
ble_prf_types.h
Profile/Service Common Types.
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
HRRCPS_CTRL_PT_SCAN_HRS
@ HRRCPS_CTRL_PT_SCAN_HRS
Definition: hrrcps.h:85
HRRCPS_EVT_DISCONN_HRS_LINK
@ HRRCPS_EVT_DISCONN_HRS_LINK
Definition: hrrcps.h:121
HRRCPS_CTRL_PT_RSP_CODE
@ HRRCPS_CTRL_PT_RSP_CODE
Definition: hrrcps.h:97
hrrcps_evt_t::evt_type
hrrcps_evt_type_t evt_type
Definition: hrrcps.h:143
hrrcps_rsp_val_t::rsp_param
uint8_t rsp_param
Definition: hrrcps.h:136
HRRCPS_CTRL_PT_HRS_DISCONN
@ HRRCPS_CTRL_PT_HRS_DISCONN
Definition: hrrcps.h:95
HRRCPS_CTRL_PT_RSCS_CONN_STA_REPORT
@ HRRCPS_CTRL_PT_RSCS_CONN_STA_REPORT
Definition: hrrcps.h:94
hrrcps_evt_handler_t
void(* hrrcps_evt_handler_t)(hrrcps_evt_t *p_evt)
HRS RSCS Relay Control Point Service event handler type.
Definition: hrrcps.h:152
HRRCPS_EVT_ENABLE_RSCS_NTF
@ HRRCPS_EVT_ENABLE_RSCS_NTF
Definition: hrrcps.h:117
HRRCPS_CTRL_PT_RSCS_NTF_ENABLE
@ HRRCPS_CTRL_PT_RSCS_NTF_ENABLE
Definition: hrrcps.h:91
hrrcps_rsp_val_t::rsp_id
hrrcps_rsp_id_t rsp_id
Definition: hrrcps.h:134
HRRCPS_EVT_CTRL_PT_IND_DISABLE
@ HRRCPS_EVT_CTRL_PT_IND_DISABLE
Definition: hrrcps.h:112
HRRCPS_EVT_DISABLE_HRS_NTF
@ HRRCPS_EVT_DISABLE_HRS_NTF
Definition: hrrcps.h:116
HRRCPS_CTRL_PT_HRS_NTF_DISABLE
@ HRRCPS_CTRL_PT_HRS_NTF_DISABLE
Definition: hrrcps.h:90
HRRCPS_EVT_SCAN_RSCS
@ HRRCPS_EVT_SCAN_RSCS
Definition: hrrcps.h:114
HRRCPS_EVT_SCAN_HRS
@ HRRCPS_EVT_SCAN_HRS
Definition: hrrcps.h:113
hrrcps_evt_t
HRS RSCS Relay Control Point Service event.
Definition: hrrcps.h:141