Re-organized sub-directory by category
[staging/basesystem.git] / service / vehicle / positioning / server / include / Sensor / VehicleUtility.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /***************************************************************************
18 @file      VehicleUtility.h
19 @detail      Common processing function header file of Vehicle<BR>
20         Vehicle Common Functions Header Files
21 *****************************************************************************/
22 #ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
23 #define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_
24
25 #include <stdint.h>
26 #include <vehicle_service/positioning_base_library.h>
27
28 #ifdef  __cplusplus
29 extern "C" {
30 #endif
31
32 /*------------------------------------------------------------------------------*
33  * Definition                                                                   *
34  *------------------------------------------------------------------------------*/
35 /* GPS-related timer value */
36 #define  TIMVAL_GPS_STARTUP     500  /* 5Sec  Start confirmation monitoring timer        */
37 #define  TIMVAL_GPS_RCVCYCLDAT   500  /* 5Sec  Periodic reception data monitoring timer    */
38 #define  TIMVAL_GPS_RCVACK     500  /* 5Sec  ACK reception monitoring timer          */
39 #define  TIMVAL_GPS_RCVDAT     500  /* 5Sec  Data reception monitoring timer(Not used)  */
40 #define  TIMVAL_GPS_NAVIFST     3000  /* 30sec Initial Navigation Monitoring Timer        */
41 #define  TIMVAL_GPS_NAVICYCLE   300  /* 3sec  Navi monitoring timer          */
42 #define  TIMVAL_GPS_NAVIDISRPT   1000  /* 10Sec  Navigation Monitoring Disruption Log Output Timer  */
43 #define  TIMVAL_GPS_DIAGCLKGUARD   1000  /* 10sec Diag provision time guard monitoring timer  */
44 #define  TIMVAL_GPS_NMEADATAGUARD 1000  /* 10sec NMEA data-providing guard monitoring timer  */
45 #define  TIMVAL_GPS_RECOVERY      60000  /* 600sec GPS recovery timer                  */
46 #define TIMVAL_GPS_RECEIVERERR   60000  /* 600sec GPS receiver anomaly detection timer     */
47
48 /* Sensor-related timer value */
49 #define  TIMVAL_SNS_RCVFSTDAT   3000  /* 30Sec Initial sensor data reception monitoring timer */
50 #define  TIMVAL_SNS_RCVCYCLDAT   300  /* 3Sec  Cyclic sensor data reception monitoring timer */
51 #define  TIMVAL_SNS_RCVDISRPT   1000  /* 10Sec  Cyclic sensor data interruption log output timer */
52
53 /* Timer management table */
54 #define  TIM_NON           0x00  /* Timer counter initial value          */
55 #define  TIM_CNTMIN         0x01  /* Timer counter minimum value          */
56 #define  TIM_CNTMAX         0xff  /* Maximum value of timer counter          */
57 #define  TIMER_OFF         0    /* Timer enable flag OFF          */
58 #define  TIMER_ON         1    /* Timer enable flag ON          */
59
60 /*------------------------------------------------------------------------------*
61  * Structure                                                                    *
62  *------------------------------------------------------------------------------*/
63 /*!
64    @brief   Timer type
65  */
66 typedef enum _VEHICLEUTILITY_TIM_KIND {
67     GPS_STARTUP_TIMER = 0,    /*  0 Start confirmation monitoring timer              */
68   GPS_CYCL_TIMER,        /*  1 Cyclic GPS data reception monitoring timer          */
69   GPS_RECV_ACK_TIMER,      /*  2 ACK reception monitoring timer                */
70   GPS_NAVIFST_TIMER,      /*  3 Initial Navigation Monitoring Timer              */
71   GPS_NAVICYCLE_TIMER,    /*  4 Navi monitoring timer                */
72   GPS_NAVIDISRPT_TIMER,    /*  5 Navigation Monitoring Disruption Log Output Timer          */
73   GPS_DIAGCLK_GUARDTIMER,    /*  6 Diag provision time guard monitoring timer          */
74   GPS_NMEADATA_GUARDTIMER,  /*  7 NMEA data-providing guard monitoring timer        */
75   GPS_RECOVERY_TIMER,         /*  8 GPS recovery timer                         */
76   GPS_RECEIVERERR_TIMER,      /*  9 GPS receiver anomaly detection timer                   */
77   SNS_FST_TIMER,        /* 10 Initial sensor data reception monitoring timer        */
78   SNS_CYCLE_TIMER,      /* 11 Cyclic sensor data reception monitoring timer        */
79   SNS_DISRPT_TIMER,      /* 12 Cyclic sensor data interruption log output timer      */
80   TIM_NUM            /* 13 Number of timer types                  */
81 } VEHICLEUTILITY_TIM_KIND;
82
83 /*!
84    @brief   Master status
85 */
86 typedef struct {
87     u_int8  flag;        /**< Timer flag  OFF:Stop,ON:Start */
88     u_int8  cnt;        /**< Start counter            */
89     int8    rsv[2];        /**< Reserved              */
90 } VEHICLEUTILITY_TIM_STS;
91
92 /*!
93    @brief   Master status management table
94  */
95 typedef struct {
96     VEHICLEUTILITY_TIM_STS  sts[TIM_NUM]; /**< Master status        */
97 } VEHICLEUTILITY_TIM_MNG;
98
99 /*!
100    @brief   Timer setting information table
101 */
102 typedef struct {
103     uint32_t  timer_val;         /**< Timer value                           */
104     PNO        pno;              /**< Event notification destination process number         */
105 } VEHICLEUTILITY_TIM_INFO;
106
107 /*
108   Function prototype declaration
109  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
110 RET_API VehicleUtilitySndMsg(PNO pno, u_int16 size, void *msgbuf, u_int16 mode);
111 RET_API VehicleUtilityRcvMsg(PNO pno, u_int16 size, void **msgbuf, u_int16 mode);
112 void VehicleUtilityDiagCodePut(u_int32 err_id, u_int16 positioning_code);
113 void VehicleUtilityInitTimer(void);
114 BOOL VehicleUtilitySetTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
115 BOOL VehicleUtilityStopTimer(VEHICLEUTILITY_TIM_KIND tim_kind);
116 BOOL VehicleUtilityTimeJdgKnd(uint16_t seqno);
117
118 void LineSensDrvExtTermStsReq(void);
119 RET_API DEVGpsSndBackupDataLoadReq(void);
120 void DEVGpsGetDebugGpsFormatFailCnt(void* p_buf);
121 u_int8 LineSensDrvGetSysRecvFlag(void);
122 uint16_t DEVGpsGetWknRollover(void);
123
124 #ifdef  __cplusplus
125 }
126 #endif
127
128 #endif  // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLEUTILITY_H_ */