121 lines
2.7 KiB
C
121 lines
2.7 KiB
C
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2020. All rights reserved.
|
|
*
|
|
* Description: service_hrsensor.h
|
|
*
|
|
* Author: liangjianfei
|
|
*
|
|
* Create: 2024-4-26
|
|
*--------------------------------------------------------------------------*/
|
|
#ifndef SERVICE_HRSENSOR_H
|
|
#define SERVICE_HRSENSOR_H
|
|
//lib
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#endif
|
|
|
|
typedef enum {
|
|
MSG_NO_TOUCH,
|
|
MSG_TOUCH
|
|
} hr_wear_status_t;
|
|
|
|
/* wear_status: 佩戴状态
|
|
* hr_resul : 心率
|
|
*/
|
|
typedef struct {
|
|
hr_wear_status_t wear_status;
|
|
uint8_t hr_result;
|
|
#ifdef TJD_PCBA_0
|
|
unsigned char sbp_result;
|
|
unsigned char dbp_result;
|
|
#elif defined(TJD_PCBA_1)
|
|
uint8_t spo2_result;
|
|
uint8_t hrv_result;
|
|
#endif
|
|
} hrsensor_data_t;
|
|
|
|
typedef enum {
|
|
HRS_STATUS_OFF,
|
|
HRS_STATUS_ON,
|
|
HRS_STATUS_ERROR,
|
|
} hrs_service_status_t;
|
|
|
|
typedef enum {
|
|
HR_SERVICE_HR_ALLDAY = 0,
|
|
HR_SERVICE_BO_ALLDAY, // spo2
|
|
HR_SERVICE_STRESS_ALLDAY,
|
|
HR_SERVICE_UI_HR,
|
|
HR_SERVICE_UI_PRODUCTION,
|
|
HR_SERVICE_UI_BO,
|
|
HR_SERVICE_UI_BREATHING,
|
|
HR_SERVICE_UI_SPORT,
|
|
HR_SERVICE_MAX //加到MAX之前
|
|
} hr_service_id_t;
|
|
|
|
typedef struct {
|
|
hr_service_id_t id;
|
|
uint32_t time_ms;
|
|
} hr_api_info_t;
|
|
|
|
typedef struct {
|
|
hr_service_id_t id;
|
|
uint32_t time_ms;
|
|
hrs_service_status_t status;
|
|
} hr_service_info_t;
|
|
|
|
typedef struct {
|
|
uint8_t mode;
|
|
uint64_t vlue;
|
|
}send_measure_data_t;
|
|
|
|
typedef enum{
|
|
MeasureMode_NONE = 0x0,
|
|
MeasureMode_Heart = 0x1,
|
|
MeasureMode_Blood = 0x2,
|
|
MeasureMode_Spo2 = 0x4,
|
|
MeasureMode_Glu = 0x20,
|
|
MeasureMode_Ecg = 0x9,
|
|
MeasureMode_Temp = 0x40,
|
|
MeasureMode_Acid = 0x80,
|
|
MeasureMode_Lipid = 0x81,
|
|
MeasureMode_HB = 0x3,
|
|
MeasureMode_HBS = 0x7,
|
|
MeasureMode_EXIT = 0xff,
|
|
}MeasureMode_t;
|
|
|
|
typedef struct{
|
|
void (*init)(void);
|
|
void (*deinit)(void);
|
|
int32_t (*open)(hr_api_info_t);
|
|
int32_t (*close)(void);
|
|
int32_t (*hr_allday_open)(void);
|
|
int32_t (*hr_allday_close)(void);
|
|
int32_t (*spo2_allday_open)(void);
|
|
int32_t (*spo2_allday_close)(void);
|
|
int32_t (*hrv_allday_open)(void);
|
|
int32_t (*hrv_allday_close)(void);
|
|
hr_wear_status_t (*hrs_wear_status)(void);
|
|
hr_service_id_t (*hrs_get_service_id)(void);
|
|
#ifdef TJD_PCBA_0
|
|
#elif defined(TJD_PCBA_1)
|
|
#endif
|
|
}service_hrs_api;
|
|
|
|
uint8_t tjd_service_hrsensor_get_cur_hrvalue(void);
|
|
uint8_t tjd_service_hrsensor_get_cur_spo2value(void);
|
|
uint8_t tjd_service_hrsensor_get_cur_stressvalue(void);
|
|
service_hrs_api *tjd_service_hrs_get_ops(void);
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#endif
|