--- /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
--- /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
--- /dev/null
+version https://git-lfs.github.com/spec/v1
+oid sha256:b83e7384c01f3563c3426552f63438884ec9bb43c2a330473f48eeca353d1c6e
+size 202348
--- /dev/null
+version https://git-lfs.github.com/spec/v1
+oid sha256:b83e7384c01f3563c3426552f63438884ec9bb43c2a330473f48eeca353d1c6e
+size 202348
--- /dev/null
+由于各项目使用的库文件不一致
+为节省空间资源
+做如下操作
+
+手动将要使用的库文件命名为 lib_sleep.a 或者 lib_sleep.lib
+头文件命名为 lib_sleep.h
+
+编译时会自动复制到\sdk\product\craneg_modem 对应目录下
+自动替换默认的同名空文件
+请勿提交自动替换修改的文件
+
--- /dev/null
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+#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 <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);
+
+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
+
--- /dev/null
+由于各项目使用的库文件不一致
+为节省空间资源
+做如下操作
+
+手动将要使用的库文件命名为 lib_sleep.a 或者 lib_sleep.lib
+头文件命名为 lib_sleep.h
+
+编译时会自动复制到\sdk\product\craneg_modem 对应目录下
+自动替换默认的同名空文件
+请勿提交自动替换修改的文件
+
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")
-/*
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#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 <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);
-
-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
-