#define SAMPLERATE 81 // sampling rate
+//#define SAMPLERATE 100
#define SAMPLETIME 5 // sampling time (seconds) data of which will be processed every time
#define EMOTIONTIME 60
+#define HRVTIME 300
#define BPTIME 30
+#define DDTIME 20 // measure duration of drinking degree
#define SINGLETIME 5
#define MAX_SLEEP_STATE 50
} sleep_data_t;
-void init_sleep_data(sleep_data_t* sdata);
-int get_sleep_time(gsensor_data_t gdata[], const int datalen, const sleep_time_t curtime, sleep_data_t* sdata);
+typedef struct
+{
+ uint16_t sbp;
+ uint16_t dbp;
+ int32_t timestamp; // timestamp in measuretime
+} bps_t;
-// callback function
-typedef void (*extern_get_hr_run_time_cb_t)(int *type, int *sec);
-unsigned int extern_get_hr_run_time_cb_reg(extern_get_hr_run_time_cb_t fun);
+
+// base api (include callback function)
typedef void (*extern_printf_cb_t)(const char* format, ...);
unsigned int extern_printf_cb_reg(extern_printf_cb_t fun);
-// api
int init_algorithm(unsigned char* buf, unsigned int len);
+
+// heart rate variability algorithm api (include callback function)
+typedef void (*extern_get_hr_run_time_cb_t)(int* type, int* sec);
+unsigned int extern_get_hr_run_time_cb_reg(extern_get_hr_run_time_cb_t fun);
int get_hr(int data[], int datalen, int fs, int* hr);
+
+// emotion algorithm api
int ppg_midvalue(int data[], int datalen, int fs, float Fm[25][8], int* fmlen);
int get_emotion_pi(int data[], int datalen, int fs, int* emo, int* pi);
-int ppg_hrv_midvalue(int data[], int datalen, int fs, float midv[25], int* midvlen);
+int get_dd_index(int data[], int datalen, int fs, int* dd, int* hr);
+
+// blood pressure algorithm api
int load_bp_model(unsigned char str_model[], const unsigned int str_model_len);
int get_bp(int data[], int datalen, int fs, int* sbp, int* dbp);
int load_gen_info(int height, int weight, int age, int gender);
int get_bp_general(int data[], int datalen, int fs, int* sbp, int* dbp);
+// sleep algorithm api (include callback function)
+typedef void (*extern_get_wear_state_cb_t)(int8_t* worn);
+unsigned int extern_get_wear_state_cb_reg(extern_get_wear_state_cb_t fun);
+typedef void (*extern_get_inst_hr_cb_t)(uint8_t* hr, sleep_time_t* hr_time);
+unsigned int extern_get_inst_hr_cb_reg(extern_get_inst_hr_cb_t fun);
+void init_sleep_algo_ex(sleep_data_t* sdata, int gfs, int pfs);
+int get_sleep_data_ex(gsensor_data_t gdata[], const int glen, int pdata[], const int plen, const sleep_time_t curtime, sleep_data_t* sdata);
+
+
+// authentication api
void request_validation(
const unsigned char fact[], const unsigned int fact_len,
const unsigned char imei[], const unsigned int imei_len,
const unsigned char req_code[], const unsigned int req_code_len,
const unsigned char key_code[], const unsigned int key_code_len);
+
+// version api
void version_get_string(char* string, unsigned int* str_len);
-int is_good_ppg(int ppg[], unsigned int ppglen, int fs);
+
#ifdef __cplusplus
}
+++ /dev/null
-#ifndef __LIB_EMOTION_H__
-#define __LIB_EMOTION_H__
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#define SAMPLERATE 81 // sampling rate
-#define SAMPLETIME 5 // sampling time (seconds) data of which will be processed every time
-#define EMOTIONTIME 60
-#define BPTIME 30
-#define SINGLETIME 5
-#define MAX_SLEEP_STATE 50
-
-
-/* Integer data types */
-#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && \
- (!defined(__ICC8051__) || (__ICC8051__ == 0)))
-#include <stdint.h>
-#else
- typedef signed char int8_t;
- typedef unsigned char uint8_t;
- typedef signed short int16_t;
- typedef unsigned short uint16_t;
- typedef signed long int32_t;
- typedef unsigned long uint32_t;
- typedef unsigned long long uint64_t;
-#endif
-
-typedef struct
-{
- short int x;
- short int y;
- short int z;
-} gsensor_data_t;
-
-typedef enum
-{
- LS_STATE = 11, // light sleep
- DS_STATE = 12, // deep sleep
- REM_STATE = 2, // rapid eye movement
-} SLEEP_STATE_E;
-
-typedef struct
-{
- uint16_t year;
- uint8_t month;
- uint8_t day;
- uint8_t hour;
- uint8_t minute;
-} sleep_time_t;
-
-typedef struct
-{
- uint32_t duration; // the duration of corresponding state
- SLEEP_STATE_E state; // state
-} sleep_detail_data_t;
-
-typedef struct
-{
- uint32_t total_sleep_time; // minutes
- sleep_time_t begin_sleep_time; // sleep_time_t
- sleep_time_t end_sleep_time;
- uint16_t state_count; // number of some sleep state
- sleep_detail_data_t data[MAX_SLEEP_STATE];
-} sleep_data_t;
-
-
-void init_sleep_data(sleep_data_t* sdata);
-int get_sleep_time(gsensor_data_t gdata[], const int datalen, const sleep_time_t curtime, sleep_data_t* sdata);
-
-
-// callback function
-typedef void (*extern_get_hr_run_time_cb_t)(int *type, int *sec);
-unsigned int extern_get_hr_run_time_cb_reg(extern_get_hr_run_time_cb_t fun);
-typedef void (*extern_printf_cb_t)(const char* format, ...);
-unsigned int extern_printf_cb_reg(extern_printf_cb_t fun);
-// api
-int init_algorithm(unsigned char* buf, unsigned int len);
-int get_hr(int data[], int datalen, int fs, int* hr);
-int ppg_midvalue(int data[], int datalen, int fs, float Fm[25][8], int* fmlen);
-int get_emotion_pi(int data[], int datalen, int fs, int* emo, int* pi);
-int ppg_hrv_midvalue(int data[], int datalen, int fs, float midv[25], int* midvlen);
-int load_bp_model(unsigned char str_model[], const unsigned int str_model_len);
-int get_bp(int data[], int datalen, int fs, int* sbp, int* dbp);
-int load_gen_info(int height, int weight, int age, int gender);
-int get_bp_general(int data[], int datalen, int fs, int* sbp, int* dbp);
-
-void request_validation(
- const unsigned char fact[], const unsigned int fact_len,
- const unsigned char imei[], const unsigned int imei_len,
- unsigned char req_code[], unsigned int* req_code_len);
-
-int activate_algorithm(
- const unsigned char req_code[], const unsigned int req_code_len,
- const unsigned char key_code[], const unsigned int key_code_len);
-
-void version_get_string(char* string, unsigned int* str_len);
-
-int is_good_ppg(int ppg[], unsigned int ppglen, int fs);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
#ifdef __MMI_CUSTOM_HENGAI_SLEEP_K18__
-#include "../../../../product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h"
+#include "../../../../product/craneg_modem/cust/heng_ai_sleep/inc/lib_hr.h"
softutil/fotadm/lib/lib_fotadm.a
softutil/rsfota/redstone/lib/librsdl.a
cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a
- cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.090324.lib
+ #cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.090324.lib
+ cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.120224.lib
# MODEM_LIB_ALIOS_LTEGSM_END
)
endif() # if($ENV{PS_MODE} STREQUAL "LTEGSM")
--- /dev/null
+version https://git-lfs.github.com/spec/v1
+oid sha256:4497f147cda742ae1023055118d4aa8fef6ca2d8f63c994762fd7eae3617be75
+size 222712