PDR/1.Software/PDR 1.04/include/scene_recognition.h

158 lines
6.8 KiB
C
Raw Permalink Normal View History

2022-10-07 23:49:43 +08:00
/*********************************************************************************/
/* FILE NAME : scene_recognition.h */
/* AUTHOR : Zhang Jingrui, ID: 11082826, Version: V0.1_Beta, Data:2019-03-28 */
/* DESCRIPTION: This header file conterns the prototype description of the external */
/* interface funtions of the scene recognition module and the definit- */
/* ion of related resources. */
/* HISTORY : (NONE) */
/********************************************************************************/
#ifndef _PDR_SCENE_RECOGNITION_H_
#define _PDR_SCENE_RECOGNITION_H_
/* Header Files Including -----------------------------------------*/
/*=================================================================*/
#include "pdr_sensor.h"
/* Macro Declaration ----------------------------------------------*/
/*=================================================================*/
#define _TIME_BUFFER_SIZE 10 /* Buffer size for the time calculation. */
#define _ACCURACY_BUFFER_SIZE 9 /* Accuracy time-based buffer size. */
#define _GNSS_INDEX_LEN 103 /* Structural array size in _GnssInfo. */
/* Extern Variable Declaration ------------------------------------*/
/*=================================================================*/
//extern int scene_recognition_debug_flag ;
//extern int scene_recognition_log_debug_flag ;
/* Status Declaration ---------------------------------------------*/
/*=================================================================*/
/* Usage: <20><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>־λ */
typedef enum SCENE_INIT_STATE
{
// <20><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
INIT_SUCCESS = 0,
INIT_NOT_PERFORMED,
INIT_ERROR_MEMORY_OCCUPIED, // ģ<><C4A3><EFBFBD><EFBFBD>Դδ<D4B4><CEB4>ǰ<EFBFBD>ͷţ<CDB7><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ
INIT_ERROR_MEMORY_INIT_FAILED, // <20><>ʼ<EFBFBD><CABC><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
INIT_ERROR_REDUNDANCY, // ģ<><C4A3><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9A3AC><EFBFBD>ԣ<EFBFBD>
// <20><><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>ȹر<C8B9>ģ<EFBFBD><EFBFBD>رճɹ<D5B3><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>³<EFBFBD>ʼ<EFBFBD><CABC>ģ<EFBFBD>
// <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>飬Ч<E9A3AC><D0A7>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>1<EFBFBD><31>
// <20><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬(for debug)
INIT_RESET_SUCCESS = 0,
INIT_RESET_FAILED
} SCENE_INIT_STATE;
/* Usage: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
typedef enum SCENE_RECOGNITION_RESULT
{
RECOG_UNKNOWN, // δ<><CEB4>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬(Ĭ<><C4AC>״̬)
RECOG_OPEN_AREA, // <20><><EFBFBD><EFBFBD>open-area
RECOG_OTHERS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RECOG_ERROR_PARAM_INCRECT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RECOG_ERROR_NMEA_INFO_MISS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/* Ԥ<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>ȶ<EFBFBD>) */
RECOG_MULTIPATH // <20><><EFBFBD><EFBFBD><EFBFBD>
} SCENE_RECOGNITION_RESULT;
/* Usage: <20><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>Դ<EFBFBD>ͷŲ<CDB7><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
typedef enum SCENE_DESTROY_STATE
{
DESTROY_SUCCESS = 0,
DESTROY_FIALED,
DESTROY_ERROR,
DESTROY_INVALID // <20><>Ч<EFBFBD>ͷŲ<CDB7><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<CABE>ж<EFBFBD>Ӧ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
} SCENE_DESTROY_STATE;
/* Status Declaration--------------------------------------------*/
/*===============================================================*/
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6>ģ<EFBFBD><C4A3><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>״̬
typedef enum _SCENE_MODEL_WORK_STATE
{
MODEL_OFF,
MODEL_ON
} _SCENE_MODEL_WORK_STATE;
/* Usage: Identifier of the quality of the satellites' signal source. */
typedef enum _SIGNAL_QUALITY
{
SIG_UNKNOWN,
GOOD,
BAD
} SIGNAL_QUALITY;
/* Usage: extract and save information from Nmea_t for the module. */
/* This is the interface for the Nmea_t. */
2022-10-07 23:49:43 +08:00
typedef struct _GnssInfo
{
int update; // GNSS<53><53><EFBFBD>±<EFBFBD>־λ 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double local_timestamp; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
float accuracy; // GPS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Accuracy<63><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Accuracy > 0 <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ч
int sat_visible_number; // <20><>ǰʱ<C7B0><CAB1><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
float snr_list[_GNSS_INDEX_LEN]; // <20><>ǰʱ<C7B0><CAB1><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ǵ<EFBFBD>SNR<4E>б<EFBFBD>
int sat_used_list[_GNSS_INDEX_LEN]; // <20><>ǰʹ<C7B0><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
} GnssInfo;
/* Usage: <20><><EFBFBD><EFBFBD>GNSS<53>еĸ<D0B5><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ */
/* Struct Declaration -------------------------------------------*/
/*===============================================================*/
/* Function Declaration -------------------------------------------*/
/*=================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
/* Function Name: sceneRecognitionInit() */
/* Usage: Initialization module for configuring related resources */
/* and must be executed once first beforing using the scene */
/* recognition module funcition. */
/* Param @ (NONE) */
/* Return @ init_res: Result state of the initialization process. */
SCENE_INIT_STATE SceneRecog_Init(void);
/* Function Name: scene_recognition_reset() */
/* Usage: <20><>ʼ<EFBFBD><CABC>ģ<EFBFBD><EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ģ<EFBFBD><C4A3>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD>ִ<EFBFBD>С<EFBFBD> */
/* Param @ (NONE) */
/* Return @ init_res: <20><><EFBFBD><EFBFBD>ִ<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD> */
SCENE_INIT_STATE scene_recognition_reset(void);
/**----------------------------------------------------------------------
* Function : sceneRecognitionProc
* Description : GNSS<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>
* 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>nmeaת<EFBFBD><EFBFBD>Ϊgnss
* 2) ͨ<EFBFBD><EFBFBD>accuracy<EFBFBD><EFBFBD>snr<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GNSS<EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 3) <EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD>
* Input : PDR<EFBFBD><EFBFBD>nmea<EFBFBD><EFBFBD><EFBFBD>
* Return : <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Date : 2020/02/18
*---------------------------------------------------------------------**/
SCENE_RECOGNITION_RESULT sceneRecognitionProc(const Nmea_t* nmea);
2022-10-07 23:49:43 +08:00
/* Function Name: scene_recognition_destroy() */
/* Usage: <20><><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ͷŲ<CDB7><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ͷź<CDB7><C5BA>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD> */
/* <20><>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD> */
/* Param @ (NONE) */
/* Return @ destroy_state: <20><>Դ<EFBFBD>ͷŲ<CDB7><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
SCENE_DESTROY_STATE scene_recognition_destroy(void);
/**----------------------------------------------------------------------
* Function : isOpenArea
* Description : GNSS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GNSS<EFBFBD>źţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>ȷ<EFBFBD><EFBFBD>
* Ŀ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ء<EFBFBD>
* Return : 0 : <EFBFBD>ǿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD>)
* Author : Zhang Jingrui, Geek ID: 11082826
* Date : 2020/02/18 logzhan
*---------------------------------------------------------------------**/
int isOpenArea(const Nmea_t* nmea);
2022-10-07 23:49:43 +08:00
#ifdef __cplusplus
}
#endif
#endif //__SCENE_RECOGNITION_H__