Remove unused directories and files in video_in_hal
[staging/basesystem.git] / service / native / framework_unified / client / include / native_service / ns_rcs_plugin.hpp
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
19  * @brief \~english This file contains the declaration of CNSRcsPlugin class
20  *
21  */
22 /** @addtogroup BaseSystem
23  *  @{
24  */
25 /** @addtogroup native_service
26  *  @ingroup BaseSystem
27  *  @{
28  */
29 /** @addtogroup framework_unified
30  *  @ingroup native_service
31  *  @{
32  */
33 /** @addtogroup nsrcs
34  *  @ingroup framework_unified
35  *  @{
36  */
37
38 #ifndef _NS_RCS_PLUGIN_H__  // NOLINT  (build/header_guard)
39 #define _NS_RCS_PLUGIN_H__
40
41 #include <native_service/frameworkunified_types.h>
42 #include <string>
43
44 typedef EFrameworkunifiedStatus(*TFPNSRcsSendPassthruData)(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength);
45
46 // forward declaration
47 class CPassThruInDataHandler;
48
49 /**
50  * @class CNSRcsPlugin
51  * \~english @brief CNSRcsPlugin
52  * \~english @par   Brief Introduction
53  *        Class to provide base class of CNSRcsPlugin
54  */
55
56 class CNSRcsPlugin {
57  public:
58   /////////////////////////////////////////////////////////////////////////////////////
59   /// \ingroup CNSRcsPlugin
60   /// \~english @par Summary
61   ///       Constructor of CNSRcsPlugin class.
62   /// \~english @param [in] f_cPluginName
63   ///        std::string  - the name of plugin
64   /// \~english @param [in] f_fpNSRcsSendPassthruData
65   ///        TFPNSRcsSendPassthruData - the pointer of send data function
66   /// \~english @retval None
67   /// \~english @par Preconditions
68   ///       - None.
69   /// \~english @par Change of the internal state
70   ///       - Change of internal state according to the API does not occur.
71   /// \~english @par Causes of failures
72   ///       None
73   /// \~english @par Classification
74   ///       Public
75   /// \~english @par Type
76   ///          sync only
77   /// \~english @par Detail
78   ///       Constructor of CNSRcsPlugin class. \n
79   ///       variables (m_cPluginName,m_fpNSRcsSendPassthruData,m_uiPluginId) to be initialization.
80   /// \~english @see  ~CNSRcsPlugin
81   ////////////////////////////////////////////////////////////////////////////////////
82   CNSRcsPlugin(std::string f_cPluginName, TFPNSRcsSendPassthruData f_fpNSRcsSendPassthruData)
83     : m_fpNSRcsSendPassthruData(f_fpNSRcsSendPassthruData),
84       m_cPluginName(f_cPluginName) {
85     static UI_8 l_uiPluginId = 0;
86     m_uiPluginId = ++l_uiPluginId;
87   }
88   /////////////////////////////////////////////////////////////////////////////////////
89   /// \ingroup CNSRcsPlugin
90   /// \~english @par Summary
91   ///       Destructor of CNSRcsPlugin class.
92   /// \~english @param None
93   /// \~english @retval None
94   /// \~english @par Preconditions
95   ///       - None.
96   /// \~english @par Change of the internal state
97   ///       - Change of internal state according to the API does not occur.
98   /// \~english @par Causes of failures
99   ///       None
100   /// \~english @par Classification
101   ///       Public
102   /// \~english @par Type
103   ///          sync only
104   /// \~english @par Detail
105   ///       To delete a CNSRcsPlugin class. \n
106   /// \~english @see  CNSRcsPlugin
107   ////////////////////////////////////////////////////////////////////////////////////
108   virtual ~CNSRcsPlugin() {
109
110   }
111   /////////////////////////////////////////////////////////////////////////////////////
112   /// \ingroup CNSRcsPlugin
113   /// \~english @par Summary
114   ///       get plugin id.
115   /// \~english @param None
116   /// \~english @retval Plugin Id
117   ///        UI_8  - the ID of plugin
118   /// \~english @par Preconditions
119   ///       - None.
120   /// \~english @par Change of the internal state
121   ///       - Change of internal state according to the API does not occur.
122   /// \~english @par Causes of failures
123   ///       None
124   /// \~english @par Classification
125   ///       Public
126   /// \~english @par Type
127   ///          sync only
128   /// \~english @par Detail
129   ///       provide API whar get plugin id. \n
130   /// \~english @see  CNSRcsPlugin
131   ////////////////////////////////////////////////////////////////////////////////////
132   UI_8 GetPluginId() {
133     return m_uiPluginId;
134   }
135   /////////////////////////////////////////////////////////////////////////////////////
136   /// \ingroup CNSRcsPlugin
137   /// \~english @par Summary
138   ///       get plugin id.
139   /// \~english @param None
140   /// \~english @retval m_cPluginName
141   ///        std::string - the name of plugin
142   /// \~english @par Preconditions
143   ///       - None.
144   /// \~english @par Change of the internal state
145   ///       - Change of internal state according to the API does not occur.
146   /// \~english @par Causes of failures
147   ///       None
148   /// \~english @par Classification
149   ///       Public
150   /// \~english @par Type
151   ///          sync only
152   /// \~english @par Detail
153   ///       provide API whar get plugin name. \n
154   /// \~english @see  CNSRcsPlugin
155   ////////////////////////////////////////////////////////////////////////////////////
156   std::string GetPluginName() {
157     return m_cPluginName;
158   }
159
160   /////////////////////////////////////////////////////////////////////////////////////
161   /// \ingroup CNSRcsPlugin
162   /// \~english @par Summary
163   ///       set parent name.
164   /// \~english @param f_cParentName
165   ///        std::string - the name of parent
166   /// \~english @retval none
167   /// \~english @par Preconditions
168   ///       - None.
169   /// \~english @par Change of the internal state
170   ///       - Change of internal state according to the API does not occur.
171   /// \~english @par Causes of failures
172   ///       None
173   /// \~english @par Classification
174   ///       Public
175   /// \~english @par Type
176   ///          sync only
177   /// \~english @par Detail
178   ///       provide API whar set parent name. \n
179   /// \~english @see  CNSRcsPlugin
180   ////////////////////////////////////////////////////////////////////////////////////
181   static VOID SetParentName(const std::string &f_cParentName) {
182     CNSRcsPlugin::m_cParentName = f_cParentName;
183   }
184
185   /////////////////////////////////////////////////////////////////////////////////////
186   /// \ingroup CNSRcsPlugin
187   /// \~english @par Summary
188   ///       request from host side.
189   /// \~english @param f_uiProtocol
190   ///        UI_32 - protocol ID
191   /// \~english @param f_ui8ClientId
192   ///        UI_8 - client ID
193   /// \~english @param f_pData
194   ///        CPassThruInDataHandler - the handler of transfer data
195   /// \~english @retval none
196   /// \~english @par Preconditions
197   ///       - None.
198   /// \~english @par Change of the internal state
199   ///       - Change of internal state according to the API does not occur.
200   /// \~english @par Causes of failures
201   ///       None
202   /// \~english @par Classification
203   ///       Public
204   /// \~english @par Type
205   ///          sync only
206   /// \~english @par Detail
207   ///       provide API whar request from host side.\n
208   /// \~english @see  CNSRcsPlugin
209   ////////////////////////////////////////////////////////////////////////////////////
210   virtual EFrameworkunifiedStatus ProcessRequestMessage(UI_32 f_uiProtocol, UI_8 f_ui8ClientId, CPassThruInDataHandler *f_pData) = 0;
211   /////////////////////////////////////////////////////////////////////////////////////
212   /// \ingroup CNSRcsPlugin
213   /// \~english @par Summary
214   ///       response from service side on target
215   /// \~english @param f_cMsgSource
216   ///        PCSTR  -
217   /// \~english @param f_uiProtocol
218   ///        UI_32 - protocol ID
219   /// \~english @param f_pui8Data
220   ///        UI_8 - pointer of data
221   /// \~english @param f_uiDataLength
222   ///        UI_32 - length of data
223   /// \~english @retval EFrameworkunifiedStatus
224   /// \~english @par Preconditions
225   ///       - None.
226   /// \~english @par Change of the internal state
227   ///       - Change of internal state according to the API does not occur.
228   /// \~english @par Causes of failures
229   ///       None
230   /// \~english @par Classification
231   ///       Public
232   /// \~english @par Type
233   ///          sync only
234   /// \~english @par Detail
235   ///       provide API whar response from service side on target.\n
236   /// \~english @see  CNSRcsPlugin
237   ////////////////////////////////////////////////////////////////////////////////////
238   virtual EFrameworkunifiedStatus ProcessResponseMessage(PCSTR f_cMsgSource, UI_32 f_uiProtocol, UI_8 *f_pui8Data,
239                                             UI_32 f_uiDataLength) = 0;
240   /////////////////////////////////////////////////////////////////////////////////////
241   /// \ingroup CNSRcsPlugin
242   /// \~english @par Summary
243   ///       get response protocol array
244   /// \~english @param none
245   /// \~english @retval UI_32 const *
246   /// \~english @par Preconditions
247   ///       - None.
248   /// \~english @par Change of the internal state
249   ///       - Change of internal state according to the API does not occur.
250   /// \~english @par Causes of failures
251   ///       None
252   /// \~english @par Classification
253   ///       Public
254   /// \~english @par Type
255   ///          sync only
256   /// \~english @par Detail
257   ///       provide API whar get response protocol array.\n
258   /// \~english @see  CNSRcsPlugin
259   ////////////////////////////////////////////////////////////////////////////////////
260   virtual UI_32 const *GetResponseProtocolArray() = 0;
261   /////////////////////////////////////////////////////////////////////////////////////
262   /// \ingroup CNSRcsPlugin
263   /// \~english @par Summary
264   ///       get length of response protocol array
265   /// \~english @param none
266   /// \~english @retval UI_32 const
267   /// \~english @par Preconditions
268   ///       - None.
269   /// \~english @par Change of the internal state
270   ///       - Change of internal state according to the API does not occur.
271   /// \~english @par Causes of failures
272   ///       None
273   /// \~english @par Classification
274   ///       Public
275   /// \~english @par Type
276   ///          sync only
277   /// \~english @par Detail
278   ///       provide API whar get length of response protocol array.\n
279   /// \~english @see  CNSRcsPlugin
280   ////////////////////////////////////////////////////////////////////////////////////
281   virtual UI_32 const GetResponseProtocolArrayLength() = 0;
282
283   static std::string m_cParentName;  // TODO: move to private
284
285   /////////////////////////////////////////////////////////////////////////////////////
286   /// \ingroup CNSRcsPlugin
287   /// \~english @par Summary
288   ///       the function of transport data
289   /// \~english @param f_ui8ClientId
290   ///        UI_8 - client id
291   /// \~english @param f_data
292   ///        PVOID - the pointer of transport data
293   /// \~english @param f_ui16PayloadLength
294   ///        UI_16 - the size of transport data
295   /// \~english @retval EFrameworkunifiedStatus
296   /// \~english @par Preconditions
297   ///       - None.
298   /// \~english @par Change of the internal state
299   ///       - Change of internal state according to the API does not occur.
300   /// \~english @par Causes of failures
301   ///       None
302   /// \~english @par Classification
303   ///       Public
304   /// \~english @par Type
305   ///          sync only
306   /// \~english @par Detail
307   ///       provide API whar the function of transport data.\n
308   /// \~english @see  CNSRcsPlugin
309   ////////////////////////////////////////////////////////////////////////////////////
310   EFrameworkunifiedStatus SendPassthruOutData(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength) {
311     return m_fpNSRcsSendPassthruData(f_ui8clientId, f_data, f_ui16PayloadLength);
312   }
313  private:
314   CNSRcsPlugin() {
315   }
316
317   UI_8    m_uiPluginId;
318   TFPNSRcsSendPassthruData m_fpNSRcsSendPassthruData;
319   std::string m_cPluginName;
320 };
321
322 // std::string CNSRcsPlugin::m_cParentName = "";
323
324 #endif  // _NS_RCS_PLUGIN_H__  // NOLINT  (build/header_guard)
325 /** @}*/
326 /** @}*/
327 /** @}*/
328 /** @}*/