Init basesystem source codes.
[staging/basesystem.git] / stub / communication_usb / client / include / stub / commusb_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    commusb_api.h
19  * @~english
20  * @brief   CommUSB I/F
21  */
22 #ifndef COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
23 #define COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_
24
25 #include <sys/types.h>
26 #include <native_service/frameworkunified_types.h>
27
28 /** @addtogroup BaseSystem
29  *  @{
30  */
31 /** @addtogroup peripheral_service
32  *  @ingroup BaseSystem
33  *  @{
34  */
35 /** @addtogroup communication_usb
36  *  @ingroup peripheral_service
37  *  @{
38  */
39 #ifdef __cplusplus
40 extern "C" {
41 #endif  // __cplusplus
42
43 /**
44  * @~english Service Name of PS_CommUSB Thread
45  */
46 #define LAN_SERVICE_COMMUSB_MAIN "PS_CommUSB"
47
48 /**
49  * @~english The maximum number of delivery entry
50  */
51 #define COMMUSB_DELIVERY_DATA_MAX 0xFF
52
53 /**
54  * @~english Authentication info
55  */
56 typedef enum {
57   /**
58    *@~english Authentication is NG
59    */
60   COMMUSB_AUTH_NG = 0x00,
61
62   /**
63    *@~english Authentication is OK
64    */
65   COMMUSB_AUTH_OK
66 } COMMUSB_AUTH_INFO;
67
68 /**
69  * @~english Transmit class
70  */
71 typedef enum {
72   /**
73    *@~english Individual transmission
74    */
75   COMMUSB_TRANS_INDIVIDUAL = 0x00,
76
77   /**
78    *@~english Group broadcast transmission
79    */
80   COMMUSB_TRANS_GROUP,
81
82   /**
83    *@~english Simultaneous broadcast transmission
84    */
85   COMMUSB_TRANS_ALL
86 } COMMUSB_TRANS_CLASS;
87
88 /**
89  * @~english Clear type of DeliveryEntry table (for debug)
90  */
91 typedef enum {
92   /**
93    * @~english Clear all
94    */
95   USB_CLEAR_TYPE_ALL = 0,
96
97   /**
98     * @~english Clear only table without wild card
99     */
100   USB_CLEAR_TYPE_WITHOUT_WILDCARD,
101
102   /**
103    * @~english Clear only table with wild card
104    */
105   USB_CLEAR_TYPE_WITH_WILDCARD,
106 } USB_CLEAR_TYPE;
107
108 /**
109  * \ingroup USB_Auth_Info
110  * \~english @par Brief
111  *      Set the authentication status of the service PS_CommUSB.
112  * \~english @param [in] h_app
113  *      HANDLE - handle for application
114  * \~english @param [in] auth_info
115  *      uint8_t - Authentication status,refer to @ref COMMUSB_AUTH_INFO
116  * \~english @retval eFrameworkunifiedStatusOK success
117  * \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
118  * \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
119  * \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
120  * \~english @retval eFrameworkunifiedStatusErrNoEINTR
121  *      An interrupt is generated by the system call (signal)
122  * \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
123  * \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
124  * \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
125  * \~english @retval eFrameworkunifiedStatusInvldBuf Invalid buffer
126  * \~english @retval eFrameworkunifiedStatusBadConnection It can not be a socket connection
127  * \~english @retval eFrameworkunifiedStatusFail Abnormal Error
128  *      (System error, Avaiability is FALSE, internal status error)
129  * \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
130  * \~english @retval eFrameworkunifiedStatusInvldQName Illegal Message Queue name
131  * \~english @retval eFrameworkunifiedStatusErrOther
132  *      Other error has occurred(Cannot access shared memory, etc.)
133  * \~english @par Preconditons
134  * - Availability of PS_CommUSB is TRUE and Authentication state is TRUE.
135  * \~english @par Change of internal status
136  * - Change of internal state according to the API does not occur
137  * \~english @par Conditions of processing failure
138  * - Input parameter error
139  *  - Parameter h_app is null
140  *   - eFrameworkunifiedStatusInvldHandle
141  *  - Parameter auth_info is invalid
142  *   - eFrameworkunifiedStatusInvldParam
143  * - Internal process error
144  *  - Availability of PS_CommUSB is not TRUE
145  *  - The size of the message received by PS_CommUSB is illegal
146  *   - eFrameworkunifiedStatusFail
147  *  - Execute the process name is not ExtUnitAuth
148  *   - eFrameworkunifiedStatusMsgNotProcessed
149  * - Internal process error(ns_framework error)
150  *  - eFrameworkunifiedStatusInvldHandle
151  *  - eFrameworkunifiedStatusMsgQFull
152  *  - eFrameworkunifiedStatusErrNoEBADF
153  *  - eFrameworkunifiedStatusErrNoEINTR
154  *  - eFrameworkunifiedStatusNullPointer
155  *  - eFrameworkunifiedStatusInvldBufSize
156  *  - eFrameworkunifiedStatusInvldBuf
157  *  - eFrameworkunifiedStatusBadConnection
158  *  - eFrameworkunifiedStatusFail
159  *  - eFrameworkunifiedStatusInvldHndlType
160  *  - eFrameworkunifiedStatusInvldQName
161  *  - eFrameworkunifiedStatusErrOther
162  * \~english @par classification
163  *      Public
164  * \~english @par Type
165  *      Method only
166  * \~english @par Details
167  *      Set the authentication status for PS_CommUSB.
168  * \~english @par
169  *      when using this API,please note the following points:
170  *      - The status of service PS_CommUSB and the availability of this
171  *        API, refer to PS_CommUSB available function list of BaseSystem
172  *        external specification.
173  *      - This API is designed for the ExtUnitAuth process, If it is used by
174  *        other process, return eFrameworkunifiedStatusMsgNotProcessed.
175  * \~english @see None
176  */
177 EFrameworkunifiedStatus USB_Auth_Info(HANDLE h_app, uint8_t auth_info);
178
179 #ifdef __cplusplus
180 }
181 #endif  // __cplusplus
182
183 /** @}*/  // end of communication_usb
184 /** @}*/  // end of peripheral_service
185 /** @}*/  // end of BaseSystem
186 #endif  // COMMUNICATION_USB_CLIENT_INCLUDE_PERIPHERAL_SERVICE_COMMUSB_API_H_