Init basesystem source codes.
[staging/basesystem.git] / positioning_hal / hal_api / gps_hal.h
1 /*
2  * @copyright Copyright (c) 2018-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 HAL_API_GPS_HAL_H_
18 #define HAL_API_GPS_HAL_H_
19
20 /**
21  * @file gps_hal.h
22  */
23
24 /** @addtogroup positioning
25  *  @{
26  */
27 /** @addtogroup positioning_hal
28  *  @ingroup positioning
29  *  @{
30  */
31
32 /*---------------------------------------------------------------------------*/
33 // Include files
34
35 #include <native_service/frameworkunified_types.h>
36 #include <vehicle_service/pos_message_header.h>
37 #include <vehicle_service/std_types.h>
38
39 /*---------------------------------------------------------------------------*/
40 // Value define
41
42 typedef int32               RET_API;
43 typedef uint32_t            DID;
44
45 /*************************************************************************
46  *  RET_API define
47  *************************************************************************/
48 /*--- for message ---*/
49 #define POS_TIMESTS_NG  0x00
50 //!< \~english time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
51 #define POS_TIMESTS_RTC 0x01
52 //!< \~english time output from RTC Backup(have time adjustment)
53 #define POS_TIMESTS_OK  0x02   //!< \~english time adjustment completed
54
55 /* command ID */
56 #define CID_POSIF_REGISTER_LISTENER_GPS_TIME          0x0201
57 //!< \~english GPS time delivery command ID
58
59 #define POS_DID_GPS__CWORD82__SETINITIAL                    0x80000033
60 //!< \~english data ID of setting initial location and time to GPS
61
62 #define POS_DID_GPS__CWORD82__SETRMODEEX 0x80000035
63 //!< \~english data ID of setting GPS receiver mode(pull extension sentence)
64
65 #define POS_DID_GPS__CWORD82__SELSENT  0x80000036
66 //!< \~english data ID of setting command to GPS that output any sentence
67
68 /* NAVIINFO_RET_API */
69 #define  NAVIINFO_RET_NORMAL                  (0)   //!< \~english normal finish
70 #define  NAVIINFO_RET_ERROR_PARAM             (-1)  //!< \~english parameter error
71 #define  NAVIINFO_RET_ERROR_INNER             (-2)  //!< \~english internal error
72 #define  NAVIINFO_RET_ERROR_BUFFULL           (-3)  //!< \~english buffer full
73 #define  NAVIINFO_RET_ERROR_NOSUPPORT         (-4)  //!< \~english no support
74 #define  NAVIINFO_RET_ERROR_RESOURCE          (-5)  //!< \~english lack of resource
75
76 /* Positioning Level/GPS Information Positioning Status Information Definition */
77 #define  NAVIINFO_DIAG_GPS_FIX_STS_NON        (0)   //!< \~english position not fix
78 #define  NAVIINFO_DIAG_GPS_FIX_STS_2D         (1)   //!< \~english 2D position fix
79 #define  NAVIINFO_DIAG_GPS_FIX_STS_3D         (2)   //!< \~english 3D position fix
80
81 /* Reception status definition */
82 #define  NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE     (0)   //!< \~english not used
83 #define  NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING  (1)   //!< \~english searching
84 #define  NAVIINFO_DIAG_GPS_RCV_STS_TRACHING   (2)   //!< \~english tracking
85 #define  NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX  (3)   //!< \~english not used for position fix
86 #define  NAVIINFO_DIAG_GPS_RCV_STS_USEFIX     (4)   //!< \~english used for position fix
87
88 /* GPS Response Status Definition */
89 #define GPS_SENDOK                            0     //!< \~english send result OK
90 #define GPS_SENDNG                            1     //!< \~english send result NG
91
92 /* GPS reset request mode definition */
93 #define GPS_RST_COLDSTART                     0xff
94 //!< \~english GPS reset request(cold start)
95
96 #define RET_NORMAL    0      //!< \~english normally end
97
98 #define RET_RCVMSG    1      //!< \~english receive message only
99 #define RET_RCVSIG    2      //!< \~english receive signal only
100 #define RET_RCVBOTH   3      //!< \~english receive message and signal
101 #define RET_NOMSG     4      //!< \~english receive no message
102
103 #define RET_QUE       5      //!< \~english insert signal
104 #define RET_NOTQUE    6      //!< \~english do not insert signal
105 #define RET_PROCDOWN  7      //!< \~english sub process down found
106 #define RET_SLEEP     100    //!< \~english sleep time
107
108
109 #define RET_OSERROR   (-127)  //!< \~english OS system call error
110
111 #define RET_ERROR     (-1)
112 //!< \~english abnormally end(do not know reason)
113 #define RET_ERRPARAM  (-2)   //!< \~english parameter error
114 #define RET_ERRNOTRDY (-3)
115 //!< \~english port or semphore ID is not created
116 #define RET_ERRPROC   (-4)   //!< \~english error occurs in API process
117 #define RET_ERRTIMEOUT  (-5)
118 //!< \~english timeout occurs but process unfinished
119 #define RET_ERRMSGFULL  (-6)  //!< \~english message table full
120
121
122 #define RET_ERROVERFLW  (-7)
123 //!< \~english message size exceeds receive buffer size
124
125 #define RET_ERRINIT   (-8)   //!< \~english  abnormally initialization
126
127 #define RET_EV_NONE   (-20)  //!< \~english event does not exist
128 #define RET_EV_MAX    (-21)  //!< \~english event value exceeds max value
129 #define RET_EV_MIN    (-22)
130 //!< \~english event value is lower than min value
131
132 /* POS_RET_API */
133 #define POS_RET_NORMAL              0       //!< \~english normal finish
134 #define POS_RET_ERROR               (-1)    //!< \~english error occured
135 #define POS_RET_ERROR_DID           (-2)    //!< \~english data ID error
136 #define POS_RET_ERROR_INNER         (-3)    //!< \~english internal error
137 #define POS_RET_ERROR_PARAM         (-4)    //!< \~english parameter error
138 #define POS_RET_ERROR_BUFFULL       (-5)    //!< \~english buffer full error
139 #define POS_RET_ERROR_CREATE_EVENT  (-6)    //!< \~english create event error
140 #define POS_RET_ERROR_OUTOF_MEMORY  (-8)
141 //!< \~english share memory allocation size error
142
143 #define POS_RET_ERROR_SIZE          (-9)    //!< \~english memory size error
144 #define POS_RET_ERROR_TIMEOUT       (-10)   //!< \~english timeout error
145 #define POS_RET_ERROR_NOSUPPORT     (-11)   //!< \~english no support
146 #define POS_RET_ERROR_BUSY          (-12)   //!< \~english busy
147 #define POS_RET_ERROR_RESOURCE      (-13)   //!< \~english lack of resources
148 #define POS_RET_ERROR_MIN           (-13)   //!< \~english min value of error
149
150
151 #define NUM_OF_100msData (10)
152 //!< \~english number of gyro data every 100ms
153
154
155 #define CID_GPS_SERIAL1              (CID)0x0101
156 //!< \~english Defination of notification about Gps Data has been receiced
157
158 #define CID_GPS_SERIAL2  (CID)0x0102  //!< \~english notification about 1PPS interupt
159
160
161 #define CID_GPS_SERIAL3              (CID)0x0103
162 //!< \~english Defination of SIF2 Data
163
164 #define CID_GPS_SERIAL4              (CID)0x0104
165 //!< \~english Defination of _CWORD82_ command send
166
167 #define CID_GPS_SERIAL5              (CID)0x0105
168 //!< \~english Defination of _CWORD82_ command send
169
170 #define CID_GPS_SERIAL6              (CID)0x0106
171 //!< \~english Defination of u-blox request data
172
173 #define CID_GPS_SERIAL7              (CID)0x0107
174 //!< \~english Defination of u-blox ack data
175
176 #define CID_GPS_RECVDATA             (CID)(CID_GPS_BASE | CID_GPS_SERIAL1)
177 //!< \~english gps data receiced CID
178
179 #define CID_GPS_1PPSINT              (CID)(CID_GPS_BASE | CID_GPS_SERIAL2)
180 //!< \~english 1PPS interupt CID
181
182 #define CID_GPS_SIF2DATA             (CID)(CID_GPS_BASE | CID_GPS_SERIAL3)
183 //!< \~english SIF2 Data CID
184
185 /**
186  * \~english @brief _CWORD82_ command send CID
187  * \~english @brief Message structure\n
188  * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
189  * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
190  * \~english @brief Message main structure @ref TgGpsSndData\n
191  * \~english @brief Message data(Vehicle sensor information setting message) structure @ref VEHICLE_MSG_SEND_DAT\n
192  */
193 #define CID_GPS__CWORD82__REQUEST          (CID)(CID_GPS_BASE | CID_GPS_SERIAL4)
194
195 #define CID_GPS_CYCLEDATA_PROV       (CID)(CID_GPS_BASE | CID_GPS_SERIAL5)
196 //!< \~english Gps cycle data CID
197
198 #define CID_GPS_RCV_REQUESTDATA      (CID)(CID_GPS_BASE | CID_GPS_SERIAL6)
199 //!< \~english u-blox request data CID
200
201 #define CID_GPS_RCV_ACKDATA          (CID)(CID_GPS_BASE | CID_GPS_SERIAL7)
202 //!< \~english u-blox ack data CID
203
204 #define CID_GPS_SERIAL8              (CID)0x0108
205 //!< \~english Defination of Time Setting request
206
207 #define CID_GPS_SERIAL9              (CID)0x0109
208 //!< \~english Defination of Time Setting ack
209
210 #define CID_GPS_SERIAL10             (CID)0x010A
211 //!< \~english Defination of back up data read request
212
213 #define CID_GPS_SERIAL11             (CID)0x010B
214 //!< \~english Defination gps of week count request
215
216 /**
217  * \~english  @brief Defination of Time Setting request
218  * \~english  @brief Message structure\n
219  * \~english  @brief Message header structure @ref T_APIMSG_MSGBUF_HEADER\n
220  * \~english  @brief Message body structure   @ref TgGpsSndData\n
221  * \~english  @brief Positioning information structure @ref POS_MSGINFO\n
222  * */
223 #define CID_GPS_TIMESETTING          (CID)(CID_GPS_BASE | CID_GPS_SERIAL8)
224
225 /**
226  * \~english  @brief Defination of Time Setting ack
227  * \~english  @brief Message structure\n
228  * \~english  @brief Message body structure   @ref TG_GPS_RET_TIMESET_MSG\n
229  */
230 #define CID_GPS_RETTIMESETTING       (CID)(CID_GPS_BASE | CID_GPS_SERIAL9)
231
232 /**
233  * \~english @brief  Read backup data request CID
234  * \~english @brief  When this command is received, the backup data is read.\n
235  * \~english @brief  Message-Related Structures\n
236  * \~english @brief  Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER
237  */
238 #define CID_GPS_BACKUPDATA_LOAD      (CID)(CID_GPS_BASE | CID_GPS_SERIAL10)
239
240 /**
241  * \~english @brief Gps Week count request CID
242  * \~english @brief Message structure\n
243  * \~english @brief Message buffer header structure @ref T_APIMSG_MSGBUF_HEADER\n
244  * \~english @brief Message header structure @ref T_APIMSG_HEADER\n
245  * \~english @brief Message data(Gps Week correction count notify message) structure @ref GpsWeekCorCntMsg\n
246  */
247 #define CID_GPSWEEKCOR_CNT_NOTIFICATION (CID)(CID_GPS_BASE | CID_GPS_SERIAL11)
248
249
250
251 /**
252  * \~english @brief  GPS reset result delivery command ID
253  * \~english @brief  If you want to catch above envents, use NSFW like below.
254  * \~english @code  
255  * l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hThread, TN_POSITIONING_GPS, CID_POSIF_REQ_GPS_RESET, OnRecivePosResetMsg);
256  *            @endcode  
257  */
258 #define CID_POSIF_REQ_GPS_RESET                       0x0784
259
260 #define POSHAL_DID_GPS_CONNECT_ERROR   0x800000B5U
261 //!< \~english GPS receive error DID
262
263 #define GPS_READ_LEN                 316
264 //!< \~english Gps NMEA FULLBINARY max length
265
266 #define GPS_CMD_NMEA_GGA_SZ          (71U)        //!< \~english GGA
267 #define GPS_CMD_NMEA_DGGA_SZ         (75U)        //!< \~english double precison GGA
268 #define GPS_CMD_NMEA_VTG_SZ          (37U)        //!< \~english VTG
269 #define GPS_CMD_NMEA_RMC_SZ          (61U)        //!< \~english RMC
270 #define GPS_CMD_NMEA_DRMC_SZ         (67U)        //!< \~english double precison RMC
271 #define GPS_CMD_NMEA_GLL_SZ          (44U)        //!< \~english GLL
272 #define GPS_CMD_NMEA_DGLL_SZ         (50U)        //!< \~english double precison GLL
273 #define GPS_CMD_NMEA_GSA_SZ          (66U)        //!< \~english GSA
274 #define GPS_CMD_NMEA_GSV_SZ          (70U)        //!< \~english GSV
275 #define GPS_CMD_NMEA__CWORD44__GP_3_SZ   (78U)        //!< \~english _CWORD44_,GP,3
276 #define GPS_CMD_NMEA__CWORD44__GP_4_SZ   (25U)        //!< \~english _CWORD44_,GP,4
277 #define GPS_CMD_NMEA_P_CWORD82_F_GP_0_SZ   (50U)        //!< \~english _CWORD44_,GP,0
278 #define GPS_CMD_NMEA_P_CWORD82_J_GP_1_SZ   (31U)        //!< \~english _CWORD44_,GP,1
279 #define GPS_CMD_NMEA_P_CWORD82_I_GP_SZ     (71U)        //!< \~english P_CWORD82_I,GP
280 #define GPS_CMD_NMEA_P_CWORD82_E_GP_0_SZ   (50U)        //!< \~english P_CWORD82_E,GP,0
281 #define GPS_CMD_NMEA_P_CWORD82_J_GP_0_SZ   (63U)        //!< \~english P_CWORD82_J,GP,0
282 #define GPS_CMD_NMEA_P_CWORD82_E_GP_2_SZ   (21U)        //!< \~english P_CWORD82_E,GP,2
283 #define GPS_CMD_NMEA_P_CWORD82_G_GP_0_SZ   (34U)        //!< \~english P_CWORD82_G,GP,0
284 #define GPS_CMD_NMEA_P_CWORD82_J_GP_7_SZ   (37U)        //!< \~english P_CWORD82_J,GP,7
285 #define GPS_CMD_NMEA_P_CWORD82_J_GP_8_SZ   (45U)        //!< \~english P_CWORD82_J,GP,8
286 #define GPS_CMD_BINARY_SZ            (81U)        //!< \~english standard binary
287
288 #define GPS_CMD_FULLBIN_SZ   (316U)
289 //!< \~english FULL binary(GPS10 format)
290
291 #define GPS_CMD_FULLBIN_VINFO  (30U + 160U + 25U + 8U)
292 //!< \~english FULL bianry version
293
294 #define GPS_NMEA_MAX_SZ    (255U)  //!< \~english NMEA max size
295 #define GPS_DATASIZE_RTC   (13U)  //!< \~english RTC Data size
296 #define GPS_NMEARCVSTS_SZ   (1U)  //!< \~english received NMEA size
297
298 #define GPS_GPSANT_SZ       (1U)  //!< \~english gps antenna status size
299 #define GPS_SNSCNT_SZ       (1U)  //!< \~english Sensor Count value size
300
301
302 #define GPS_CMD_NMEA_PROV_SZ  (GPS_CMD_NMEA_DRMC_SZ + GPS_CMD_NMEA_GSA_SZ + \
303                                     (GPS_CMD_NMEA_GSV_SZ*3) + GPS_CMD_NMEA__CWORD44__GP_3_SZ)
304 //!< \~english NMEA size
305
306 #define GPS_NMEA_SZ         (GPS_NMEARCVSTS_SZ + GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA_PROV_SZ)
307 //!< \~english NEMA size
308
309 #define GPS_FULLBIN_SZ      (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_FULLBIN_SZ)
310 //!< \~english FULLBIN size
311
312 #define GPS__CWORD44_GP4_SZ     (GPS_GPSANT_SZ + GPS_SNSCNT_SZ + GPS_CMD_NMEA__CWORD44__GP_4_SZ)
313 //!< \~english _CWORD44_GP4 size
314
315 #define GPS_MSGDATA_SZ_MAX   (512U)  //!< \~english message maximum data size
316 #define GPS_TLGRM_LEN         253   //!< \~english message data length
317 #define GPS_MSG_VSINFO_DSIZE  1904  //!< \~english message body size
318
319 #define  POS_MSG_INFO_DSIZE       1028 //!< \~english message body maximum size
320
321 /**
322  * @enum MdevGpsDataKind
323  * \~english  enumeration of gps data kind
324  */
325 typedef enum MdevGpsDataKind {
326   MDEV_GPS_DATA_RAWDATA_NMEA   = 0,    //!< \~english raw NMEA data of GPS
327   MDEV_GPS_DATA_RAWDATA_FULLBIN,       //!< \~english raw binary data of GPS
328   MDEV_GPS_DATA_RAWDATA__CWORD44_GP4,      //!< \~english raw _CWORD44_ data of GPS
329   MDEV_GPS_DATA_NAVISPEED,             //!< \~english speed data
330   MDEV_GPS_DATA_CUSTOMDATA,            //!< \~english position information
331   MDEV_GPS_DATA_GPSTIME,               //!< \~english GPS time
332   MDEV_GPS_DATA_GPSTIME_RAW,           //!< \~english raw time of GPS
333   MDEV_GPS_DATA_INITIAL                //!< \~english initialize data
334 } MDEV_GPS_DATA_KIND;
335
336 /**
337  * @struct NAVIINFO_UTCTIME
338  * \~english UTC time information structure
339  */
340 typedef struct {
341     uint16_t         year;         //!< \~english year
342     uint8_t          month;        //!< \~english month
343     uint8_t          date;         //!< \~english day
344     uint8_t          hour;         //!< \~english hour
345     uint8_t          minute;       //!< \~english minute
346     uint8_t          second;       //!< \~english second
347     uint8_t          reserved;     //!< \~english reserve
348 } NAVIINFO_UTCTIME;
349
350 /**
351  * @struct SENSORLOCATION_LONLATINFO_DAT
352  * \~english longitude and latitude information data
353  *        - Get method(getMethod)
354  *        - SENSOR_GET_METHOD_GPS - longitude and latitude from GPS
355  *        - SENSOR_GET_METHOD_NAVI - longitude and latitude from Navigation
356  *        - Synchrony count(SyncCnt)
357  *        - Count for position data synchronous \n
358  *          When delivery altitude and heading data, position data can be synchronized by SyncCnt.\n
359  *          But the data of different method can not be synchronized by SyncCnt.\n
360  *          Example 1: [LonLat from GPS] and [Heading from GPS] can be synchronized by SyncCnt.\n
361  *          Example 2: [LonLat from GPS] and [LonLat from Navi] can not be synchronized by SyncCnt.\n
362  *          Caution: The sensor count in sensor data delivery is another data.
363  *        - Enable or not(isEnable) \n
364  *          To describe this delivery message is whether can be used or not
365  *        - 0 - not avaliable
366  *        - not 0 - avaliable
367  *        - when GPS data is specified,longitude and latitude is invalid at following condition:\n
368  *          so [not avaliable] provieded
369  *        - After system start, GPS unit has not received current location data and GPS unit \n
370  *          status is not positioning fixed.
371  *        - If it is not initialized status, certainly provide [avaliable] when Navigation data specified
372  *        - If the status is [not avaliable], data following can not be guaranteed.
373  *        - Position status(posSts)
374  *        - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)
375  *        - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
376  *        - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
377  *        - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
378  *          maskbit:POS_LOC_INFO_USE_MAPMATCHING)
379  *        - Position accuracy(posAcc)
380  *        - Detected accruray of current position:1LSB=1m \n
381  *        - It is valid only when "Get method is Navigation" and "evironment is _CWORD80_".(otherwise it will be set as 0)\n
382  *          0000H:0m \n
383  *          0001H:1m \n
384  *          :\n
385  *          FFFDH:65533m \n
386  *          FFFEH:65534m and larger than 65534m \n
387  *          FFFFH:no data
388  *        - Longitude : (WGS-84)(10^ -7degree as 1) \n
389  *          East longitude is positive value and west longitude is negative value.
390  *        - Latitude : (WGS-84)(10^ -7degree as 1) \n
391  *          North latitude positive value and south latitude is negative value.
392  */
393 typedef struct {
394   uint8_t   getMethod;   //!< \~english get method
395   uint8_t   SyncCnt;     //!< \~english Synchrony count
396   uint8_t   isEnable;    //!< \~english enable or not
397   uint8_t   posSts;      //!< \~english position status
398   uint16_t  posAcc;      //!< \~english position accuracy
399   int32_t   Longitude;   //!< \~english longitude(10^-7degree)
400   //!< \~english max: +180.0000000degree[east longitude]
401   //!< \~english min: -170.9999999degree[west longitude]
402   int32_t   Latitude;    //!< \~english latitude(10^-7degree)
403   //!< \~english max: +90.0000000degree[north Latitude]
404   //!< \~english min: -90.0000000degree[south Latitude]
405 } SENSORLOCATION_LONLATINFO_DAT;
406
407
408 /**
409  * @struct SENSORLOCATION_ALTITUDEINFO_DAT
410  * \~english altitude information data
411  *        - Get method(getMethod)
412  *        - SENSOR_GET_METHOD_GPS - altitude from GPS
413  *        - SENSOR_GET_METHOD_NAVI - altitude from Navigation
414  *        - Synchrony count(SyncCnt)
415  *        - Count for position data synchronous \n
416  *          When delivery altitude and heading data, position data can be synchronized by SyncCnt. \n
417  *          But the data of different method can not be synchronized by SyncCnt.\n
418  *          example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by SyncCnt.\n
419  *          example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be
420  *          synchronized by SyncCnt. \n
421  *          Caution: The sensor count in sensor data delivery is another data.
422  *        - Enable or not(isEnable) \n
423  *          To describe this delivery message is whether can be used or not.
424  *        - 0 - not avaliable
425  *        - not 0 - avaliable
426  *        - when GPS data specified, Altitude is invalid at following condition(so [not avaliable] provieded):
427  *        - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
428  *          is not positioning fix
429  *        - If it is not initialization status, certainly provide [avaliable] when Navi data specified
430  *        - If the status is [not avaliable], data following can not be guaranteed.
431  *        - Altitude
432  *        - altitude data(unit 0.01m)
433  */
434 typedef struct {
435   uint8_t   getMethod;    //!< \~english get method
436   uint8_t   SyncCnt;      //!< \~english Synchrony count
437   uint8_t   isEnable;     //!< \~english enable or not
438   uint8_t   Reserved[3];  //!< \~english reserve
439   int32_t   Altitude;     //!< \~english altitude(0.01m)
440 } SENSORLOCATION_ALTITUDEINFO_DAT;
441
442
443 /**
444  * @struct SENSORMOTION_HEADINGINFO_DAT
445  * \~english heading information data
446  *        - Get method(getMethod)
447  *        - SENSOR_GET_METHOD_GPS - Heading from GPS
448  *        - SENSOR_GET_METHOD_NAVI - Heading from Navi
449  *        - Synchrony count(SyncCnt)
450  *        - Count for position data synchronous \n
451  *          When delivery altitude and heading data, position data can be synchronized by this count. \n
452  *          But the data of different method can not be synchronized by this count.\n
453  *          example 1: [longitude and latitude from GPS] and [heading from GPS] can be synchronized by the count. \n
454  *          example 2: [longitude and latitude from GPS] and [longitude and latitude from Navi] can not be \n
455  *          synchronized by the count. \n
456  *          Caution: The sensor count in sensor data delivery is another data.
457  *        - Enable or not(isEnable) \n
458  *          To describe this data is whether enable or not 
459  *        - 0 - not avaliable
460  *        - not 0 - avaliable
461  *        - Heading is invalid at following condition when GPS data specified, so [not avaliable] provieded \n
462  *        - Immediately after system start, GPS unit has not received current location data and GPS unit status \n
463  *          is not positioning fix
464  *        - If it is not initialization status, certainly provide [avaliable] when Navi data specified
465  *        - If the status is [not avaliable], data following can not be guaranteed.
466  *        - Position status(posSts)
467  *        - It is valid only when "Get method is Navi" and "evironment is _CWORD80_".(otherwise it will be set as 0)
468  *        - Bit0 : GPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_GSP)
469  *        - Bit1 : DGPS data used result(1:used, 0:not used, definition of maskbit:POS_LOC_INFO_USE_DGPS)
470  *        - Bit3 : MapMatching data used result(1:used, 0:not used, definition of \n
471  *          maskbit:POS_LOC_INFO_USE_MAPMATCHING)
472  *        - Heading
473  *        - Heading data(0.01degree as 1, based on north and clockwise count)\n
474  *          But in environment _CWORD95_/_CWORD101___CWORD84_,the heading from Navi is a approximate that separate 360 degree \n
475  *          into 16 part. \n
476  *          example: 0, 2300, 4500, ..., 31500, 33800
477  */
478 typedef struct {
479   uint8_t   getMethod;    //!< \~english get method
480   uint8_t   SyncCnt;      //!< \~english Synchrony count
481   uint8_t   isEnable;     //!< \~english enable or not
482   uint8_t   posSts;       //!< \~english position status
483   uint8_t   Reserved1[2];  //!< \~english reserve
484   uint16_t  Heading;     //!< \~english heading(0.01degree)
485   //!< \~english max: 359.99 degree
486   //!< \~english min: 0.00 degree
487   uint8_t   Reserved2[2];    //!< \~english reserve
488 } SENSORMOTION_HEADINGINFO_DAT;
489
490 /**
491  * @struct NAVIINFO_DIAG_GPS_FIX_CNT
492  * \~english position fix count data structure
493  */
494 typedef struct {
495   uint32_t    ulCnt3d;    //!< \~english position fix count:3D
496   uint32_t    ulCnt2d;    //!< \~english position fix count:2D
497   uint32_t    ulCntElse;  //!< \~english position fix count:not fix
498 } NAVIINFO_DIAG_GPS_FIX_CNT;
499
500 /**
501  * @struct NAVIINFO_DIAG_GPS_FIX_XYZ
502  * \~english longitude and latitude data structure
503  */
504 typedef struct {
505   int32_t     lLat;       //!< \~english GPS latitude
506   int32_t     lLon;       //!< \~english GPS longitude
507 } NAVIINFO_DIAG_GPS_FIX_XYZ;
508
509 /**
510  * @struct NAVIINFO_DIAG_GPS_FIX
511  * \~english position fix information structure
512  */
513 typedef struct {
514   uint8_t                   ucFixSts;     //!< \~english fix status
515   uint8_t                   ucReserve[3];  //!< \~english reserve
516   NAVIINFO_DIAG_GPS_FIX_CNT stCnt;        //!< \~english fix count data
517   NAVIINFO_DIAG_GPS_FIX_XYZ stWgs84;      //!< \~english longitude and latitude data
518 } NAVIINFO_DIAG_GPS_FIX;
519
520 /**
521  * @struct NAVIINFO_DIAG_GPS_PRN
522  * \~english satellite information structure
523  *        - reception status(ucRcvSts)
524  *        - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSE : not used
525  *        - NAVIINFO_DIAG_GPS_RCV_STS_SEARCHING : searching
526  *        - NAVIINFO_DIAG_GPS_RCV_STS_TRACHING : tracking
527  *        - NAVIINFO_DIAG_GPS_RCV_STS_NOTUSEFIX : not used for position fix
528  *        - NAVIINFO_DIAG_GPS_RCV_STS_USEFIX : used for position fix
529  */
530 typedef struct {
531   uint8_t     ucRcvSts;     //!< \~english reception status
532   uint8_t     ucPrn;        //!< \~english satellite No.
533   uint8_t     ucelv;        //!< \~english satellite dramatic angle
534   uint8_t     ucLv;         //!< \~english satellite signal level
535   uint16_t    usAzm;        //!< \~english satellite azimuth
536   uint8_t     ucReserve[2];  //!< \~english reserve
537 } NAVIINFO_DIAG_GPS_PRN;
538
539 /**
540  * @struct NAVIINFO_DIAG_GPS_SAT
541  * \~english all satellite information structure
542  */
543 typedef struct {
544   NAVIINFO_DIAG_GPS_PRN   stPrn[12];    //!< \~english all satellite information
545 } NAVIINFO_DIAG_GPS_SAT;
546
547 /**
548  * @struct NAVIINFO_DIAG_GPS
549  * \~english position fixed and satellite information structure
550  */
551 typedef struct {
552   NAVIINFO_DIAG_GPS_FIX   stFix;    //!< \~english position fixed information
553   NAVIINFO_DIAG_GPS_SAT   stSat;    //!< \~english all satellite information
554 } NAVIINFO_DIAG_GPS;
555
556 /**
557  * @struct NAVIINFO_NAVI_GPS
558  * \~english other GPS related information structure
559  *        - altitude(altitude) \n
560  *          As the altitude is used as unit [0.01m] in internal, \n
561  *          the altitude data range is (-21,474,839~21,474,839).
562  *        - UTC(utc)
563  *        - The time set after rollover.
564  *        - date and time status(tdsts)
565  *        - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
566  *        - 1= time output from RTC Backup(have time adjustment result)
567  *        - 2= time adjustment completed
568  */
569 typedef struct {
570   int32_t           altitude;     //!< \~english altitude
571   uint16_t          speed;        //!< \~english speed
572   uint16_t          heading;      //!< \~english heading
573   NAVIINFO_UTCTIME  utc;          //!< \~english UTC time
574   uint8_t           tdsts;        //!< \~english date and time status
575   uint8_t           reserve[3];   //!< \~english reserve
576 } NAVIINFO_NAVI_GPS;
577
578 /**
579  * @struct NAVIINFO_ALL
580  * \~english Navi data structure
581  */
582 typedef struct {
583   uint8_t           ucSensorCnt;  //!< \~english sensor count
584   uint8_t           reserve[3];   //!< \~english reserve
585   NAVIINFO_DIAG_GPS stDiagGps;    //!< \~english position fix related information
586   NAVIINFO_NAVI_GPS stNaviGps;    //!< \~english other GPS related information
587 } NAVIINFO_ALL;
588
589 /**
590  * @struct POS_MSGINFO
591  * \~english message delivery positioning sensor information
592  */
593 typedef struct {
594     DID              did;          //!< \~english data ID
595     PNO              pno;          //!< \~english delivery destination PNO
596     uint16_t         size;         //!< \~english data body size
597     uint8_t          rcv_flag;      //!< \~english received flag
598     uint8_t          reserve;      //!< \~english reserve
599     uint8_t          data[POS_MSG_INFO_DSIZE];  //!< \~english data body
600 } POS_MSGINFO;
601
602 /**
603  * @struct SENSOR_GPSTIME
604  * \~english GPS time information
605  *        - date amd time status(tdsts)
606  *        - 0= time has not been adjusted after GPS receiver reset(time input or master reset or CSF start)
607  *        - 1= time output from RTC Backup(have time adjustment result)
608  *        - 2= time adjustment completed
609  */
610 typedef struct {
611   NAVIINFO_UTCTIME  utc;          //!< \~english UTC time
612   uint8_t           tdsts;        //!< \~english time status
613   uint8_t           reserve[3];   //!< \~english reserve
614 } SENSOR_GPSTIME;
615
616 #define SENSOR_MSG_GPSTIME SENSOR_GPSTIME  //!< \~english GPS time information
617 #define SENSOR_GPSTIME_RAW SENSOR_GPSTIME  //!< \~english GPS time information
618
619 /**
620  * @struct MdevGpsCustomData
621  * \~english  Struct of Gps custom data
622  */
623 typedef struct MdevGpsCustomData {
624   MDEV_GPS_DATA_KIND                  e_kind;      //!< \~english kind
625   SENSORLOCATION_LONLATINFO_DAT       st_lonlat;   //!< \~english longtitude,latitude
626   SENSORLOCATION_ALTITUDEINFO_DAT     st_altitude;  //!< \~english  altitude
627   SENSORMOTION_HEADINGINFO_DAT        st_heading;  //!< \~english  headings
628   SENSOR_MSG_GPSTIME                  st_gps_time;  //!< \~english  Gps Time
629   NAVIINFO_DIAG_GPS                   st_diag_gps;  //!< \~english  Gps data from diag
630 } MDEV_GPS_CUSTOMDATA;
631
632 /**
633  * @struct MdevGpsCustomDataMgs
634  * \~english  Struct of Gps custom data message
635  */
636 typedef struct MdevGpsCustomDataMgs {
637   T_APIMSG_MSGBUF_HEADER      h_dr;                //!< \~english header
638   MDEV_GPS_CUSTOMDATA         st_data;             //!< \~english  Gps Custom Data
639 } MDEV_GPS_CUSTOMDATA_MGS;
640
641 /**
642  * @struct MdevGpsRtc
643  * \~english  Struct of Gps RTC data
644  */
645 typedef struct MdevGpsRtc {
646   u_int32     ul_retsts;                         //!< \~english return status
647   u_int8      uc_datalen;                        //!< \~english data length
648   u_int8      uc_ctrlcode;                       //!< \~english control code
649   u_int8      uc_bcd_year;                        //!< \~english year
650   u_int8      uc_bcd_month;                       //!< \~english month
651   u_int8      uc_bcd_day;                         //!< \~english day
652   u_int8      uc_bcd_hour;                        //!< \~english hour
653   u_int8      uc_bcd_min;                         //!< \~english minute
654   u_int8      uc_bcd_sec;                         //!< \~english second
655   u_int8      uc_status;                         //!< \~english status
656   u_int8      u_reserve[3];                       //!< \~english reserve
657 } MDEV_GPS_RTC;
658
659 /**
660  * @struct MdevGpsGpsTime
661  * \~english  Struct of Gps Time
662  */
663 typedef struct MdevGpsGpsTime {
664   MDEV_GPS_DATA_KIND          e_kind;              //!< \~english kind
665   MDEV_GPS_RTC                st_rtc_data;          //!< \~english Gps Time
666 } MDEV_GPS_GPSTIME;
667
668 /**
669  * @struct MdevGpsGpsTimeMgs
670  * \~english  Struct of Gps Time message
671  */
672 typedef struct MdevGpsGpsTimeMgs {
673   T_APIMSG_MSGBUF_HEADER      h_dr;                //!< \~english header
674   MDEV_GPS_GPSTIME            st_data;             //!< \~english Gps Time Data
675 } MDEV_GPS_GPSTIME_MGS;
676
677 /**
678  * @struct DevGpsUtcTime
679  * \~english  Struct of Gps UTC time
680  */
681 typedef struct DevGpsUtcTime {
682   u_int16                   us_year;               //!< \~english Year
683   u_int8                    uc_month;              //!< \~english month
684   u_int8                    uc_date;               //!< \~english day
685   u_int8                    uc_hour;               //!< \~english hour
686   u_int8                    uc_minute;             //!< \~english minute
687   u_int8                    uc_second;             //!< \~english second
688   u_int8                    u_reserved;           //!< \~english reserve
689 } DEV_GPS_UTCTIME;
690
691 /**
692  * @enum MdevGpsFixSts
693  * \~english  enumeration of gps fix status
694  */
695 typedef enum MdevGpsFixSts {
696   MDEV_GPS_NOTFIX  = 0,                           //!< \~english not fix
697   MDEV_GPS_FIX                                    //!< \~english fix
698 } MDEV_GPS_FIX_STS;
699
700 /**
701  * @struct MdevGpsNmea
702  * \~english  Struct of gps NMEA Data
703  */
704 typedef struct MdevGpsNmea {
705   u_int8      uc_nmea_data[GPS_MSG_VSINFO_DSIZE];   //!< \~english NMEA Data
706 } MDEV_GPS_NMEA;
707
708 /**
709  * @struct MdevGpsFullbin
710  * \~english  Struct of Gps full bin data
711  */
712 typedef struct MdevGpsFullbin {
713   u_int8      uc_fullbin_data[GPS_FULLBIN_SZ];      //!< \~english gps full bin data
714   u_int8      u_reserve[3];                         //!< \~english reserve
715 } MDEV_GPS_FULLBIN;
716
717 /**
718  * @struct MdevGps_CWORD44_gp4
719  * \~english  Struct of Gps _CWORD44_GP4 data
720  */
721 typedef struct MdevGps_CWORD44_gp4 {
722   u_int8      uc__CWORD44_gp4_data[GPS__CWORD44_GP4_SZ];    //!< \~english gps _CWORD44_GP4 data
723   u_int8      u_reserve;                            //!< \~english reserve
724 } MDEV_GPS__CWORD44_GP4;
725
726 /**
727  * @struct MdevGpsCycledata
728  * \~english  Struct of Gps cycle data
729  */
730 typedef struct MdevGpsCycledata {
731   MDEV_GPS_DATA_KIND  e_kind;          //!< \~english kind
732   u_int8      uc_data[GPS_MSGDATA_SZ_MAX - sizeof(MDEV_GPS_DATA_KIND)];  //!< \~english data
733 } MDEV_GPS_CYCLEDATA;
734
735 /**
736  * @struct MdevGpsCycledataMsg
737  * \~english  Struct of Gps cycle data message
738  */
739 typedef struct MdevGpsCycledataMsg {
740   T_APIMSG_MSGBUF_HEADER      h_dr;              //!< \~english header
741   MDEV_GPS_CYCLEDATA          st_data;           //!< \~english data
742 } MDEV_GPS_CYCLEDATA_MSG;
743
744 /**
745  * @struct MdevGpsRawdataNmea
746  * \~english  Struct of Gps NMEA Raw Data
747  */
748 typedef struct MdevGpsRawdataNmea {
749   MDEV_GPS_DATA_KIND          e_kind;            //!< \~english kind
750   MDEV_GPS_NMEA               st_nmea_data;       //!< \~english NMEA Data
751 } MDEV_GPS_RAWDATA_NMEA;
752
753 /**
754  * @struct MdevGpsRawdataNmeaMsg
755  * \~english  Struct of Gps NMEA Raw Data message
756  */
757 typedef struct MdevGpsRawdataNmeaMsg {
758   T_APIMSG_MSGBUF_HEADER      h_dr;              //!< \~english header(see vs-positioning-base-library)
759   MDEV_GPS_RAWDATA_NMEA       st_data;           //!< \~english data
760 } MDEV_GPS_RAWDATA_NMEA_MSG;
761
762 /**
763  * @struct MdevGpsRawdataFullbin
764  * \~english  Struct of Gps Full Bin Raw Data
765  */
766 typedef struct MdevGpsRawdataFullbin {
767   MDEV_GPS_DATA_KIND          e_kind;            //!< \~english kind
768   MDEV_GPS_FULLBIN            st_fullbin_data;    //!< \~english Full Binary Data
769 } MDEV_GPS_RAWDATA_FULLBIN;
770
771 /**
772  * @struct MdevGpsRawdataFullbinMsg
773  * \~english  Struct of Gps Full Bin Raw Data message
774  */
775 typedef struct MdevGpsRawdataFullbinMsg {
776   T_APIMSG_MSGBUF_HEADER      h_dr;      //!< \~english header
777   MDEV_GPS_RAWDATA_FULLBIN    st_data;   //!< \~english Gps Full Bin Data
778 } MDEV_GPS_RAWDATA_FULLBIN_MSG;
779
780 /**
781  * @struct MdevGpsRawdata_CWORD44_gp4
782  * \~english  Struct of Gps _CWORD44_GP4 Raw Data
783  */
784 typedef struct MdevGpsRawdata_CWORD44_gp4 {
785   MDEV_GPS_DATA_KIND          e_kind;            //!< \~english kind
786   MDEV_GPS__CWORD44_GP4           st__CWORD44_gp4;       //!< \~english Gps _CWORD44_GP4 Data
787 } MDEV_GPS_RAWDATA__CWORD44_GP4;
788
789 /**
790  * @struct MdevGpsRawdata_CWORD44_gp4Msg
791  * \~english  Struct of Gps _CWORD44_GP4 Raw Data message
792  */
793 typedef struct MdevGpsRawdata_CWORD44_gp4Msg {
794   T_APIMSG_MSGBUF_HEADER      h_dr;     //!< \~english header
795   MDEV_GPS_RAWDATA__CWORD44_GP4   st_data;  //!< \~english Gps _CWORD44_GP4 Raw Data
796 } MDEV_GPS_RAWDATA__CWORD44_GP4_MSG;
797
798 /**
799  * @struct SENSORMOTION_SPEEDINFO_DAT
800  * \~english speed information data
801  *        - Get method(getMethod)
802  *        - SENSOR_GET_METHOD_POS - The speed calculated in positioning based on speed pulse will be deliveried.
803  *        - SENSOR_GET_METHOD_NAVI - speed from Navi
804  *        - Synchrony count(SyncCnt)
805  *        - 0 (not change).
806  *        - Enable or not(isEnable) \n
807  *          To describe this data is whether enable or not 
808  *        - 0 - not avaliable
809  *        - not 0 - avaliable
810  *        - Speed is invalid at following condition when speed pulse specified, so [not avaliable] provieded
811  *        - Immediately after system start, the sensor data have not been received from SYS micon
812  *        - If it is not initialization status, certainly provide [avaliable] when Navi data specified
813  *        - If the status is [not avaliable], data following can not be guaranteed.
814  *        - Speed
815  *        - speed data(unit 0.01m/sec)
816  */
817 typedef struct {
818   uint8_t   getMethod;    //!< \~english get method
819   uint8_t   SyncCnt;      //!< \~english Synchrony count
820   uint8_t   isEnable;     //!< \~english enable or not
821   uint8_t   Reserved1[3];  //!< \~english reserve
822   uint16_t  Speed;        //!< \~english speed(0.01m/sec)
823   uint8_t   Reserved2[2];  //!< \~english reserve
824 } SENSORMOTION_SPEEDINFO_DAT;
825
826 /**
827  * @struct MdevGpsNavispeed
828  * \~english  Struct of Gps speed data
829  */
830 typedef struct MdevGpsNavispeed {
831   MDEV_GPS_DATA_KIND          e_kind;            //!< \~english kind
832   u_int16                     us_speed_kmph;     //!< \~english Speed(km/h)
833   u_int8                      u_reserve[2];       //!< \~english reserve
834   SENSORMOTION_SPEEDINFO_DAT  st_speed;          //!< \~english speed data
835 } MDEV_GPS_NAVISPEED;
836
837 /**
838  * @struct MdevGpsNavispeedMsg
839  * \~english  Struct of Gps speed data message
840  */
841 typedef struct MdevGpsNavispeedMsg {
842   T_APIMSG_MSGBUF_HEADER      h_dr;              //!< \~english header
843   MDEV_GPS_NAVISPEED          st_data;           //!< \~english Gps Speed Data
844 } MDEV_GPS_NAVISPEED_MSG;
845
846 /**
847  * @struct TgGpsSndData
848  * \~english  Struct of _CWORD82_ Gps send data
849  */
850 typedef struct TgGpsSndData {
851   uint8_t     reserve[4];                         //!< \~english reserve
852   u_int16     us_size;                            //!< \~english send data length
853   u_int8      ub_data[502];                       //!< \~english send data
854 } TG_GPS_SND_DATA;
855
856 /**
857  * @struct TgGpsRetPram
858  * \~english  Gps Response data
859  */
860 typedef struct TgGpsRetPram {
861   unsigned int  ret_status;               //!< \~english response flag
862   unsigned char data_len;                 //!< \~english data size
863   unsigned char ctrl_code;                //!< \~english control code
864   unsigned char gps_data[GPS_TLGRM_LEN];  //!< \~english data contents
865 } TG_GPS_RET_PRAM;
866
867 /**
868  * @struct SensorWknRollOverHal
869  * \~english  Struct of GPS week number
870  */
871 typedef struct SensorWknRollOverHal {
872   uint16_t  us_wkn;     //!< \~english  GPS week number
873 } SENSOR_WKN_ROLLOVER_HAL;
874
875 /**
876  * @struct POS_DATETIME
877  * \~english GPS time information structure
878  */
879 typedef struct {
880     uint16_t         year;         //!< \~english year
881     uint8_t          month;        //!< \~english month
882     uint8_t          date;         //!< \~english day
883     uint8_t          hour;         //!< \~english hour
884     uint8_t          minute;       //!< \~english minute
885     uint8_t          second;       //!< \~english second
886     uint8_t          reserved;     //!< \~english reserve
887 } POS_DATETIME;
888
889 /**
890  * @struct TG_GPS_RET_RESET
891  * \~english GPS reset status
892  */
893 typedef struct {
894   unsigned long     ret_rst_status;   //!< \~english response GPS reset status
895 } TG_GPS_RET_RESET;
896
897 /**
898  * @struct TG_GPS_RET_RESET_MSG
899  * \~english GPS reset information message
900  */
901 typedef struct {
902   TG_GPS_RET_RESET    data;   //!< \~english GPS reset status data
903 } TG_GPS_RET_RESET_MSG;
904
905 /**
906  * @struct VEHICLE_MSG_SEND_DAT
907  * \~english Vehicle information setting message structure
908  */
909 typedef struct {
910     DID                       did;          //!< \~english Data ID
911     u_int16                   size;         //!< \~english Data size
912     u_int8                    data[502];    //!< \~english Data
913 } VEHICLE_MSG_SEND_DAT;
914
915 /**
916  * @struct GpsWeekCorCntMsg
917  * \~english Gps Week correction count notify message structure
918  */
919 typedef struct GpsWeekCorCntMsg {
920   T_APIMSG_MSGBUF_HEADER  stHead;          //!< \~english Message header
921   u_int8                  gpsweekcorcnt;    //!< \~english Gps Week correction count
922   int8                    dummy[3];         //!< \~english Alignment adjustment
923 } CLOCKGPS_GPSWEEKCOR_CNT_MSG;
924
925 /** @}*/  // end of positioning_hal
926 /** @}*/  // end of positioning
927
928 /*---------------------------------------------------------------------------*/
929 #endif  // HAL_API_GPS_HAL_H_
930
931 /*---------------------------------------------------------------------------*/
932 /*EOF*/