2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief \~english This file contains the declaration of CNSRcsPlugin class
22 /** @addtogroup BaseSystem
25 /** @addtogroup native_service
29 /** @addtogroup framework_unified
30 * @ingroup native_service
34 * @ingroup framework_unified
38 #ifndef _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)
39 #define _NS_RCS_PLUGIN_H__
41 #include <native_service/frameworkunified_types.h>
44 typedef EFrameworkunifiedStatus(*TFPNSRcsSendPassthruData)(UI_8 f_ui8clientId, PVOID f_data, UI_16 f_ui16PayloadLength);
46 // forward declaration
47 class CPassThruInDataHandler;
51 * \~english @brief CNSRcsPlugin
52 * \~english @par Brief Introduction
53 * Class to provide base class of CNSRcsPlugin
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
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
73 /// \~english @par Classification
75 /// \~english @par Type
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;
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
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
100 /// \~english @par Classification
102 /// \~english @par Type
104 /// \~english @par Detail
105 /// To delete a CNSRcsPlugin class. \n
106 /// \~english @see CNSRcsPlugin
107 ////////////////////////////////////////////////////////////////////////////////////
108 virtual ~CNSRcsPlugin() {
111 /////////////////////////////////////////////////////////////////////////////////////
112 /// \ingroup CNSRcsPlugin
113 /// \~english @par Summary
115 /// \~english @param None
116 /// \~english @retval Plugin Id
117 /// UI_8 - the ID of plugin
118 /// \~english @par Preconditions
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
124 /// \~english @par Classification
126 /// \~english @par Type
128 /// \~english @par Detail
129 /// provide API whar get plugin id. \n
130 /// \~english @see CNSRcsPlugin
131 ////////////////////////////////////////////////////////////////////////////////////
135 /////////////////////////////////////////////////////////////////////////////////////
136 /// \ingroup CNSRcsPlugin
137 /// \~english @par Summary
139 /// \~english @param None
140 /// \~english @retval m_cPluginName
141 /// std::string - the name of plugin
142 /// \~english @par Preconditions
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
148 /// \~english @par Classification
150 /// \~english @par Type
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;
160 /////////////////////////////////////////////////////////////////////////////////////
161 /// \ingroup CNSRcsPlugin
162 /// \~english @par Summary
164 /// \~english @param f_cParentName
165 /// std::string - the name of parent
166 /// \~english @retval none
167 /// \~english @par Preconditions
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
173 /// \~english @par Classification
175 /// \~english @par Type
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;
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
193 /// \~english @param f_pData
194 /// CPassThruInDataHandler - the handler of transfer data
195 /// \~english @retval none
196 /// \~english @par Preconditions
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
202 /// \~english @par Classification
204 /// \~english @par Type
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
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
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
230 /// \~english @par Classification
232 /// \~english @par Type
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
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
252 /// \~english @par Classification
254 /// \~english @par Type
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
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
273 /// \~english @par Classification
275 /// \~english @par Type
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;
283 static std::string m_cParentName; // TODO: move to private
285 /////////////////////////////////////////////////////////////////////////////////////
286 /// \ingroup CNSRcsPlugin
287 /// \~english @par Summary
288 /// the function of transport data
289 /// \~english @param f_ui8ClientId
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
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
302 /// \~english @par Classification
304 /// \~english @par Type
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);
318 TFPNSRcsSendPassthruData m_fpNSRcsSendPassthruData;
319 std::string m_cPluginName;
322 // std::string CNSRcsPlugin::m_cParentName = "";
324 #endif // _NS_RCS_PLUGIN_H__ // NOLINT (build/header_guard)