Re-organized sub-directory by category
[staging/basesystem.git] / service / vehicle / positioning / server / include / Sensor / DeadReckoning_main.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_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
18 #define POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_
19 /****************************************************************************
20  * File name        :DeadReckoning_main.h
21  * System name        :PastModel002
22  * Subsystem name    :
23  ******************************************************************************/
24
25 #include <vehicle_service/positioning_base_library.h>
26
27 #include "Sensor_Common_API.h"
28
29 #include "Dead_Reckoning_API.h"
30 #include "Dead_Reckoning_Local_Api.h"
31 #include "DeadReckoning_Common.h"
32 #include "DeadReckoning_DataMaster.h"
33 #include "DeadReckoning_DeliveryCtrl.h"
34
35 #include "Sensor_API.h"
36 #include "VehicleSens_DeliveryCtrl.h"
37 #include "VehicleDebug_API.h"
38 /************************************************************************
39 *            Macro definitions                                                 *
40 ************************************************************************/
41 /* Return value */
42 #define RET_SWMNG_SUCCESS                             RET_NORMAL    /* Success of API processing                */
43 #define RET_SWMNG_ERROR                               RET_ERROR     /* API processing failed                */
44
45 /*** Rcv Message Relationships ***************************************************/
46 /* Size of data section */
47 #define DEAD_RECKONING_RCVMSG_MSGBUF                  512           /* RcvMSG Byte count in data section    */
48 #define DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF          40            /* RcvMSG Byte count of Sensor data section     */
49 #define DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF    1000          /* RcvMSG Initial Byte count of sensor data section    */
50 #define DEAD_RECKONING_SENSOR_FIRST_NUM               175           /* Initial number of saved sensor data            */
51
52 /* Event initial value                                            */
53 /* DR_API_private. Synchronize with DR_EVENT_VAL_INIT in h    */
54 #define DR_EVENT_VAL_INIT                             (-101)
55
56 /* Event initial value                                                        */
57 /* DeadReckoning_main. Synchronize with h's VEHICELEDEBUG_EVENT_VAL_INIT    */
58 #define VEHICLEDEBUG_EVENT_VAL_INIT                   (-101)
59
60 /* PastModel002 sleep time[ms] for CPU load balancing in the first sensor data processing            */
61 #define DR_FST_SENS_CALC_SLEEP_TIME                   15
62
63 /************************************************************************
64 *            Struct definitions                                                 *
65 ************************************************************************/
66
67 /*********************************************************************
68 * TAG       : DEAD_RECKONING_RCVDATA
69 * ABSTRACT  : Message receive buffer structure
70 ***********************************************************************/
71 typedef struct {
72     T_APIMSG_MSGBUF_HEADER    hdr;
73     u_int8                    data[DEAD_RECKONING_RCVMSG_MSGBUF];                               /* Data portion */
74 } DEAD_RECKONING_RCVDATA;
75
76 /*********************************************************************
77 * TAG       : DEAD_RECKONING_RCVDATA_SENSOR
78 * ABSTRACT  : LineSensor Vehicle Signal Notification Message Structure
79 ***********************************************************************/
80 typedef struct {
81     u_int32                   did;                                                              /* Data ID */
82     u_int8                    size;                                                             /* Size of the data */
83     u_int8                    reserve[3];                                                       /* Reserved */
84     u_int8                    data[DEAD_RECKONING_RCVDATA_SENSOR_MSGBUF];                       /* Data content */
85 } DEAD_RECKONING_RCVDATA_SENSOR;
86
87 /*********************************************************************
88 * TAG       : DEAD_RECKONING_RCVDATA_SENSOR_FIRST
89 * ABSTRACT  : LineSensor Vehicle Signal Notification Message Structure
90 ***********************************************************************/
91 typedef struct {
92     u_int32                   did;                                                              /* Data ID */
93     u_int16                   size;                                                             /* Size of the data */
94     u_int8                    reserve[1];                                                       /* Reserved */
95     u_int8                    num;                                                              /* Number of data */
96     u_int8                    data[DEAD_RECKONING_RCVDATA_SENSOR_FIRST_MSGBUF];                 /* Data content */
97 } DEAD_RECKONING_RCVDATA_SENSOR_FIRST;
98
99 /*********************************************************************
100 * TAG       : DEAD_RECKONING_SAVEDATA_SENSOR_FIRST
101 * ABSTRACT  : LineSensor Vehicle Signal-Storage Message Structures
102 ***********************************************************************/
103 typedef struct {
104     u_int16                   gyro_x_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData];  /* Data content */
105     u_int16                   gyro_y_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData];  /* Data content */
106     u_int16                   gyro_z_data[DEAD_RECKONING_SENSOR_FIRST_NUM * NUM_OF_100msData];  /* Data content */
107     u_int16                   spd_pulse_data[DEAD_RECKONING_SENSOR_FIRST_NUM];                  /* Data content */
108     u_int8                    spd_pulse_check_data[DEAD_RECKONING_SENSOR_FIRST_NUM];            /* Data content */
109     u_int8                    rev_data[DEAD_RECKONING_SENSOR_FIRST_NUM];                        /* Data content */
110     u_int8                    data_num;                                                         /* Number of data */
111     u_int8                    reserve[3];                                                       /* reserve */
112     u_int16                   gyro_x_rcv_size;                                                  /* Receiving Size */
113     u_int16                   gyro_y_rcv_size;                                                  /* Receiving Size */
114     u_int16                   gyro_z_rcv_size;                                                  /* Receiving Size */
115     u_int16                   spd_pulse_rcv_size;                                               /* Receiving Size */
116     u_int16                   spd_pulse_check_rcv_size;                                         /* Receiving Size */
117     u_int16                   rev_rcv_size;                                                     /* Receiving Size */
118 } DEAD_RECKONING_SAVEDATA_SENSOR_FIRST;
119
120 /*********************************************************************
121 * TAG       : DEAD_RECKONING_LONLAT_INFO
122 * ABSTRACT  : Get Position Information Structure
123 ***********************************************************************/
124 typedef struct {
125     u_int8                    calc_called;    /* Whether Calculate_DeadReckoningData was called */
126     u_int8                    available;
127     u_int8                    reserve[2];
128     LONLAT                    lonlat;
129 } DEAD_RECKONING_LONLAT_INFO;
130
131 /************************************************************************
132 *            DeadReckoning_main function prototype                         *
133 ************************************************************************/
134
135 void DeadReckoningRcvMsg(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info);
136 void  DeadReckoningRcvMsgFstSens(const DEAD_RECKONING_RCVDATA *msg, DEAD_RECKONING_LONLAT_INFO *location_info,
137                             const SENSOR_MSG_GPSDATA_DAT  *rcv_gps_msg, Struct_GpsData* send_gps_msg,
138                             Struct_SensData* send_sensor_msg);
139 int32 DeadReckoningInit(void);
140 void DeadReckoningGetDRData(const DEADRECKONING_MSG_GET_DR_DATA *msg);
141 void DeadReckoningSetMapMatchingData(const DR_MSG_MAP_MATCHING_DATA *msg);
142 void DeadReckoningClearBackupData(const DR_MSG_CLEAR_BACKUP_DATA *msg);
143 void DeadReckoningGetLocationLogStatus(PNO pno);
144 void DeadReckoningSetLocationLogStatus(BOOL log_sw, u_int8 severity);
145
146 #endif  // POSITIONING_SERVER_INCLUDE_SENSOR_DEADRECKONING_MAIN_H_ */