rtus.h
Go to the documentation of this file.
1
57 #ifndef __RTUS_H__
58 #define __RTUS_H__
59
60 #include "gr55xx_sys.h"
61 #include "custom_config.h"
62 #include <stdint.h>
63 #include <stdbool.h>
64
69 #define RTUS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
70 10 : CFG_MAX_CONNECTIONS)
71 #define RTUS_CTRL_PT_VAL_LEN 1
72 #define RTUS_UPDATE_STATE_VAL_LEN 2
73 #define RTUS_CHAR_FULL 0x1f
81 typedef enum
82 {
83 RTUS_CTRL_PT_GET_UPDATE = 0x01,
84 RTUS_CTRL_PT_CANCEL_UPDATE,
85 } rtus_ctrl_pt_t;
86
88 typedef enum
89 {
90 RTUS_CUR_STATE_IDLE,
91 RTUS_CUR_STATE_PENDING,
92 } rtus_cur_state_t;
93
95 typedef enum
96 {
97 RTUS_UPDATE_RESULT_SCCESSFUL,
98 RTUS_UPDATE_RESULT_CANCELED,
99 RTUS_UPDATE_RESULT_NO_CONN_TO_REF,
100 RTUS_UPDATE_RESULT_REP_ERROR,
101 RTUS_UPDATE_RESULT_TIMEOUT,
102 RTUS_UPDATE_RESULT_NO_ATTEMPTED,
103 } rtus_update_result_t;
104
106 typedef enum
107 {
108 RTUS_EVT_INVALID,
109 RTUS_EVT_GET_UPDATE,
110 RTUS_EVT_CANCEL_UPDATE,
111 } rtus_evt_type_t;
119 typedef struct
120 {
121 rtus_cur_state_t cur_state;
122 rtus_update_result_t update_result;
123 } rtus_update_state_t;
124
126 typedef struct
127 {
128 uint8_t conn_idx;
129 rtus_evt_type_t evt_type;
130 } rtus_evt_t;
138 typedef void (*rtus_evt_handler_t)(rtus_evt_t *p_evt);
146 typedef struct
147 {
148 rtus_evt_handler_t evt_handler;
149 uint16_t char_mask;
150 } rtus_init_t;
166 sdk_err_t rtus_service_init(rtus_init_t *p_rtus_init);
167
175 void rtus_current_state_set(rtus_cur_state_t cur_state);
176
184 void rtus_update_result_set(rtus_update_result_t update_result);
187 #endif
188
rtus_evt_type_t
rtus_evt_type_t
RTUS Event type.
Definition: rtus.h:107
rtus_evt_t::conn_idx
uint8_t conn_idx
Definition: rtus.h:128
rtus_update_state_t::update_result
rtus_update_result_t update_result
Definition: rtus.h:122
rtus_init_t
Reference Time Update Service init structure. This contains all option and data needed for initializa...
Definition: rtus.h:147
RTUS_UPDATE_RESULT_REP_ERROR
@ RTUS_UPDATE_RESULT_REP_ERROR
Definition: rtus.h:100
RTUS_EVT_INVALID
@ RTUS_EVT_INVALID
Definition: rtus.h:108
RTUS_EVT_GET_UPDATE
@ RTUS_EVT_GET_UPDATE
Definition: rtus.h:109
RTUS_CUR_STATE_PENDING
@ RTUS_CUR_STATE_PENDING
Definition: rtus.h:91
gr55xx_sys.h
GR55XX System API.
rtus_init_t::evt_handler
rtus_evt_handler_t evt_handler
Definition: rtus.h:148
RTUS_UPDATE_RESULT_CANCELED
@ RTUS_UPDATE_RESULT_CANCELED
Definition: rtus.h:98
rtus_service_init
sdk_err_t rtus_service_init(rtus_init_t *p_rtus_init)
Initialize a RTUS instance and add in the DB.
rtus_evt_handler_t
void(* rtus_evt_handler_t)(rtus_evt_t *p_evt)
Reference Time Update Service event handler type.
Definition: rtus.h:138
RTUS_EVT_CANCEL_UPDATE
@ RTUS_EVT_CANCEL_UPDATE
Definition: rtus.h:110
RTUS_UPDATE_RESULT_SCCESSFUL
@ RTUS_UPDATE_RESULT_SCCESSFUL
Definition: rtus.h:97
rtus_update_result_t
rtus_update_result_t
RTUS Time Update Result.
Definition: rtus.h:96
rtus_cur_state_t
rtus_cur_state_t
RTUS Current State.
Definition: rtus.h:89
RTUS_CUR_STATE_IDLE
@ RTUS_CUR_STATE_IDLE
Definition: rtus.h:90
rtus_evt_t
RTUS Event data.
Definition: rtus.h:127
rtus_update_state_t::cur_state
rtus_cur_state_t cur_state
Definition: rtus.h:121
rtus_update_state_t
RTUS Time Update State.
Definition: rtus.h:120
rtus_ctrl_pt_t
rtus_ctrl_pt_t
RTUS Time Update Control Point.
Definition: rtus.h:82
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
RTUS_UPDATE_RESULT_NO_CONN_TO_REF
@ RTUS_UPDATE_RESULT_NO_CONN_TO_REF
Definition: rtus.h:99
rtus_evt_t::evt_type
rtus_evt_type_t evt_type
Definition: rtus.h:129
RTUS_CTRL_PT_GET_UPDATE
@ RTUS_CTRL_PT_GET_UPDATE
Definition: rtus.h:83
rtus_current_state_set
void rtus_current_state_set(rtus_cur_state_t cur_state)
Set state of reference time update .
rtus_update_result_set
void rtus_update_result_set(rtus_update_result_t update_result)
Set result of reference time update .
rtus_init_t::char_mask
uint16_t char_mask
Definition: rtus.h:149
RTUS_CTRL_PT_CANCEL_UPDATE
@ RTUS_CTRL_PT_CANCEL_UPDATE
Definition: rtus.h:84
RTUS_UPDATE_RESULT_TIMEOUT
@ RTUS_UPDATE_RESULT_TIMEOUT
Definition: rtus.h:101
RTUS_UPDATE_RESULT_NO_ATTEMPTED
@ RTUS_UPDATE_RESULT_NO_ATTEMPTED
Definition: rtus.h:102