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.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_StateMachine
21 /// This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
22 /// This class implements interfaces for connecting child states to parent states, connecting events
24 ///////////////////////////////////////////////////////////////////////////////
27 * @file frameworkunified_sm_hsm.h
28 * @brief \~english This file has the CFrameworkunifiedHSM class definitions. CFrameworkunifiedHSM is base class for HSM Framework.
29 * This class implements interfaces for connecting child states to parent states, connecting events to state.
31 /** @addtogroup BaseSystem
34 /** @addtogroup native_service
38 /** @addtogroup framework_unified
39 * @ingroup native_service
42 /** @addtogroup framework
43 * @ingroup framework_unified
46 /** @addtogroup statemachine
50 #ifndef __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)
51 #define __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__
53 ///////////////////////////////////////////////////////////////////////////////////////////////////
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
57 #include <native_service/frameworkunified_types.h>
58 #include <native_service/ns_logger_if.h>
59 #include <native_service/frameworkunified_sm_eventdata.h>
65 class CFrameworkunifiedEvent;
67 class CFrameworkunifiedState;
69 class CFrameworkunifiedCompositeState;
71 class CFrameworkunifiedReaction;
73 class CFrameworkunifiedOrthogonalState;
77 typedef boost::shared_ptr<CEventData> CEventDataPtr;
79 ///////////////////////////////////////////////////////////////////////////////////////////////////
80 /// This class implements interfaces for connecting child states to parent states, connecting events
82 ///////////////////////////////////////////////////////////////////////////////////////////////////
83 class CFrameworkunifiedHSM {
86 ///////////////////////////////////////////////////////////////////////////////////////////
87 /// \ingroup CFrameworkunifiedHSM
88 /// \~english @par Brief
89 /// Destructor for CFrameworkunifiedHSM
90 /// \~english @retval none
91 /// \~english @par Preconditons
92 /// - Self instance of CFrameworkunifiedHSM created.
93 /// \~english @par Change of internal status
95 /// \~english @par Conditions of processing failure
97 /// \~english @par Detail
98 /// Release class CFrameworkunifiedHistoryState instance.\n
99 /// Release event in postevent list.\n
100 /// \~english @par Classification
102 /// \~english @par Type
104 /// \~english @see none
105 ///////////////////////////////////////////////////////////////////////////////////////////
106 /// ~CFrameworkunifiedHSM
110 virtual ~CFrameworkunifiedHSM();
112 ///////////////////////////////////////////////////////////////////////////////////////////
113 /// \ingroup CFrameworkunifiedHSM
114 /// \~english @par Brief
115 /// Constructor for class CFrameworkunifiedHSM.
117 /// \~english @retval none
118 /// \~english @par Prerequisite
120 /// \~english @par Change of internal state
122 /// \~english @par Conditions of processing failure
124 /// \~english @par Detail
125 /// CFrameworkunifiedHSM class is the super class of HSM framework.
126 /// this class produce interface to connected super class state with sub class state and to connect event with
128 /// create the instance of CFrameworkunifiedHSM class\n
129 /// create event list as following and hold the member parameter,others will be initialized as NULL
130 /// - event list which is supported in state
131 /// \~english @par Classification
133 /// \~english @par Type
135 /// \~english @see ~CFrameworkunifiedHSM
136 ///////////////////////////////////////////////////////////////////////////////////////////
137 CFrameworkunifiedHSM();
139 ///////////////////////////////////////////////////////////////////////////////////////////
140 /// \ingroup CFrameworkunifiedHSM
141 /// \~english @par Brief
142 /// Constructor for class CFrameworkunifiedHSM.
143 /// \~english @param f_pHApp
144 /// PVOID - handle of application
145 /// \~english @retval none
146 /// \~english @par Prerequisite
148 /// \~english @par Change of internal state
150 /// \~english @par Conditions of processing failure
152 /// \~english @par Detail
153 /// CFrameworkunifiedHSM class is the super class of HSM framework.
154 /// this class produce interface to connected super class state with sub class state and to connect event with
156 /// create the instance of CFrameworkunifiedHSM class\n
157 /// create event list as following and hold the member parameter,others will be initialized as NULL
158 /// - event list which is supported in state
159 /// \~english @par Classification
161 /// \~english @par Type
163 /// \~english @see ~CFrameworkunifiedHSM
164 ///////////////////////////////////////////////////////////////////////////////////////////
165 ///////////////////////////////////////////////////////////////////////////////////////////
166 /// CFrameworkunifiedHSM(PVOID f_pHApp)
167 /// Class constructor
170 CFrameworkunifiedHSM(PVOID f_pHApp); // NOLINT (readability/nolint)
172 ///////////////////////////////////////////////////////////////////////////////////////////
173 /// \ingroup CFrameworkunifiedHSM
174 /// \~english @par Brief
175 /// Returns the active state of the statemachine
176 /// \~english @param none
177 /// \~english @retval CFrameworkunifiedState* - Returns ActiveState
178 /// \~english @retval NULL - failed
179 /// \~english @par Prerequisite
180 /// - Self instance of CFrameworkunifiedHSM created and active state exist.
181 /// \~english @par Change of internal state
183 /// \~english @par Conditions of processing failure
184 /// - active state do not exist. [NULL]
185 /// \~english @par Detail
186 /// route state search will be continued until current state become active
187 /// route state search will be continued until Leaf State or orthogonal State is found\n
188 /// if there is no active state.reture NULL\n
189 /// if there is active state,this state will be hold in memeber parameter as return value
190 /// \~english @par Classification
192 /// \~english @par Type
194 /// \~english @see CFrameworkunifiedState::FrameworkunifiedGetActiveState
195 ///////////////////////////////////////////////////////////////////////////////////////////
196 CFrameworkunifiedState *FrameworkunifiedGetActiveState();
198 ///////////////////////////////////////////////////////////////////////////////////////////
199 /// \ingroup CFrameworkunifiedHSM
200 /// \~english @par Brief
201 /// This creates the default event data and sends the event to the active HSM state.
202 /// \~english @param f_uiEventId
204 /// \~english @retval eFrameworkunifiedStatusOK add succ
205 /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
206 /// \~english @par Prerequisite
207 /// - Self instance of CFrameworkunifiedHSM created.
208 /// \~english @par Change of internal state
210 /// \~english @par Conditions of processing failure
211 /// - Event data instance create faield. [eFrameworkunifiedStatusNullPointer]
212 /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
213 /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
214 /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
215 /// \~english @par Detail
216 /// create new event data object and send this event to active HSM state,\n
217 /// then add to event queue of the statemachine
218 /// add to event queque in order to process event using statemachine
219 /// event will be deleted from event queue when process complete
220 /// \~english @par Classification
222 /// \~english @par Type
224 /// \~english @see FrameworkunifiedPostEvent(CEventDataPtr), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
225 ///////////////////////////////////////////////////////////////////////////////////////////
226 ///////////////////////////////////////////////////////////////////////////////////////////
227 /// FrameworkunifiedPostEvent
228 /// This creates the default event data and sends the event to the active HSM state.
230 /// \param [in] f_uiEventId
233 /// \return EFrameworkunifiedStatus
234 /// EFrameworkunifiedStatus - Returns status of operation
236 EFrameworkunifiedStatus FrameworkunifiedPostEvent(UI_32 f_uiEventId);
238 ///////////////////////////////////////////////////////////////////////////////////////////
239 /// \ingroup CFrameworkunifiedHSM
240 ///////////////////////////////////////////////////////////////////////////////////////////
241 ///////////////////////////////////////////////////////////////////////////////////////////
242 /// FrameworkunifiedPostEvent
243 /// This sends the event to the active HSM state
245 /// \~english @par Brief
246 /// Add event data into event queue of state machine.
247 /// \~english @param f_pEventData
248 /// CEventDataPtr - Event data
249 /// \~english @retval eFrameworkunifiedStatusOK add succ
250 /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
251 /// \~english @par Prerequisite
252 /// - Self instance of CFrameworkunifiedHSM created.
253 /// \~english @par Change of internal state
255 /// \~english @par Conditions of processing failure
256 /// - Input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
257 /// - The pointer of post event list in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
258 /// - The pointer of active state in State machine is NULL. [eFrameworkunifiedStatusNullPointer]
259 /// - The name of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
260 /// \~english @par Detail
262 /// \~english @par Classification
264 /// \~english @par Type
266 /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
267 ///////////////////////////////////////////////////////////////////////////////////////////
268 EFrameworkunifiedStatus FrameworkunifiedPostEvent(CEventDataPtr f_pEventData);
270 ///////////////////////////////////////////////////////////////////////////////////////////
271 /// \ingroup CFrameworkunifiedHSM
272 /// \~english @par Brief
273 /// This is pure virtual function to be implemented by the derived classes. Statemachine
274 /// states and events created and connected in this interface.
275 /// \~english @param f_pEventData
276 /// PVOID - Event data
277 /// \~english @retval EFrameworkunifiedStatus Returns status of operation
278 /// \~english @par Prerequisite
279 /// - Self instance of CFrameworkunifiedHSM created.
280 /// \~english @par Change of internal state
282 /// \~english @par Conditions of processing failure
284 /// \~english @par Detail
286 /// \~english @par Classification
288 /// \~english @par Type
290 /// \~english @see none
291 ///////////////////////////////////////////////////////////////////////////////////////////
292 virtual EFrameworkunifiedStatus FrameworkunifiedCreate(PVOID f_pEventData = NULL) = 0;
294 ///////////////////////////////////////////////////////////////////////////////////////////
295 /// \ingroup CFrameworkunifiedHSM
296 ///////////////////////////////////////////////////////////////////////////////////////////
297 ///////////////////////////////////////////////////////////////////////////////////////////
298 /// FrameworkunifiedStart
299 /// This starts the state machine
301 /// \~english @par Brief
302 /// Start the state machine.
303 /// \~english @param f_pEventData
304 /// CEventDataPtr - Event data
305 /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
306 /// \~english @retval eFrameworkunifiedStatusNullPointer set null pointer
307 /// \~english @par Prerequisite
308 /// - Self instance of CFrameworkunifiedHSM created.
309 /// \~english @par Change of internal state
311 /// \~english @par Conditions of processing failure
312 // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
313 /// \~english @par Detail
315 /// \~english @par Classification
317 /// \~english @par Type
319 /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
320 ///////////////////////////////////////////////////////////////////////////////////////////
321 EFrameworkunifiedStatus FrameworkunifiedStart(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
323 ///////////////////////////////////////////////////////////////////////////////////////////
324 /// \ingroup CFrameworkunifiedHSM
325 /// \~english @par Brief
326 /// Stop the state machine.
327 /// \~english @param f_pEventData
328 /// CEventDataPtr - Event data
329 /// \~english @retval EFrameworkunifiedStatus
330 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
331 /// \~english @par Prerequisite
332 /// - Self instance of CFrameworkunifiedHSM created.
333 /// \~english @par Change of internal state
335 /// \~english @par Conditions of processing failure
336 // - Pointer of active state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
337 /// \~english @par Detail
338 /// Stop the state machine.\n
339 /// Release route state of state machine.\n
340 /// \~english @par Classification
342 /// \~english @par Type
344 /// \~english @see FrameworkunifiedPostEvent(UI_32), CEventData, FrameworkunifiedQueueEvent, ProcessEvent
345 ///////////////////////////////////////////////////////////////////////////////////////////
346 EFrameworkunifiedStatus FrameworkunifiedClose(CEventDataPtr f_pEventData = boost::make_shared<CEventData>(0));
348 ///////////////////////////////////////////////////////////////////////////////////////////
349 /// \ingroup CFrameworkunifiedHSM
350 ///////////////////////////////////////////////////////////////////////////////////////////
351 ///////////////////////////////////////////////////////////////////////////////////////////
352 /// FrameworkunifiedPrintAllStates
353 /// This prints all states and events associated with every state on console.
355 /// \~english @par Brief
356 /// Output log of all states and events name associated with every state.
358 /// \~english @retval EFrameworkunifiedStatus succ
359 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
360 /// \~english @par Prerequisite
361 /// - Self instance of CFrameworkunifiedHSM created.
362 /// \~english @par Change of internal state
364 /// \~english @par Conditions of processing failure
365 /// - Root state in state machine is NULL. [eFrameworkunifiedStatusNullPointer]
366 /// - Self instance of CFrameworkunifiedHSM does not create. [eFrameworkunifiedStatusNullPointer]
367 /// \~english @par Detail
368 /// print out log for connected state name and event name\n
369 /// following log will be print put
370 /// - super statemachine state name and self-statemachine state name
371 /// - all the event name on event list
372 /// - all the event on delayed event list
373 /// \~english @par Classification
375 /// \~english @par Type
378 ///////////////////////////////////////////////////////////////////////////////////////////
379 EFrameworkunifiedStatus FrameworkunifiedPrintAllStates();
381 ///////////////////////////////////////////////////////////////////////////////////////////
382 /// \ingroup CFrameworkunifiedHSM
383 /// \~english @par Brief
384 /// This connects the reaction to event and add event to child states then add child state
386 /// \~english @param f_pParentState
387 /// CFrameworkunifiedState* - Parent state pointer
388 /// \~english @param f_pChildState
389 /// CFrameworkunifiedState* - Child state pointer
390 /// \~english @param f_uiEventId
391 /// UI_32 - eventi id
392 /// \~english @param f_pReaction
393 /// CFrameworkunifiedReaction* - Reaction object for attaching to event
394 /// \~english @param f_eIsDefaultState
395 /// BOOL - Does has default state.(default: FALSE)
397 /// - TRUE : has default state
398 /// - FALSE: not has default state
399 /// \~english @param f_eIsDeferredEventType
400 /// BOOL - Does has the deferred event(default: FALSE)
402 /// - TRUE : has the deferred event
403 /// - FALSE: not has the deferred event
404 /// \~english @param f_strEventName
405 /// std::string - name of event(default:"")
406 /// \~english @retval eFrameworkunifiedStatusOK succ
407 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
408 /// \~english @par Prerequisite
409 /// - Self instance of CFrameworkunifiedHSM created.
410 /// \~english @par Change of internal state
412 /// \~english @par Conditions of processing failure
413 /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
414 /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
415 /// - Input parameter f_pReaction pointer is NULL. [eFrameworkunifiedStatusNullPointer]
416 /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
417 /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
418 /// \~english @par Detail
419 /// connect process with event and add the event to sub state.
420 /// and do following considering the event delay and event declare(f_eIsDeferredEventType)
421 /// - if TRUE : add the event as delayed event(add to event name list and delayed event list)
422 /// - if FALSE:add normal event and event(add to event name list and event list)
424 /// After adding an event to a child state, associate the child state with the parent state and
425 /// set the HSM state machine for the child state only if the parent state is a compound state.
426 /// The following associations are made depending on whether or not a default state is defined (f_eIsDefaultState).
427 /// - TRUE: Associates a child state as the default state with the parent state.
428 /// - FALSE: Associates a child state with a parent state as a normal state.
429 /// \~english @par Classification
431 /// \~english @par Type
433 /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
434 /// FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,BOOL)
435 ///////////////////////////////////////////////////////////////////////////////////////////
436 ///////////////////////////////////////////////////////////////////////////////////////////
437 /// FrameworkunifiedConnect
438 /// This connects the reaction to event and add event to child states then add child state
441 /// \param [in] f_pParentState
442 /// CFrameworkunifiedState* - Parent state
444 /// \param [in] f_pChildState
445 /// CFrameworkunifiedState* - Child state
447 /// \param [in] f_uiEventId
450 /// \param [in] f_pReaction
451 /// CFrameworkunifiedReaction* - Reaction object for attaching to event
453 /// \param [in] f_eIsDefaultState
454 /// BOOL - Defines if the state is default state
456 /// \param [in] f_eIsDeferredEventType
457 /// BOOL - defines if the event is deferred event
459 /// \param [in] f_strEventName
460 /// BOOL - Event name
462 /// \return EFrameworkunifiedStatus
463 /// EFrameworkunifiedStatus - Returns status of operation
465 EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
466 UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
467 BOOL f_eIsDefaultState = FALSE,
468 BOOL f_eIsDeferredEventType = FALSE,
469 std::string f_strEventName = "");
471 ///////////////////////////////////////////////////////////////////////////////////////////
472 /// \ingroup CFrameworkunifiedHSM
473 /// \~english @par Brief
474 /// This add child state to parent state.
475 /// \~english @param f_pParentState
476 /// CFrameworkunifiedState* - Parent state pointer
477 /// \~english @param f_pChildState
478 /// CFrameworkunifiedState* - Child state pointer
479 /// \~english @param f_eIsDefaultState
480 /// BOOL - Does has default state.(default: FALSE)
482 /// - TRUE : has default state
483 /// - FALSE: not has default state
484 /// \~english @retval eFrameworkunifiedStatusOK succ
485 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
486 /// \~english @par Prerequisite
487 /// - Self instance of CFrameworkunifiedHSM created.
488 /// \~english @par Change of internal state
490 /// \~english @par Conditions of processing failure
491 /// - Input parameter f_pParentState pointer is NULL.[eFrameworkunifiedStatusNullPointer]
492 /// - Input parameter f_pChildState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
493 /// - Input parameter f_pParentState does not instance. [eFrameworkunifiedStatusNullPointer]
494 /// - Input parameter f_pChildState does not instance. [eFrameworkunifiedStatusNullPointer]
495 /// \~english @par Detail
496 /// connect super state with sub state and set HSM state machine to sub state only when super state is compond
498 /// according to the default state define(f_eIsDefaultState),doing the connection below
499 /// - if TRUE: connect sub state as default state with super state
500 /// - if FALSE: connect sub state as normal state with super state
501 /// \~english @par Classification
503 /// \~english @par Type
505 /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,std::string,BOOL),
507 ///////////////////////////////////////////////////////////////////////////////////////////
508 ///////////////////////////////////////////////////////////////////////////////////////////
509 /// FrameworkunifiedConnect
510 /// This add child state to parent state.
512 /// \param [in] f_pParentState
513 /// CFrameworkunifiedState* - Parent state
515 /// \param [in] f_pChildState
516 /// CFrameworkunifiedState* - Child state
518 /// \param [in] f_eIsDefaultState
519 /// BOOL - Defines if the state is default state
521 /// \return EFrameworkunifiedStatus
522 /// EFrameworkunifiedStatus - Returns status of operation
524 EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pParentState, CFrameworkunifiedState *f_pChildState,
525 BOOL f_eIsDefaultState = FALSE);
527 ///////////////////////////////////////////////////////////////////////////////////////////
528 /// \ingroup CFrameworkunifiedHSM
529 ///////////////////////////////////////////////////////////////////////////////////////////
530 ///////////////////////////////////////////////////////////////////////////////////////////
531 /// FrameworkunifiedConnect
532 /// This connects the reaction to event and add event to states
534 /// \~english @par Brief
535 /// This connects the reaction to event and add event to states.
536 /// \~english @param f_pState
537 /// CFrameworkunifiedState* - pointer of state class
538 /// \~english @param f_uiEventId
539 /// UI_32 - eventi id
540 /// \~english @param f_pReaction
541 /// CFrameworkunifiedReaction* - Reaction object for attaching to event
542 /// \~english @param f_eIsDefaultState
543 /// BOOL - Does has default state.(default: FALSE)
545 /// - TRUE : has default state
546 /// - FALSE: not has default state
547 /// \~english @param f_eIsDeferredEventType
548 /// BOOL - Does has the deferred event(default: FALSE)
550 /// - TRUE : has the deferred event
551 /// - FALSE: not has the deferred event
552 /// \~english @param f_strEventName
553 /// std::string - name of event(default:"")
554 /// \~english @retval eFrameworkunifiedStatusOK succ
555 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
556 /// \~english @par Prerequisite
557 /// - Self instance of CFrameworkunifiedHSM created.
558 /// \~english @par Change of internal state
560 /// \~english @par Conditions of processing failure
561 /// - Input parameter f_pReaction pointer is NULL.[eFrameworkunifiedStatusNullPointer]
562 /// - Input parameter f_pState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
563 /// - Input parameter f_pState pointer does not instance. [eFrameworkunifiedStatusNullPointer]
564 /// \~english @par Detail
565 /// connect process with event and add event to sub state
566 /// following will be added according to whether delayed event or event define exsist
567 /// - if TRUE : add event as delayed event(add to event name list and delayed event list)
568 /// - if FALSE: add event as normal event(add to event name list and event list)
569 /// \~english @par Classification
571 /// \~english @par Type
573 /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
574 ///////////////////////////////////////////////////////////////////////////////////////////
575 EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pState, UI_32 f_uiEventId, CFrameworkunifiedReaction *f_pReaction,
576 std::string f_strEventName = "", BOOL f_eIsDeferredEventType = FALSE);
578 ///////////////////////////////////////////////////////////////////////////////////////////
579 /// \ingroup CFrameworkunifiedHSM
580 /// \~english @par Brief
581 /// This sets the givens state as root state in the state machine
582 /// \~english @param f_pRootState
583 /// CFrameworkunifiedState* - Root state
584 /// \~english @retval eFrameworkunifiedStatusOK succ
585 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer
586 /// \~english @par Prerequisite
587 /// - Self instance of CFrameworkunifiedHSM created.
588 /// \~english @par Change of internal state
590 /// \~english @par Conditions of processing failure
591 /// - Input parameter f_pRootState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
592 /// - Input parameter f_pRootState does not instance. [eFrameworkunifiedStatusNullPointer]
593 /// \~english @par Detail
594 /// set state(f_pRootState, which is designated as route state) to HSM state machine
595 /// set route state pointer(f_pRootState,which is set as parameter value)as pointer of
596 /// active state for member
597 /// parameter and routestate
598 /// \~english @par Classification
600 /// \~english @par Type
602 /// \~english @see FrameworkunifiedConnect(CFrameworkunifiedState*,CFrameworkunifiedState*,UI_32,CFrameworkunifiedReaction*,BOOL,BOOL,std::string)
603 ///////////////////////////////////////////////////////////////////////////////////////////
604 ///////////////////////////////////////////////////////////////////////////////////////////
605 /// FrameworkunifiedConnect
606 /// This sets the givens state as root state in the state machine
608 /// \param [in] f_pRootState
609 /// CFrameworkunifiedState* - Root state
611 /// \return EFrameworkunifiedStatus
612 /// EFrameworkunifiedStatus - Returns status of operation
614 EFrameworkunifiedStatus FrameworkunifiedConnect(CFrameworkunifiedState *f_pRootState);
616 ///////////////////////////////////////////////////////////////////////////////////////////
617 /// \ingroup CFrameworkunifiedHSM
618 /// \~english @par Brief
619 /// Set Composite state as HSM state OrthogonalState.
620 /// \~english @param f_pOrthogonalState
621 /// CFrameworkunifiedOrthogonalState* - Orthogonal state pointer
622 /// \~english @param f_pOrthogonalRegion
623 /// CFrameworkunifiedCompositeState* - Composite state pointer
624 /// \~english @retval eFrameworkunifiedStatusOK succ
625 /// \~english @retval eFrameworkunifiedStatusNullPointer null pointer(process failed)
626 /// \~english @par Prerequisite
627 /// - Self instance of CFrameworkunifiedHSM created.
628 /// \~english @par Change of internal state
630 /// \~english @par Conditions of processing failure
631 /// - Input parameter f_pOrthogonalState pointer is NULL. [eFrameworkunifiedStatusNullPointer]
632 /// - Input parameter f_pOrthogonalRegion pointer is NULL. [eFrameworkunifiedStatusNullPointer]
633 /// - Input parameter f_pOrthogonalState does not instance. [eFrameworkunifiedStatusNullPointer]
634 /// \~english @par Detail
635 /// Set Composite state as HSM state OrthogonalState.
636 /// \~english @par Classification
638 /// \~english @par Type
641 ///////////////////////////////////////////////////////////////////////////////////////////
642 ///////////////////////////////////////////////////////////////////////////////////////////
643 /// FrameworkunifiedConnect
644 /// This sets the givens state as root state in the state machine
646 /// \param [in] f_pOrthogonalState
647 /// CFrameworkunifiedOrthogonalState* - Orthogonal state
649 /// \param [in] f_pOrthogonalRegion
650 /// CFrameworkunifiedCompositeState* - Orthogonal region
652 /// \return EFrameworkunifiedStatus
653 /// EFrameworkunifiedStatus - Returns status of operation
655 EFrameworkunifiedStatus FrameworkunifiedConnectOrthogonal(CFrameworkunifiedOrthogonalState *f_pOrthogonalState,
656 CFrameworkunifiedCompositeState *f_pOrthogonalRegion);
658 ///////////////////////////////////////////////////////////////////////////////////////////
659 /// \ingroup CFrameworkunifiedHSM
660 /// \~english @par Brief
661 /// This interface returns the application handle
662 /// \~english @param none
663 /// \~english @retval HANDLE application handle
664 /// \~english @par Prerequisite
665 /// - Self instance of CFrameworkunifiedHSM created.
666 /// \~english @par Change of internal state
668 /// \~english @par Conditions of processing failure
670 /// \~english @par Detail
672 /// \~english @par Classification
674 /// \~english @par Type
676 /// \~english @see none
677 ///////////////////////////////////////////////////////////////////////////////////////////
678 HANDLE FrameworkunifiedGetAppHandle();
680 ///////////////////////////////////////////////////////////////////////////////////////////
681 /// \ingroup CFrameworkunifiedHSM
682 /// \~english @par Brief
683 /// Output statemachine information into XML file.
684 /// \~english @param none
685 /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
686 /// \~english @par Prerequisite
687 /// - Self instance of CFrameworkunifiedHSM created.
688 /// \~english @par Change of internal state
690 /// \~english @par Conditions of processing failure
692 /// \~english @par Detail
694 /// \~english @par Classification
696 /// \~english @par Type
698 /// \~english @see none
699 ///////////////////////////////////////////////////////////////////////////////////////////
700 EFrameworkunifiedStatus FrameworkunifiedPrintXML();
702 ///////////////////////////////////////////////////////////////////////////////////////////
703 /// \ingroup CFrameworkunifiedHSM
704 /// \~english @par Brief
705 /// Push the event in the post event list.
706 /// \~english @param f_pEventData
707 /// CEventDataPtr - pointer of event data
708 /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
709 /// eFrameworkunifiedStatusNullPointer NULL pointer
710 /// \~english @par Prerequisite
711 /// - Self instance of CFrameworkunifiedHSM created.
712 /// \~english @par Change of internal state
714 /// \~english @par Conditions of processing failure
715 /// - If input parameter f_pEventData is NULL. [eFrameworkunifiedStatusNullPointer]
716 /// - If member variable m_pActiveState is NULL. [eFrameworkunifiedStatusNullPointer]
717 /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
718 /// \~english @par Detail
720 /// \~english @par Classification
722 /// \~english @par Type
724 /// \~english @see none
725 ///////////////////////////////////////////////////////////////////////////////////////////
726 EFrameworkunifiedStatus FrameworkunifiedQueueEvent(CEventDataPtr f_pEventData);
728 ///////////////////////////////////////////////////////////////////////////////////////////
729 /// \ingroup CFrameworkunifiedHSM
730 /// \~english @par Brief
731 /// Remove the all events of eventId f_uiEventId from event queue of statemachine.
732 /// \~english @param f_pEventData
733 /// const UI_32 - event id
734 /// \~english @retval EFrameworkunifiedStatus eFrameworkunifiedStatusOK succ
735 /// eFrameworkunifiedStatusInvldID Not found event id
736 /// eFrameworkunifiedStatusNullPointer NULL pointer
737 /// \~english @par Prerequisite
738 /// - Self instance of CFrameworkunifiedHSM created.
739 /// \~english @par Change of internal state
741 /// \~english @par Conditions of processing failure
742 /// - If not find event id. [eFrameworkunifiedStatusInvldID]
743 /// - If member variable m_pPostEventList is NULL. [eFrameworkunifiedStatusNullPointer]
744 /// \~english @par Detail
746 /// \~english @par Classification
748 /// \~english @par Type
750 /// \~english @see none
751 ///////////////////////////////////////////////////////////////////////////////////////////
752 EFrameworkunifiedStatus RemoveEventFromPostedEventQueue(const UI_32 f_uiEventId);
754 UI_32 m_uiCurrentEvent;
756 /// Application handle
760 ///////////////////////////////////////////////////////////////////////////////////////////
761 /// ProcessEventQueue
762 /// Gets the event from StateMachine events list and post it.
764 /// \return EFrameworkunifiedStatus
765 /// EFrameworkunifiedStatus - Returns status of operation
766 ///////////////////////////////////////////////////////////////////////////////////////////
767 EFrameworkunifiedStatus ProcessEventQueue();
769 ///////////////////////////////////////////////////////////////////////////////////////////
771 /// Processes the event posted to the statemachine
773 /// \param [in] f_pEventData
774 /// CEventDataPtr - Event data
776 /// \return EFrameworkunifiedStatus
777 /// EFrameworkunifiedStatus - Returns status of operation
778 ///////////////////////////////////////////////////////////////////////////////////////////
779 EFrameworkunifiedStatus ProcessEvent(CEventDataPtr f_pEventData);
781 /// pointer to the active state object
782 CFrameworkunifiedState *m_pActiveState;
784 /// pointer to the root state object
785 CFrameworkunifiedState *m_pRootState;
787 std::vector<CEventDataPtr> *m_pPostEventList;
789 BOOL m_bIsTransitioning;
792 #endif // __FRAMEWORKUNIFIED_NATIVESERVICES_NATIVESERVICES_INC_FRAMEWORK_STATEMACHINE_FRAMEWORKUNIFIED_SM_HSM_H__ // NOLINT (build/header_guard)