Init basesystem source codes.
[staging/basesystem.git] / video_in_hal / nsframework / framework_unified / client / include / native_service / frameworkunified__CWORD77__service_if.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 /// \ingroup  tag_HMI_CWORD77_Controller
19 /// \brief
20 ///
21 ////////////////////////////////////////////////////////////////////////////////
22 //@{
23 /**
24  * @file frameworkunified__CWORD77__service_if.h
25  * @brief \~english This file contains a interface class for all services classes.
26  *
27  */
28 /** @addtogroup BaseSystem
29  *  @{
30  */
31 /** @addtogroup native_service
32  *  @ingroup BaseSystem
33  *  @{
34  */
35 /** @addtogroup framework_unified
36  *  @ingroup native_service
37  *  @{
38  */
39 /** @addtogroup _CWORD77_
40  *  @ingroup framework_unified
41  *  @{
42  */
43 #ifndef _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_  // NOLINT  (build/header_guard)
44 #define _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_
45
46 #include <native_service/ns__CWORD77__common.h>
47 #include <native_service/frameworkunified__CWORD77__session_if.h>
48 #include <string>
49 #include <map>
50 #include <vector>
51
52 ///////////////////////////////////////////////////////////////////////////
53 /// class: CFrameworkunified_CWORD77_Service
54 /// Description: This is interface class for all services classes.
55 ///
56 ////////////////////////////////////////////////////////////////////////////
57
58 class CFrameworkunified_CWORD77_Service {
59  protected:
60   std::map<UI_32, CFrameworkunified_CWORD77_Session *> m_SessTypeToSessObj;  ///< Map of session type to session object
61   ResponseServiceTo_CWORD77_ m_cbResponse;  ///< Call back function pointer
62   SessionAckTo_CWORD77_ m_cbSessionACK;  // Call back function pointer for session ACK
63   std::vector<FrameworkunifiedNotificationCallbackHandler> m_vServiceNotifications;  ///< vector of Frameworkunifiednotification callbacks
64   CFrameworkunified_CWORD77_Session *m_pSession;       ///< Pointer to an instance of I_CWORD77_Session
65   std::string m_cServiceName;
66   BOOL m_bServiceAvailable;
67   UI_8 m_ui8SessionRetryCount;
68   HANDLE m_hApp;  ///> application framework handle
69   ////////////////////////////////////////////////////////////////////////////////////////////
70   /// \ingroup CFrameworkunified_CWORD77_Service
71   /// \~english @par Brief
72   ///        Function to send message to a session
73   /// \~english @param[in] f_uiSessionType
74   ///        UI_32 - session type
75   /// \~english @param[in] f_uiSrvProtocol
76   ///        UI_32 - Protocol ID
77   /// \~english @retval none
78   /// \~english @par Preconditons
79   ///        CFrameworkunified_CWORD77_Service::SetSession()
80   /// \~english @par Change of internal status
81   ///        -  The internal state is not changed.
82   /// \~english @par Conditions of processing failure
83   ///        -  none
84   /// \~english @par Detail
85   ///          Send specified sessionType message by FrameworkunifiedSendMsg().
86   /// \~english @par
87   ///          If the session object corresponding to the session Public specified by the arguments is not registered,
88   ///          the system terminates normally without sending the object.\n
89   /// \~english @par Classification
90   ///          public
91   /// \~english @par Type
92   ///          none
93   /// \~english @see SetSession,FrameworkunifiedSendMsg
94   ////////////////////////////////////////////////////////////////////////////////////////////
95   void SendMessageToSession(UI_32 f_uiSessionType, UI_32 f_uiSrvProtocol);
96
97   ////////////////////////////////////////////////////////////////////////////////////////////
98   /// \ingroup CFrameworkunified_CWORD77_Service
99   /// \~english @par Brief
100   ///        Function to open sessions with specified Service Name
101   /// \~english @param [in] f_hApp
102   ///           f_hApp - Handle to the Framework
103   /// \~english @par
104   ///           f_hApp   HANDLE*
105   /// \~english @param [in] f_sServiceName
106   ///           f_sServiceName  - Service Name
107   /// \~english @par
108   ///           f_sServiceName - const std::string&
109   /// \~english @retval none
110   /// \~english @par Preconditons
111   ///        - none
112   /// \~english @par Change of internal status
113   ///        -  Save service name into member variable.
114   /// \~english @par Conditions of processing failure
115   ///        -  none
116   /// \~english @par Detail
117   ///          Function to open sessions with specified Service Name
118   /// \~english @par Classification
119   ///          public
120   /// \~english @par Type
121   ///          sync only
122   /// \~english @see none
123   ////////////////////////////////////////////////////////////////////////////////////////////
124   void OpenSession(HANDLE f_hApp, const std::string &f_sServiceName);
125
126   ////////////////////////////////////////////////////////////////////////////////////////////
127   /// \ingroup CFrameworkunified_CWORD77_Service
128   /// \~english @par Brief
129   ///        Function to close sessions
130   /// \~english @param [in] f_hApp
131   ///           f_hApp - Handle to the Framework
132   /// \~english @par
133   ///           f_hApp   HANDLE*
134   /// \~english @retval none
135   /// \~english @par Preconditons
136   ///        - none
137   /// \~english @par Change of internal status
138   ///        -   The internal state is not changed.
139   /// \~english @par Conditions of processing failure
140   ///        -  none
141   /// \~english @par Detail
142   ///          Function to close sessions
143   /// \~english @par Classification
144   ///          public
145   /// \~english @par Type
146   ///          sync only
147   /// \~english @see none
148   ////////////////////////////////////////////////////////////////////////////////////////////
149
150   void CloseSession(HANDLE f_hApp);
151
152   ////////////////////////////////////////////////////////////////////////////////////////////
153   /// \ingroup CFrameworkunified_CWORD77_Service
154   /// \~english @par Brief
155   ///        Function to add notification
156   /// \~english @param[in] f_pNotification
157   ///        PCSTR - Notification name
158   /// \~english @retval none
159   /// \~english @par Preconditons
160   ///        - Session obeject is declared in CFrameworkunified_CWORD77_Service::SetSession()
161   /// \~english @par Change of internal status
162   ///        - The internal state is not changed.
163   /// \~english @par Conditions of processing failure
164   ///        - none
165   /// \~english @par Detail
166   ///        -Bind Notification name declared in parameter with callbak function in OnServiceNtf()
167   /// \~english @par Detail
168   ///        -subscribed notifications will transfor into subscribe instance in SubscribeNotifications()
169   /// \~english @par Detail
170   ///        -Process will not commit when notification parameter name is null
171   /// \~english @par Classification
172   ///        -public
173   /// \~english @par Type
174   ///        -None
175   /// \~english @see SetSession,OnServiceNtf,SubscribeNotifications,UnSubscribeNotifications
176   ////////////////////////////////////////////////////////////////////////////////////////////
177   void AddNotification(PCSTR f_pNotification);
178
179   ////////////////////////////////////////////////////////////////////////////////////////////
180   ///   AttachOpenSessionAckCallback
181   /// virtual function to attche open session ack callback
182   ///
183   /// \param  [in] hApp
184   ///     HANDLE - Handle to the Framework
185   /// \return status
186   ///     EFrameworkunifiedStatus - Success or Error
187   ////////////////////////////////////////////////////////////////////////////////////////////
188   virtual EFrameworkunifiedStatus AttachOpenSessionAckCallback(HANDLE hApp) = 0;
189
190   ////////////////////////////////////////////////////////////////////////////////////////////
191   /// OpenSessionRetry
192   /// This function sends open session request to the service m_cServiceName
193   ///
194   /// \param  [in] f_ui32SessionType
195   ///     UI_32 - Session type to open
196   /// \return none
197   ///
198   ////////////////////////////////////////////////////////////////////////////////////////////
199
200   void OpenSessionRetry(UI_32 f_ui32SessionType);
201
202  public:
203   ////////////////////////////////////////////////////////////////////////////////////////////
204   /// \ingroup CFrameworkunified_CWORD77_Service
205   /// \~english @par Brief
206   ///        Constructor for CFrameworkunified_CWORD77_Service
207   /// \~english @retval none
208   /// \~english @par Preconditions
209   ///        -No preconditions
210   /// \~english @par Change of internal status
211   ///        -The internal state is not changed.
212   /// \~english @par Conditions of processing failure
213   ///        -None
214   /// \~english @par Detail
215   ///        -Create CFrameworkunified_CWORD77_Service class instance
216   ///        -Initialize class member variable(m_cbResponse, m_cbSessionACK, m_pSession, m_cServiceName,\n
217   ///         m_bServiceAvailable, m_ui8SessionRetryCount, m_hApp, m_SessTypeToSessObj).\n
218   /// \~english @par Classification
219   ///        -public
220   /// \~english @par type
221   ///        -None
222   /// \~english @see ~CFrameworkunified_CWORD77_Service
223   ////////////////////////////////////////////////////////////////////////////////////////////
224   CFrameworkunified_CWORD77_Service();
225
226   ////////////////////////////////////////////////////////////////////////////////////////////
227   /// \ingroup CFrameworkunified_CWORD77_Service
228   /// \~english @par Brief
229   ///        Destructor for CFrameworkunified_CWORD77_Service
230   /// \~english @retval none
231   /// \~english @par Preconditons
232   ///         -CFrameworkunified_CWORD77_Service instance is decleared in Constructor
233   /// \~english @par Change of internal status
234   ///         -The internal status is not changed
235   /// \~english @par Conditions of processing failure
236   ///         -None
237   /// \~english @par Detail
238   ///         -Release the CFrameworkunified_CWORD77_Service class instance
239   /// \~english @par Classification
240   ///         -Pubulic
241   /// \~english @par Type
242   ///         -None
243   /// \~english @see CFrameworkunified_CWORD77_Service
244   ////////////////////////////////////////////////////////////////////////////////////////////
245   virtual ~CFrameworkunified_CWORD77_Service();
246
247
248   ////////////////////////////////////////////////////////////////////////////////////////////
249   /// \ingroup CFrameworkunified_CWORD77_Service
250   /// \~english @par Brief
251   ///        HandleMessage
252   ///        virtual function to process message coming from _CWORD77_
253   /// \~english @param [in] cmdID
254   ///           cmdID - Request ID
255   /// \~english @par
256   ///           cmdID   UI_32
257   /// \~english @retval EFrameworkunifiedStatus
258   ///             eFrameworkunifiedStatusOK or Error
259   /// \~english @par Preconditons
260   ///        - no preconditions
261   /// \~english @par Change of internal status
262   ///        -   The internal state is not changed.
263   /// \~english @par Conditions of processing failure
264   ///        -  none
265   /// \~english @par Detail
266   ///        -  none
267   /// \~english @par Classification
268   ///          public
269   /// \~english @par Type
270   ///          none
271   /// \~english @see none
272   ////////////////////////////////////////////////////////////////////////////////////////////
273   virtual EFrameworkunifiedStatus HandleServiceMessage(UI_32 cmdID) = 0;
274
275
276   ////////////////////////////////////////////////////////////////////////////////////////////
277   /// \ingroup CFrameworkunified_CWORD77_Service
278   /// \~english @par Brief
279   ///        function to open session with specified Service name when service available.
280   /// \~english @param [in] f_hApp
281   ///           f_hApp - Handle to the Framework
282   /// \~english @par
283   ///           f_hApp   HANDLE*
284   /// \~english @param [in] f_sServiceName
285   ///           f_sServiceName - service name
286   /// \~english @par
287   ///           f_sServiceName -  const std::string &
288   /// \~english @retval EFrameworkunifiedStatus
289   ///             eFrameworkunifiedStatusOK or Error
290   /// \~english @par Preconditions
291   ///        - no preconditions
292   /// \~english @par Change of internal status
293   ///        -   save Framework handler into m_hApp.
294   /// \~english @par Conditions of processing failure
295   ///        -  none
296   /// \~english @par Detail
297   ///           function to open session with specified Service name
298   /// \~english @par Classification
299   ///          public
300   /// \~english @par Type
301   ///          sync only
302   /// \~english @see AttachOpenSessionAckCallback, OpenSession
303   ////////////////////////////////////////////////////////////////////////////////////////////
304   EFrameworkunifiedStatus OpenServiceOnAvailability(HANDLE f_hApp, const std::string &f_sServiceName);
305
306
307   ////////////////////////////////////////////////////////////////////////////////////////////
308   /// \ingroup CFrameworkunified_CWORD77_Service
309   /// \~english @par Brief
310   ///        function to close session when service unavailable.
311   /// \~english @param [in] f_hApp
312   ///           f_hApp - Handle to the Framework
313   /// \~english @par
314   ///           f_hApp   HANDLE*
315   /// \~english @retval EFrameworkunifiedStatus
316   ///             eFrameworkunifiedStatusOK or Error
317   /// \~english @par Preconditons
318   ///        - no preconditions
319   /// \~english @par Change of internal status
320   ///        -   set m_bServiceAvailable FALSE.
321   /// \~english @par Conditions of processing failure
322   ///        -  none
323   /// \~english @par Detail
324   ///          function to close session when service unavailable.
325   /// \~english @par Classification
326   ///          public
327   /// \~english @par Type
328   ///          sync only
329   /// \~english @see CloseSession
330   ////////////////////////////////////////////////////////////////////////////////////////////
331   EFrameworkunifiedStatus CloseServiceOnUnavailability(HANDLE hApp);
332
333   ////////////////////////////////////////////////////////////////////////////////////////////
334   /// \ingroup CFrameworkunified_CWORD77_Service
335   /// \~english @par Brief
336   ///        Set Call back function into Sessions.
337   /// \~english @param [in] fptr
338   ///           fptr - Pointer to call back function
339   /// \~english @par
340   ///           fptr   ResponseServiceTo_CWORD77_*
341   /// \~english @retval
342   /// \~english @par Preconditons
343   ///        - no preconditions
344   /// \~english @par Change of internal status
345   ///        -   set m_cbResponse with fptr.
346   /// \~english @par Conditions of processing failure
347   ///        -  none
348   /// \~english @par Detail
349   ///         Set Call back function into Sessions.
350   /// \~english @par Classification
351   ///          public
352   /// \~english @par Type
353   ///          sync only
354   /// \~english @see
355   ////////////////////////////////////////////////////////////////////////////////////////////
356   void SetResponseCallback(ResponseServiceTo_CWORD77_ fptr);
357
358   ////////////////////////////////////////////////////////////////////////////////////////////
359   /// \ingroup CFrameworkunified_CWORD77_Service
360   /// \~english @par Brief
361   ///        API to set session objects in service.
362   /// \~english @param [in] f_pSessionObj
363   ///           f_pSessionObj - Pointer to an instance of session object.
364   /// \~english @par
365   ///           f_pSessionObj   CFrameworkunified_CWORD77_Session*
366   /// \~english @retval
367   /// \~english @par Preconditons
368   ///        - no preconditions
369   /// \~english @par Change of internal status
370   ///        - set sessionobj into m_SessTypeToSessObj.
371   /// \~english @par Conditions of processing failure
372   ///        -  none
373   /// \~english @par Detail
374   ///         Set session objects in service.
375   /// \~english @par Classification
376   ///          public
377   /// \~english @par Type
378   ///          sync only
379   /// \~english @see
380   ////////////////////////////////////////////////////////////////////////////////////////////
381   void SetSession(CFrameworkunified_CWORD77_Session *f_pSessionObj);
382
383
384   ////////////////////////////////////////////////////////////////////////////////////////////
385   /// \ingroup CFrameworkunified_CWORD77_Service
386   /// \~english @par Brief
387   ///        Subscribe notifications.
388   /// \~english @param [in] hApp
389   ///           hApp - Handle to the Framework.
390   /// \~english @par
391   ///           hApp   HANDLE*
392   /// \~english @retval EFrameworkunifiedStatus
393   ///                 eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
394   /// \~english @par Preconditons
395   ///        - no preconditions
396   /// \~english @par Change of internal status
397   ///        -    save pointer of notifications into framework handler.
398   /// \~english @par Conditions of processing failure
399   ///        -  FrameworkunifiedSubscribeNotificationWithCallback() failed [eFrameworkunifiedStatusInvldParam]
400   /// \~english @par Detail
401   ///         Send subscribe message to NPPService for Subscribe notifications.
402   /// \~english @par Classification
403   ///          public
404   /// \~english @par Type
405   ///          sync only
406   /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
407   ////////////////////////////////////////////////////////////////////////////////////////////
408   EFrameworkunifiedStatus SubscribeNotifications(HANDLE hApp);
409
410
411   ////////////////////////////////////////////////////////////////////////////////////////////
412   /// \ingroup CFrameworkunified_CWORD77_Service
413   /// \~english @par Brief
414   ///        unsubscribe notifications
415   /// \~english @param [in] hApp
416   ///           hApp - Handle to the Framework.
417   /// \~english @par
418   ///           hApp   HANDLE*
419   /// \~english @retval EFrameworkunifiedStatus
420   ///                 eFrameworkunifiedStatusOK or eFrameworkunifiedStatusInvldParam
421   /// \~english @par Preconditons
422   ///        - no preconditions
423   /// \~english @par Change of internal status
424   ///        -    delete notifications from framework handler.
425   /// \~english @par Conditions of processing failure
426   ///        -  FrameworkunifiedNPUnsubscribeFromNotifications() failed [eFrameworkunifiedStatusInvldParam]
427   /// \~english @par Detail
428   ///         Send unsubscribe message to NPPService for delete subscribe notifications.
429   /// \~english @par Classification
430   ///          public
431   /// \~english @par Type
432   ///          sync only
433   /// \~english @see FrameworkunifiedSubscribeNotificationWithCallback
434   ////////////////////////////////////////////////////////////////////////////////////////////
435   EFrameworkunifiedStatus UnSubscribeNotifications(HANDLE hApp);
436
437   ////////////////////////////////////////////////////////////////////////////////////////////
438   /// \ingroup CFrameworkunified_CWORD77_Service
439   /// \~english @par Brief
440   ///        virtual function to enable session in service
441   /// \~english @param [in] f_uiNum
442   ///           f_uiNum - Number of arguments
443   /// \~english @par
444   ///           f_uiNum   UI_32
445   /// \~english @param [in] f_uiFirst
446   ///           f_uiFirst - first argument
447   /// \~english @par
448   ///           f_uiFirst   UI_32
449   /// \~english @retval None
450   /// \~english @par Preconditons
451   ///        -
452   /// \~english @par Change of internal status
453   ///        -   The internal state is not changed.
454   /// \~english @par Conditions of processing failure
455   ///        -  none
456   /// \~english @par Detail
457   ///          None
458   /// \~english @par Classification
459   ///          public
460   /// \~english @par Type
461   ///          None
462   /// \~english @see none
463   ////////////////////////////////////////////////////////////////////////////////////////////
464   virtual void EnableSession(UI_32 f_uiNum, UI_32 f_uiFirst, ...) = 0;
465
466   ////////////////////////////////////////////////////////////////////////////////////////////
467   /// \ingroup CFrameworkunified_CWORD77_Service
468   /// \~english @par Brief
469   ///        unsubscribe notifications
470   /// \~english @param [in] hApp
471   ///           hApp - Handle to the Framework.
472   /// \~english @par
473   ///           hApp   HANDLE*
474   /// \~english @retval EFrameworkunifiedStatus
475   ///                 eFrameworkunifiedStatusOK or eFrameworkunifiedStatusNullPointer
476   /// \~english @par Preconditons
477   ///        - no preconditions
478   /// \~english @par Change of internal status
479   ///        - none.
480   /// \~english @par Conditions of processing failure
481   ///        -  FrameworkunifiedGetMsgDataOfSize() failed [eFrameworkunifiedStatusNullPointer]
482   /// \~english @par Detail
483   ///         Call register subscribe notification.
484   /// \~english @par Classification
485   ///          public
486   /// \~english @par Type
487   ///          sync only
488   /// \~english @see FrameworkunifiedGetMsgDataOfSize, SetRespNotfnDataIn_CWORD77_DataPool
489   ////////////////////////////////////////////////////////////////////////////////////////////
490   EFrameworkunifiedStatus OnServiceNtf(HANDLE hApp);
491
492   ////////////////////////////////////////////////////////////////////////////////////////////
493   /// \ingroup CFrameworkunified_CWORD77_Service
494   /// \~english @par Brief
495   ///        Acknowledgement process of open session
496   /// \~english @param[in] f_hApp
497   ///        HANDLE - Handle to the Application
498   /// \~english @retval none
499   /// \~english @par Preconditons
500   ///           - Set Session object in CFrameworkunified_CWORD77_Service::SetSession()
501   ///           - Set Callback function in CFrameworkunified_CWORD77_Service::Set_CWORD77_OpenSessionACK()
502   /// \~english @par Change of internal status
503   ///           none
504   /// \~english @par Conditions of processing failure
505   ///           none
506   /// \~english @par Detail
507   ///           Set the application handle as Parameter when receiving acknowledgement for open session process.
508   ///           Call OpenSessionAcknowledge() in session object which has same session type.
509   ///           Call the callback function for open session acknowledgement.
510   /// \~english @par
511   ///           Message sending process will be stoped in reguler when the session type of open session process is not
512   ///           declared.
513   /// \~english @par
514   ///           Callback function will be stoped in reguler when callback function is not declared.
515   /// \~english @par Classification
516   ///           public
517   /// \~english @par Type
518   ///           none
519   /// \~english @see SetSession,Set_CWORD77_OpenSessionACK
520   ////////////////////////////////////////////////////////////////////////////////////////////
521   void OpenSessionAcks(HANDLE f_hApp);
522
523   ////////////////////////////////////////////////////////////////////////////////////////////
524   /// \ingroup CFrameworkunified_CWORD77_Service
525   /// \~english @par Brief
526   ///        Attach open session ack callback function to service.
527   /// \~english @param [in] fptr
528   ///           fptr - Callback Function pointer of notify open session ack.
529   /// \~english @par
530   ///           fptr   SessionAckTo_CWORD77_*
531   /// \~english @retval
532   /// \~english @par Preconditons
533   ///        - no preconditions
534   /// \~english @par Change of internal status
535   ///        -  set callback function into m_cbSessionACK..
536   /// \~english @par Conditions of processing failure
537   ///        -  none
538   /// \~english @par Detail
539   ///         Attach open session ack callback function to service.
540   /// \~english @par Classification
541   ///          public
542   /// \~english @par Type
543   ///          sync only
544   /// \~english @see none
545   ////////////////////////////////////////////////////////////////////////////////////////////
546   void Set_CWORD77_OpenSessionACK(SessionAckTo_CWORD77_ fptr);
547 };
548
549 #endif  // _FRAMEWORKUNIFIED__CWORD77_SERVICE_H_  NOLINT  (build/header_guard)
550 /** @}*/
551 /** @}*/
552 /** @}*/
553 /** @}*/
554 //@}