Init basesystem source codes.
[staging/basesystem.git] / vehicleservice / positioning / client / include / SensorMotion_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 /******************************************************************************
18 @file       SensorMotion_API.h
19 @detail     SensorMotion_API external header file<BR>
20             SensorMotion_API External public header
21 ******************************************************************************/
22 #ifndef POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
23 #define POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_
24
25 /*****************************************************************************
26  *                              Include                                      *
27  *****************************************************************************/
28
29 /*****************************************************************************
30  *                               Define                                      *
31  *****************************************************************************/
32 /* Command ID */
33 /* Vehicle sensor information notification CID (Rate information) */
34 #define CID_VEHICLE_SENSORMOTION_SPEED                  (0x0203)
35 /* Vehicle sensor information notification CID (Orientation information) */
36 #define CID_VEHICLE_SENSORMOTION_HEADING                (0x0204)
37
38 /* Vehicle sensor information notification CID (GyroTrouble information) */
39 #define CID_VEHICLE_SENSORMOTION_GYROTROUBLE            (0x020A)
40 /* Vehicle sensor information notification CID (GyroParameter information) */
41 #define CID_VEHICLE_SENSORMOTION_GYROPARAMETER          (0x020B)
42 /* Vehicle sensor information notification CID (SpeedParameter information) */
43 #define CID_VEHICLE_SENSORMOTION_SPEEDPULSEPARAMETER    (0x020C)
44
45 /* SENSORMOTION_RET_API definition */
46 #define SENSORMOTION_RET_NORMAL                         (0)     /* Successful completion  */
47 #define SENSORMOTION_RET_ERROR_PARAM                    (-1)    /* Parameter error    */
48 #define SENSORMOTION_RET_ERROR_BUFFULL                  (-2)    /* Number of registered FULL */
49 #define SENSORMOTION_RET_ERROR_INNER                    (-3)    /* Internal error    */
50
51 /* Delivery opportunity definition */
52 #define SENSORMOTION_DELIVERY_TIMING_CHANGE             (0)     /* Change    */
53 #define SENSORMOTION_DELIVERY_TIMING_UPDATE             (1)     /* UpDate    */
54
55 /* Presence information definitions DR */
56 #define SENSORMOTION_EXISTDR_NODR                       (0)     /* Without DR   */
57 #define SENSORMOTION_EXISTDR_DR                         (1)     /* There DR    */
58
59 /* DR state definition */
60 #define SENSORMOTION_DRSTATUS_INVALID                   (0)     /* Invalid            */
61 #define SENSORMOTION_DRSTATUS_GPS_NODR                  (1)     /* Information use GPS, not yet implemented DR */
62 #define SENSORMOTION_DRSTATUS_NOGPS_DR                  (2)     /* No information available GPS, DR implementation */
63 #define SENSORMOTION_DRSTATUS_GPS_DR                    (3)     /* Information use GPS, DR implementation */
64
65 /*----------------------------------------------------------------------*
66  * General Purpose Definition
67  *----------------------------------------------------------------------*/
68 #define SENSORMOTION_NORMAL                             (0U)
69 #define SENSORMOTION_ERROR                              (1U)
70 #define SENSORMOTION_UNFIXED                            (2U)
71
72 /*****************************************************************************
73  *                                  Typedef                                  *
74  *****************************************************************************/
75 typedef int32 SENSORMOTION_RET_API;
76
77 /*****************************************************************************
78  *                                  Struct                                   *
79  *****************************************************************************/
80 /*****************************************************************************
81  * TAG   : SENSORMOTION_SPEEDINFO_DAT
82  * ABSTRACT  : Vehicle speed information data structure
83  * NOTE   :
84  *****************************************************************************/
85 typedef struct {
86     u_int16                                   size;           /* Size          */
87     u_int8                                    sensor_cnt;     /* Sensor counter value      */
88     u_int8                                    is_exist_dr;    /* Presence or absence information DR  */
89     u_int8                                    dr_status;      /* DR state         */
90     u_int8                                    reserve;        /* Reserve         */
91     u_int16                                   speed;          /* Speed(0.01m/sec)       */
92 } SENSORMOTION_MSG_SPEEDINFO_DAT;
93
94 /*****************************************************************************
95  * TAG   : SENSORMOTION_MSG_HEADINGINFO_DAT
96  * ABSTRACT  : Orientation information data structure
97  * NOTE   :
98  *****************************************************************************/
99 typedef struct {
100     u_int16                                   size;           /* Size          */
101     u_int8                                    sensor_cnt;     /* Sensor counter value      */
102     u_int8                                    is_exist_dr;    /* Presence or absence information DR  */
103     u_int8                                    dr_status;      /* DR state         */
104     u_int8                                    reserve;        /* Reserve         */
105     u_int16                                   heading;        /* Heading         */
106 } SENSORMOTION_MSG_HEADINGINFO_DAT;
107
108 /*****************************************************************************
109  * TAG   : SENSORMOTION_MSG_GYROTROUBLEINFO_DAT
110  * ABSTRACT  : GyroTrouble information data structure
111  * NOTE   :
112  *****************************************************************************/
113 typedef struct {
114     u_int16                                   size;           /* Size          */
115     u_int8                                    gyro_trouble;   /* Gyro Trouble Status      */
116     u_int8                                    reserve;        /* Reserve         */
117 } SENSORMOTION_MSG_GYROTROUBLEINFO_DAT;
118
119 /*****************************************************************************
120  * TAG   : SENSORMOTION_MSG_GYROTROUBLEINFO
121  * ABSTRACT  : Delivery of the message GyroTrouble information
122  * NOTE   : Message structure(VehicleSens -> User)
123  *****************************************************************************/
124 typedef struct {
125     T_APIMSG_MSGBUF_HEADER                    hdr;            /* Message header    */
126     SENSORMOTION_MSG_GYROTROUBLEINFO_DAT      data;           /* Delivery data (GyroTrouble) */
127 } SENSORMOTION_MSG_GYROTROUBLEINFO;
128
129 /*****************************************************************************
130  * TAG   : SENSORMOTION_MSG_GYROPARAMETERINFO_DAT
131  * ABSTRACT  : GyroParameter information data structure
132  * NOTE   :
133  *****************************************************************************/
134 typedef struct {
135     u_int16                                   size;           /* Size          */
136     u_int16                                   gyro_offset;    /* Gyro Offset        */
137     u_int8                                    gyro_scale_factor;          /* Gyro Scale Factor */
138     u_int8                                    gyro_scale_factor_level;    /* Gyro Scale Factor Level */
139     u_int8                                    reserve[2];     /* Reserve         */
140 } SENSORMOTION_MSG_GYROPARAMETERINFO_DAT;
141
142 /*****************************************************************************
143  * TAG   : SENSORMOTION_MSG_GYROPARAMETERINFO
144  * ABSTRACT  : Delivery of the message GyroParameter information
145  * NOTE   : Message structure(VehicleSens -> User)
146  *****************************************************************************/
147 typedef struct {
148     T_APIMSG_MSGBUF_HEADER                    hdr;            /* Message header     */
149     SENSORMOTION_MSG_GYROPARAMETERINFO_DAT    data;           /* Delivery data (GyroParameter) */
150 } SENSORMOTION_MSG_GYROPARAMETERINFO;
151
152 /*****************************************************************************
153  * TAG   : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT
154  * ABSTRACT  : SpeedPulseParameter information data structure
155  * NOTE   :
156  *****************************************************************************/
157 typedef struct {
158     u_int16                                   size;           /* Size          */
159     u_int16                                   speed_pulse_scale_factor;          /* Speed Pulse Scale Factor */
160     u_int8                                    speed_pulse_scale_factor_level;    /* Speed Pulse Scale Factor Level */
161     u_int8                                    reserve[3];     /* Reserve         */
162 } SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT;
163
164 /*****************************************************************************
165  * TAG   : SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO
166  * ABSTRACT  : Delivery of the message SpeedPulseParameter information
167  * NOTE   : Message structure(VehicleSens -> User)
168  *****************************************************************************/
169 typedef struct {
170     T_APIMSG_MSGBUF_HEADER                          hdr;      /* Message header      */
171     SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO_DAT    data;     /* Delivery data (SpeedPulseParameter) */
172 } SENSORMOTION_MSG_SPEEDPULSEPARAMETERINFO;
173
174 /*****************************************************************************
175  *                              Function prototypes                          *
176  *****************************************************************************/
177
178 #endif  // POSITIONING_CLIENT_INCLUDE_SENSORMOTION_API_H_