wechat.h
Go to the documentation of this file.
1 
63 #ifndef __WECHART_H__
64 #define __WECHART_H__
65 
66 #include "gr55xx_sys.h"
67 #include "custom_config.h"
68 #include <stdint.h>
69 #include <stdbool.h>
70 
75 #define WECHAT_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
76  10 : CFG_MAX_CONNECTIONS)
77 #define WECHAT_DATA_LEN 20
78 #define WECHAT_PEDO_TARGET_VAL_LEN 0x04
79 #define WECHAT_PEDO_STEP_COUNT_MAX 0xFFFFFF
86 #define WECHAT_SERVICE_UUID 0XFEE7
87 #define WECHAT_WRITE_CHAR_UUID 0XFEC7
88 #define WECHAT_INDICATE_CHAR_UUID 0XFEC8
89 #define WECHAT_READ_CHAR_UUID 0XFEC9
90 #define WECHAT_PEDOMETER_MEASUREMENT 0XFEA1
91 #define WECHAT_TARGET 0XFEA2
99 #define WECHAT_PEDO_FLAG_STEP_COUNT_BIT 0X01
100 #define WECHAT_PEDO_FLAG_STEP_DISTENCE_BIT 0X02
101 #define WECHAT_PEDO_FLAG_STEP_CALORIE_BIT 0X04
102 #define WECHAT_PEDO_FLAG_ALL_SUP_BIT 0X07
111 typedef enum
112 {
130 typedef struct
131 {
132  uint8_t flag;
133  uint8_t step_count[3];
134  uint8_t step_dist[3];
135  uint8_t step_calorie[3];
137 
139 typedef struct
140 {
141  uint8_t flag;
142  uint8_t step_count[3];
144 
146 typedef struct
147 {
148  const uint8_t *p_data;
149  uint16_t length;
150  uint16_t offset;
151 } wechat_data_t;
152 
154 typedef struct
155 {
156  uint8_t conn_idx;
158  union
159  {
162  } param;
163 } wechat_evt_t;
171 typedef void (*wechat_evt_handler_t)(wechat_evt_t *p_evt);
179 typedef struct
180 {
182  uint32_t step_count_target;
183  uint8_t *p_dev_mac;
184 } wechat_init_t;
201 
213 sdk_err_t wechat_airsync_data_indicate(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
214 
226 
238 #endif
239 
WECHAT_EVT_INVALID
@ WECHAT_EVT_INVALID
Definition: wechat.h:113
wechat_evt_handler_t
void(* wechat_evt_handler_t)(wechat_evt_t *p_evt)
WeChat Service event handler type.
Definition: wechat.h:171
wechat_pedo_measurement_send
sdk_err_t wechat_pedo_measurement_send(uint8_t conn_idx, wechat_pedo_meas_t *p_pedo_meas)
Send WeChat pedometer measurement information.
WECHAT_EVT_PEDO_MEAS_NTF_ENABLE
@ WECHAT_EVT_PEDO_MEAS_NTF_ENABLE
Definition: wechat.h:116
wechat_init_t::p_dev_mac
uint8_t * p_dev_mac
Definition: wechat.h:183
wechat_pedo_target_send
sdk_err_t wechat_pedo_target_send(uint8_t conn_idx)
Send WeChat pedometer target value.
wechat_init_t::step_count_target
uint32_t step_count_target
Definition: wechat.h:182
WECHAT_EVT_PEDO_MEAS_NTF_DISABLE
@ WECHAT_EVT_PEDO_MEAS_NTF_DISABLE
Definition: wechat.h:117
wechat_evt_t::pedo_target
wechat_pedo_target_t pedo_target
Definition: wechat.h:160
wechat_evt_t::data
wechat_data_t data
Definition: wechat.h:161
wechat_evt_t
WeChat Service event.
Definition: wechat.h:155
WECHAT_EVT_AIRSYNC_IND_DISABLE
@ WECHAT_EVT_AIRSYNC_IND_DISABLE
Definition: wechat.h:115
gr55xx_sys.h
GR55XX System API.
wechat_data_t::p_data
const uint8_t * p_data
Definition: wechat.h:148
wechat_data_t::length
uint16_t length
Definition: wechat.h:149
WECHAT_EVT_PEDO_TARGET_IND_ENABLE
@ WECHAT_EVT_PEDO_TARGET_IND_ENABLE
Definition: wechat.h:118
wechat_pedo_target_t
WeChat pedometer target variable.
Definition: wechat.h:140
wechat_evt_type_t
wechat_evt_type_t
WeChat Service event type.
Definition: wechat.h:112
wechat_init_t
WeChat Service Init variable.
Definition: wechat.h:180
WECHAT_EVT_PEDO_TARGET_IND_DISABLE
@ WECHAT_EVT_PEDO_TARGET_IND_DISABLE
Definition: wechat.h:119
wechat_pedo_meas_t::flag
uint8_t flag
Definition: wechat.h:132
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
WECHAT_EVT_AIRSYNC_IND_ENABLE
@ WECHAT_EVT_AIRSYNC_IND_ENABLE
Definition: wechat.h:114
wechat_service_init
sdk_err_t wechat_service_init(wechat_init_t *p_wechat_init)
Initialize a WeChat Service instance and add in the DB.
wechat_data_t
WeChat service data.
Definition: wechat.h:147
wechat_airsync_data_indicate
sdk_err_t wechat_airsync_data_indicate(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
WeChat Service Airsync indicate data.
wechat_evt_t::evt_type
wechat_evt_type_t evt_type
Definition: wechat.h:157
wechat_pedo_target_t::flag
uint8_t flag
Definition: wechat.h:141
wechat_pedo_meas_t
WeChat current pedometer measurement variable.
Definition: wechat.h:131
wechat_init_t::evt_handler
wechat_evt_handler_t evt_handler
Definition: wechat.h:181
WECHAT_EVT_AIRSYNC_DATA_RECIEVE
@ WECHAT_EVT_AIRSYNC_DATA_RECIEVE
Definition: wechat.h:121
wechat_evt_t::conn_idx
uint8_t conn_idx
Definition: wechat.h:156
WECHAT_EVT_PEDO_TARGET_UPDATE
@ WECHAT_EVT_PEDO_TARGET_UPDATE
Definition: wechat.h:120
wechat_data_t::offset
uint16_t offset
Definition: wechat.h:150