Re-organized sub-directory by category
[staging/basesystem.git] / service / vehicle / positioning / client / include / POS_sensor_private.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_POS_SENSOR_PRIVATE_H_
18 #define POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_
19 /******************************************************************************
20  * file name    :POS_sensor_private.h
21  * system name    :Positioning
22  * sub system name  :Positioning internal interface library
23  ******************************************************************************/
24
25 #include <vehicle_service/POS_sensor_API.h>
26 #include <vehicle_service/pos_message_header.h>
27 #include <native_service/frameworkunified_types.h>
28 /************************************************************************
29 *                                  definition                           *
30 ************************************************************************/
31 /*----------------------------------------------------------------------*
32  *  for message                              *
33  *----------------------------------------------------------------------*/
34 /* command ID */
35 #define CID_SENSOR_PKG_INFO           0x0700                        /* vehicle sensor package notification ID */
36
37 /*----------------------------------------------------------------------*
38  *                     definition for GPS response                      *
39  *----------------------------------------------------------------------*/
40 #define GPS_BUFFERFUL                 2                             /* transmit buffer full(rejection)    */
41 #define GPS_INITIAL                   3                             /* initialization state(rejection)    */
42 #define GPS_CONNECTNG                 4                             /* connection error(rejection)      */
43
44 /*----------------------------------------------------------------------*
45  *                       definition clock status                        *
46  *----------------------------------------------------------------------*/
47 #define CLOCK_VALID                   (1U)
48 #define CLOCK_INVALID                 (0U)
49
50 /*----------------------------------------------------------------------*
51  *    Message Related Extensions                                                     *
52  *----------------------------------------------------------------------*/
53 #define CID_SENSORIF_SET_GPSTIME      0x0701                        /* GPS time information setting CID */
54
55 /*----------------------------------------------------------------------*
56  * GPS version-related definitions                                                 *
57  *----------------------------------------------------------------------*/
58 #define GPS__CWORD82__VERSION_LEN           (7U)                          /* _CWORD82_ version data length */
59
60 /************************************************************************
61 *                               struct declaration                      *
62 ************************************************************************/
63 /************************************************************************
64 * TAG       : SENSOR_MSG_DELIVERY_ENTRY
65 * ABSTRACT  : vehicle sensor delivery message (to vehicle sensor)
66 ************************************************************************/
67 typedef struct {
68     PNO                               pno;                          /* destination process number */
69     u_int8                            pkg_num;                      /* number of package data (1 - 16) */
70     u_int8                            delivery_timing;              /* delivery timing          */
71     u_int8                            ctrl_flg;                     /* delivery control flag      */
72     u_int8                            reserve[3];
73     EventID                           event_id;                     /* event ID              */
74     DID                               did[SENSOR_PKG_DELIVERY_MAX];    /* data ID array          */
75 } SENSOR_MSG_DELIVERY_ENTRY_DAT;
76
77 typedef struct {
78     T_APIMSG_MSGBUF_HEADER            hdr;                          /* message header  */
79     SENSOR_MSG_DELIVERY_ENTRY_DAT     data;                         /* message body    */
80 } SENSOR_MSG_DELIVERY_ENTRY;
81
82 /************************************************************************
83 * TAG       : SENSOR_MSG_GET_SENSOR_DATA
84 * ABSTRACT  : vehicle sensor getter message (to vehicle sensor)
85 ************************************************************************/
86 typedef struct {
87     PNO                               pno;                          /* destination process number    */
88     u_int8                            pkg_num;                      /* number of package data (1 - 16)  */
89     u_int8                            reserve;
90     u_int16                           offset;                       /* share memory offset        */
91     u_int16                           size;                         /* share memory allocation size    */
92     EventID                           event_id;                     /* event ID              */
93     DID                               did[SENSOR_PKG_DELIVERY_MAX];    /* data ID about vehicle sensor    */
94 } SENSOR_MSG_GET_SENSOR_DATA_DAT;
95
96 typedef struct {
97     T_APIMSG_MSGBUF_HEADER            hdr;                          /* message header  */
98     SENSOR_MSG_GET_SENSOR_DATA_DAT    data;                         /* message body    */
99 } SENSOR_MSG_GET_SENSOR_DATA;
100
101 /************************************************************************
102 * TAG       : SENSOR_INTERNAL_MSG_BUF
103 * ABSTRACT  : message buffer
104 ************************************************************************/
105 typedef struct {
106     T_APIMSG_MSGBUF_HEADER            hdr;                          /* message header  */
107     u_int8                            data[SENSOR_MSGBUF_DSIZE];    /* message body    */
108 } SENSOR_INTERNAL_MSG_BUF;
109
110 /********************************************************************************
111  * TAG      :TG_GPSTIME
112  * ABSTRACT :GPS Absolute Time Structure
113  * NOTE     :
114  ********************************************************************************/
115 typedef struct {
116     u_int16                           year;                         /* Year information(4-digit year)    */
117     u_int8                            month;                        /* Month information          */
118     u_int8                            day;                          /* Day information          */
119     u_int8                            hour;                         /* Hour information          */
120     u_int8                            minute;                       /* Minute information          */
121     u_int8                            second;                       /* Second information          */
122     u_int8                            reserve;                      /* reserve          */
123 } TG_GPSTIME;
124
125 /********************************************************************************
126  * TAG      :TG_GPS_RTCBKUP_DATA
127  * ABSTRACT :RTC backup-related data structures
128  * NOTE     :RTC-backup-related data stored in the SRAM alternate DRAM
129  ********************************************************************************/
130 typedef struct {
131     u_int8                            time_status;                  /* Time Status */
132     u_int8                            reserve1[3];                  /* Reserve 1 */
133     TG_GPSTIME                        gps_time;                     /* GPS Absolute Time */
134 } TG_GPS_RTCBKUP_DATA;                      /*                                  */
135
136 /************************************************************************
137  * TAG      : GPS_INTERRUPT
138  * ABSTRACT : GPS interrupt status
139  * NOTE     :
140 ************************************************************************/
141 typedef struct {
142     u_int8                            _CWORD102__interrupt;                 /* from GPS to _CWORD102_   interrupt status  */
143     u_int8                            _CWORD56__interrupt;               /* from GPS to _CWORD56_ interrupt status  */
144 } GPS_INTERRUPT;
145
146 /********************************************************************************
147  * TAG      :LOCALTIME
148  * ABSTRACT :LocalTime data structure
149  * NOTE     :
150  ********************************************************************************/
151 typedef struct {
152     u_int8                            status;                       /* status  : valid or invalid */
153     u_int8                            reserve[3];    /* reserve                  */
154     u_int16                           year;      /* year    : 2000..2099  (FFFFh:invalid)  */
155     u_int8                            month;      /* month  : 1..12      (FFh:invalid)  */
156     u_int8                            day;      /* date    : 1..31      (FFh:invalid)  */
157     u_int8                            hour;      /* hour    : 0..23      (FFh:invalid)  */
158     u_int8                            min;      /* minute  : 0..59      (FFh:invalid)  */
159     u_int8                            sec;      /* second  : 0..59      (FFh:invalid)  */
160     u_int8                            reserve2;    /* reserve                  */
161 } LOCALTIME;
162
163 #endif  // POSITIONING_CLIENT_INCLUDE_POS_SENSOR_PRIVATE_H_