common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / client / include / Dead_Reckoning_API.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 #ifndef POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
18 #define POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_
19 /****************************************************************************
20  * File name        :Dead_Reckoning_API.h
21  * System name        :PastModel002
22  * Subsystem name    :
23  ******************************************************************************/
24
25 /*****************************************************************************
26  *            Include                                                        *
27  *****************************************************************************/
28 #include <vehicle_service/positioning_base_library.h>
29 #include "Sensor_Common_API.h"
30 #include <native_service/frameworkunified_types.h>
31
32 /*****************************************************************************
33  *            Define                                                         *
34  *****************************************************************************/
35 #define NUM_OF_100msData    (10)    /* Number of gyro data items delivered every 100 ms */
36
37 /*****************************************************************************
38  *            Typedef                                                        *
39  *****************************************************************************/
40 typedef RET_API DR_RET_API;
41
42 /*****************************************************************************
43  *            Enumeration                                                    *
44  *****************************************************************************/
45 /*******************************************************************************
46  TAG        : NAVI_MATCHING_STATUS
47  ABSTRACT    : Map matching data(Status)
48  NOTE        :
49 *******************************************************************************/
50 typedef enum NaviMatchingStatus {
51     NAVI_MATCHING_STS_2D_FIX = 0x00,
52     NAVI_MATCHING_STS_3D_FIX,
53     NAVI_MATCHING_STS_DR_COMBINED,
54     NAVI_MATCHING_STS_DR_ONLY,
55     NAVI_MATCHING_STS_MAP_2D_GPS_FIX,
56     NAVI_MATCHING_STS_MAP_3D_GPS_FIX,
57     NAVI_MATCHING_STS_MAP_DR_COMBINED,
58     NAVI_MATCHING_STS_MAP_DR_ONLY,
59     NAVI_MATCHING_STS_MAP_NO_FIX,
60     NAVI_MATCHING_STS_AWAITING_FIRST_FIX,
61     NAVI_MATCHING_STS_DATA_INVALID,
62     NAVI_MATCHING_STS_NO_FIX,
63     NAVI_MATCHING_STS_TIME_ONLY_FIX
64 } NAVI_MATCHING_STATUS;
65
66 /*******************************************************************************
67  TAG        : NAVI_MATCHING_DATA_AVAILABLE
68  ABSTRACT    : Map matching data(Availability)
69  NOTE        :
70 *******************************************************************************/
71 typedef enum {
72     NAVI_MATCHING_DATA_INVALID = 0x00,
73     NAVI_MATCHING_DATA_VALID
74 } NAVI_MATCHING_DATA_AVAILABLE;
75
76 /*****************************************************************************
77  *            Struct                                                         *
78  *****************************************************************************/
79 /* Sensor data */
80 /*******************************************************************************
81  TAG      : Struct_PulseRevTbl
82  ABSTRACT : Vehicle speed/REV data table structure
83  NOTE      : 4byte
84 *******************************************************************************/
85 typedef struct {
86     u_int8     reverse_flag;                /* 0:Forward march 1:Backward 3:Disabled Reverse signal status */
87     u_int8     pulse_flag;                  /* Vehicle speed pulse flag */
88     /* 0:Enabled 1:Receive invalid value from CAN 2:Unable to receive at download timing */
89     u_int16    pulse_sum_cyclic;            /* Vehicle speed pulse counter value */
90 } Struct_PulseRevTbl;
91 /*******************************************************************************
92  TAG      : Struct_GyroTbl
93  ABSTRACT : Gyro Data Table Structure
94  NOTE      : 20byte
95 *******************************************************************************/
96 typedef struct {
97     u_int16  gyro_data[NUM_OF_100msData];    /* A/D-converted gyro data */
98 } Struct_GyroTbl;
99 /*******************************************************************************
100  TAG        : Struct_SensData
101  ABSTRACT    : Sensor data structure
102  NOTE        :
103 *******************************************************************************/
104 typedef struct {
105     u_int8                sens_cnt_flag;    /* Sensor data transmission counter flag */
106     /* 0:Disabled(->Initial Sensor) 1:Enabled(->100 ms periodic transmission) */
107     /* Set "0" for initial sensor transmission and "1" for periodic transmission. */
108     u_int8                sens_cnt;         /* Sensor data transmission counter value Set "0" at initial transmission of sensor */
109     Struct_PulseRevTbl    pulse_rev_tbl;    /* Vehicle speed/REV Data table */
110     Struct_GyroTbl        gyro_x_tbl;       /* Gyro(X axis) data table */
111     Struct_GyroTbl        gyro_y_tbl;       /* Gyro(Y axis) data table */
112     Struct_GyroTbl        gyro_z_tbl;       /* Gyro(Z axis) data table */
113 } Struct_SensData;
114
115 /* GPS data */
116 /*******************************************************************************
117  TAG        : Struct_GpsData
118  ABSTRACT    : GPS data structure
119  NOTE        :
120 *******************************************************************************/
121 typedef struct {
122     u_int8                sens_cnt;         /* Sensor data transmission counter value             */
123     u_int8                sens_cnt_flag;    /* Sensor data transmission counter flag         */
124     /* 0:Disabled(Incorrect GPS sensor counter)    */
125     /* 1:Enabled                                */
126     u_int16               gps_data_size;    /* GPS data storage area size                */
127     DID                   did;              /* Data ID                                */
128     const void*           gps_data;         /* GPS data storage area                     */
129 } Struct_GpsData;
130
131 /* Estimated Navigation Calculation Result */
132 /*******************************************************************************
133  TAG        : Struct_DR_DATA
134  ABSTRACT    : Estimated Navigation Calculation Result
135  NOTE        :
136 *******************************************************************************/
137 typedef struct {
138     int64_t               latitude;         /* Latitude(WGS-84) 10^-7deg        */
139     int64_t               longitude;        /* Longitude(WGS-84) 10^-7deg        */
140     int64_t               altitude;         /* Altitude 10^-2m                    */
141     u_int16               rate;             /* Speeds 10^-2m/sec                */
142     u_int16               heading;          /* Orientation North-reference clockwise 10^-2deg    */
143     u_int16               reserve;          /* RESERVE                        */
144     u_int8                dr_status;        /* DR calculation status                */
145     u_int8                positioning_time; /* Sensor Counter                */
146 } Struct_DR_DATA;
147
148 /*******************************************************************************
149  TAG        : DR_CALC_INFO
150  ABSTRACT    : Estimated navigation information
151  NOTE        :
152 *******************************************************************************/
153 typedef struct {
154     u_int16               gyro_offset;                     /* Correction coefficient:Gyro offset */
155     u_int8                gyro_scale_factor;               /* Correction coefficient:Gyro Sensitivity */
156     u_int8                gyro_scale_factor_level;         /* Learning Level(Gyro Sensitivity) */
157     u_int16               speed_pulse_scale_factor;        /* Correction coefficient:Vehicle speed factor */
158     u_int8                speed_pulse_scale_factor_level;  /* Learning Level(Vehicle speed factor) */
159     u_int8                reserve;                         /* Reserve(1Byte) */
160 } DR_CALC_INFO;
161
162 /*******************************************************************************
163  TAG        : DR_POSITION_INFO
164  ABSTRACT    : Location information
165  NOTE        :
166 *******************************************************************************/
167 typedef struct {
168     int64_t                         latitude;
169     int64_t                         longitude;
170     NAVI_MATCHING_DATA_AVAILABLE    status;
171 } DR_POSITION_INFO;
172
173 /*******************************************************************************
174  TAG        : DR_RATE_INFO
175  ABSTRACT    : Location information
176  NOTE        :
177 *******************************************************************************/
178 typedef struct {
179     u_int16                         rate;
180     u_int8                          reserve[2];
181     NAVI_MATCHING_DATA_AVAILABLE    status;
182 } DR_RATE_INFO;
183
184 /*******************************************************************************
185  TAG        : DR_ORIENT_INFO
186  ABSTRACT    : Location information
187  NOTE        :
188 *******************************************************************************/
189 typedef struct {
190     u_int16                         orient;
191     u_int8                          reserve[2];
192     NAVI_MATCHING_DATA_AVAILABLE    status;
193 } DR_ORIENT_INFO;
194
195 /*******************************************************************************
196  TAG        : NAVI_MATCHING_DATA
197  ABSTRACT    : Map matching data
198  NOTE        :
199 *******************************************************************************/
200 typedef struct {
201     DR_POSITION_INFO        position_info;
202     DR_RATE_INFO            rate_info;
203     DR_ORIENT_INFO          orient_info;
204     NAVI_MATCHING_STATUS    status;
205 } NAVI_MATCHING_DATA;
206
207 /************************************************************************
208 *            Function prototype                                            *
209 ************************************************************************/
210 #ifdef __cplusplus
211 extern "C" {
212 #endif
213
214 DR_RET_API DeadReckoningLibraryInit(void);
215 DR_RET_API SetGpsData(Struct_GpsData *st_gps_data);
216 DR_RET_API CalculateDeadReckoningData(Struct_SensData *st_sensor_data,
217                                        Struct_DR_DATA *st_dr_data, DR_CALC_INFO *dr_calc_data);
218 DR_RET_API SetMatchingData(NAVI_MATCHING_DATA *st_matching_data);
219
220 DR_RET_API ClearBackupData(void);                                          /* Clear DR backup data */
221 /* BOOL Problem Avoidance */
222 DR_RET_API GetLocationLogSetting(int *log_sw, unsigned char *severity);    /* Location log output ON/OFF acquisition */
223 DR_RET_API SetLocationLogStatus(int log_sw, unsigned char severity);       /* Location log output ON/OFF setting */
224
225 #ifdef __cplusplus
226 }
227 #endif
228
229 #endif  // POSITIONING_CLIENT_INCLUDE_DEAD_RECKONING_API_H_