From: @CHENG <2393524978@qq.com> Date: Sun, 29 Sep 2024 09:05:53 +0000 (+0800) Subject: 结构优化 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=7258d6388b11155b1c163f4c6aa72fb2e065d061;p=mirrors%2FASR3603_Z5.git 结构优化 --- diff --git a/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_hr.h b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_hr.h new file mode 100644 index 00000000..0ada9b3a --- /dev/null +++ b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_hr.h @@ -0,0 +1,111 @@ +#ifndef __LIB_EMOTION_H__ +#define __LIB_EMOTION_H__ + +#ifdef __cplusplus +extern "C"{ +#endif +#include +#include +#include + + +#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 +#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 diff --git a/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h new file mode 100644 index 00000000..0ada9b3a --- /dev/null +++ b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h @@ -0,0 +1,111 @@ +#ifndef __LIB_EMOTION_H__ +#define __LIB_EMOTION_H__ + +#ifdef __cplusplus +extern "C"{ +#endif +#include +#include +#include + + +#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 +#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 diff --git a/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.090324.lib b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.090324.lib new file mode 100644 index 00000000..fb3017b8 --- /dev/null +++ b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_hr_yll_v0.5.3.090324.lib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b83e7384c01f3563c3426552f63438884ec9bb43c2a330473f48eeca353d1c6e +size 202348 diff --git a/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.lib b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.lib new file mode 100644 index 00000000..fb3017b8 --- /dev/null +++ b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.lib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b83e7384c01f3563c3426552f63438884ec9bb43c2a330473f48eeca353d1c6e +size 202348 diff --git a/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/readme.txt b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/readme.txt new file mode 100644 index 00000000..1b7b1a94 --- /dev/null +++ b/2.sdk/project/Z5_HA_K18/product/craneg_modem/cust/heng_ai_sleep/readme.txt @@ -0,0 +1,11 @@ +由于各项目使用的库文件不一致 +为节省空间资源 +做如下操作 + +手动将要使用的库文件命名为 lib_sleep.a 或者 lib_sleep.lib +头文件命名为 lib_sleep.h + +编译时会自动复制到\sdk\product\craneg_modem 对应目录下 +自动替换默认的同名空文件 +请勿提交自动替换修改的文件 + diff --git a/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h new file mode 100644 index 00000000..092ced79 --- /dev/null +++ b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h @@ -0,0 +1,99 @@ +/* + * lib_sleep.h + * + * Created on: 2023Äê11ÔÂ7ÈÕ + * Author: HA-RD01 + */ + +#ifndef __LIB_SLEEP_H__ +#define __LIB_SLEEP_H__ + +#ifdef __cplusplus +extern "C"{ +#endif +// #include +#include +#include + + +#define SAMPLERATE 81 // sampling rate +#define SAMPLETIME 10 // sampling time (seconds) data of which will be processed every time +#define EMOTIONTIME 60 +#define SINGLETIME 10 +#define MAX_SLEEP_STATE 50 + + +/* Integer data types */ +#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && \ + (!defined(__ICC8051__) || (__ICC8051__ == 0))) +#include +#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); + +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); + + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.a similarity index 100% rename from 2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a rename to 2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.a diff --git a/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a new file mode 100644 index 00000000..e5700b6c Binary files /dev/null and b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep_yll_v0.2.6.111623.a differ diff --git a/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/readme.txt b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/readme.txt new file mode 100644 index 00000000..1b7b1a94 --- /dev/null +++ b/2.sdk/project/Z5_HA_K7/product/craneg_modem/cust/heng_ai_sleep/readme.txt @@ -0,0 +1,11 @@ +由于各项目使用的库文件不一致 +为节省空间资源 +做如下操作 + +手动将要使用的库文件命名为 lib_sleep.a 或者 lib_sleep.lib +头文件命名为 lib_sleep.h + +编译时会自动复制到\sdk\product\craneg_modem 对应目录下 +自动替换默认的同名空文件 +请勿提交自动替换修改的文件 + diff --git a/2.sdk/sdk/product/craneg_modem/CMakeLists.txt b/2.sdk/sdk/product/craneg_modem/CMakeLists.txt index ab3111fc..3c758a8d 100644 --- a/2.sdk/sdk/product/craneg_modem/CMakeLists.txt +++ b/2.sdk/sdk/product/craneg_modem/CMakeLists.txt @@ -545,7 +545,9 @@ set_property(TARGET modem PROPERTY IMPORTED_OBJECTS cust/rt_ringbuffer/lib/rt_ringbuffer.a 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_sleep_yll_v0.2.6.111623.a + cust/heng_ai_sleep/lib/lib_sleep.a + cust/heng_ai_sleep/lib/lib_sleep.lib # MODEM_LIB_ALIOS_LTEGSM_END ) endif() # if($ENV{PS_MODE} STREQUAL "LTEGSM") diff --git a/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h b/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h index 092ced79..e69de29b 100644 --- a/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h +++ b/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/inc/lib_sleep.h @@ -1,99 +0,0 @@ -/* - * lib_sleep.h - * - * Created on: 2023Äê11ÔÂ7ÈÕ - * Author: HA-RD01 - */ - -#ifndef __LIB_SLEEP_H__ -#define __LIB_SLEEP_H__ - -#ifdef __cplusplus -extern "C"{ -#endif -// #include -#include -#include - - -#define SAMPLERATE 81 // sampling rate -#define SAMPLETIME 10 // sampling time (seconds) data of which will be processed every time -#define EMOTIONTIME 60 -#define SINGLETIME 10 -#define MAX_SLEEP_STATE 50 - - -/* Integer data types */ -#if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) && \ - (!defined(__ICC8051__) || (__ICC8051__ == 0))) -#include -#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); - -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); - - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.a b/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.a new file mode 100644 index 00000000..e69de29b diff --git a/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.lib b/2.sdk/sdk/product/craneg_modem/cust/heng_ai_sleep/lib/lib_sleep.lib new file mode 100644 index 00000000..e69de29b