CORDET Framework - C2 Implementation
|
Definition of the InManager component. More...
Go to the source code of this file.
Functions | |
FwSmDesc_t | CrFwInManagerMake (CrFwInstanceId_t inManagerId) |
Factory function to retrieve the i-th InManager State Machine instance. More... | |
CrFwBool_t | CrFwInManagerLoad (FwSmDesc_t smDesc, FwSmDesc_t inCmp) |
Load a new InReport or InCommand into the InManager. More... | |
CrFwCounterU1_t | CrFwInManagerGetNOfPendingInCmp (FwSmDesc_t smDesc) |
Return the number of InReport or InCommands currently in the PCRL of an InManager. More... | |
CrFwCounterU2_t | CrFwInManagerGetNOfLoadedInCmp (FwSmDesc_t smDesc) |
Return the number of InReport or InCommands successfully loaded since the InManager was last reset. More... | |
CrFwCounterU1_t | CrFwInManagerGetPCRLSize (FwSmDesc_t smDesc) |
Return the size of the PCRL of an InManager. More... | |
Definition of the InManager component.
The InManager component is responsible for maintaining a list of pending InReports (see CrFwInRep.h
) and InCommands (see CrFwInCmd.h
) and for repeatedly executing them until they are either aborted or terminated.
The list of pending InReports or InCommands is called the Pending Command/Report List or PCRL. The PCRL has a fixed size which is defined statically in CrFwInManagerUserPar.h
.
The InManager is defined as an extension of the Base Component (see CrFwBaseCmp.h
). It uses the Execution Procedure of the Base Component to process the pending InReport and InCommands. The InManager component processes the pending InReports or InCommands by sending them an Execute command. After each Execute command, the state of the pending item is reported to the InRegistry (see CrFwInRegistry.h
). InReports or InCommands which have been aborted or have terminated are removed from the PCRL and are returned to the InFactory. The Execution Procedure of the InManager is shown in the figure below.
Mode of Use of an InManager Component
The configuration of the InManager components is defined statically in CrFwInManagerUserPar.h
.
An InManager component is created with function CrFwInManagerMake
. After being created, the InManager must be initialized and reset. This is done with functions CrFwCmpInit
and CrFwCmpReset
. Nominally, after being initialized and reset the InManager State Machine should be in state CONFIGURED (this can be checked by verifying that function FwSmGetCurState
returns CR_FW_BASE_STATE_CONFIGURED).
Note that an application can have any number of InManagers.
An InManager offers a Load operation (CrFwInManagerLoad
) through which an InReport or InCommand can be added to the PCRL. This operation is normally called by the InLoader (see CrFwInLoader.h
).
Note that there is no mechanism to “unload” a pending InReport or InCommand. The InManager autonomously returns an InReport or InCommand to its factory when the component has terminated or has been aborted. InReports are considered to have been terminated after they are executed once. InCommands are terminated if they are in state TERMINATED and they are aborted if they are in state ABORTED.
After an InManager has been configured, it can be executed by means of function FwSmExecute
. Execution of an InManager causes its Execution Procedure (see figure below) to be executed.
When an InManager is reset or shutdown, its PCRL is reset (all pending InCommands and InReports are cleared and returned to theirs factories).
This file is part of the CORDET Framework.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
For information on alternative licensing, please contact P&P Software GmbH.
Definition in file CrFwInManager.h.
CrFwCounterU2_t CrFwInManagerGetNOfLoadedInCmp | ( | FwSmDesc_t | smDesc | ) |
Return the number of InReport or InCommands successfully loaded since the InManager was last reset.
smDesc | the descriptor of the InManager State Machine. |
Definition at line 301 of file CrFwInManager.c.
CrFwCounterU1_t CrFwInManagerGetNOfPendingInCmp | ( | FwSmDesc_t | smDesc | ) |
Return the number of InReport or InCommands currently in the PCRL of an InManager.
smDesc | the descriptor of the InManager State Machine. |
Definition at line 294 of file CrFwInManager.c.
CrFwCounterU1_t CrFwInManagerGetPCRLSize | ( | FwSmDesc_t | smDesc | ) |
Return the size of the PCRL of an InManager.
smDesc | the descriptor of the InManager State Machine. |
Definition at line 308 of file CrFwInManager.c.
CrFwBool_t CrFwInManagerLoad | ( | FwSmDesc_t | smDesc, |
FwSmDesc_t | inCmp | ||
) |
Load a new InReport or InCommand into the InManager.
The behaviour implemented by this function is shown in the activity diagram below. If the PCRL is not full, the function identifies a free position in the PCRL where to store the InReport/InCommand. This function adds InReport/InCommand to the PCRL. The PCRL is flushed when the InManager is executed (i.e. it is flushed by function InManagerExecAction
). The algorithms to identify a free position in the PCRL and to process the PCRL entries when the InManager is executed are optimized for a situation where multiple load operations are performed before the InManager is executed.
Additionally, these algorithms guarantee the following ordering constraint. Let InReports/InCommands C1 to Cn be successfully loaded into an InManager through a sequence of calls to function CrFwInManagerLoad
and assume that this sequence of load operations is not interrupted by an execution of the InManager. Under these conditions, when the InManager is executed next, the InReport/InCommand C1 to Cn will be processed in the order in which they have been loaded.
The implementation of function CrFwInManagerLoad
is based on the internal variable freePos
. This variable has the following characteristics:
freePos
either points to the next free position in the PCRL or is equal to the PCRL size if the PCRL is full;smDesc | the descriptor of the InManager State Machine. |
inCmp | the descriptor of the InCommand or InReport to be loaded in the InManager |
Definition at line 189 of file CrFwInManager.c.
FwSmDesc_t CrFwInManagerMake | ( | CrFwInstanceId_t | inManagerId | ) |
Factory function to retrieve the i-th InManager State Machine instance.
The first time this function is called with a certain value of the argument i, it creates the i-th InManager State Machine instance. Subsequent calls returns the same instance.
The InManager identifier i must be in the range: [0, CR_FW_NOF_INMANAGER
-1]. If the identifier is out of range, the function returns NULL and sets the application error code to: crInManagerIllId
.
The first time this function is called with a certain value of i, it returns an InManager State Machine which has been started but which still needs to be initialized and configured.
inManagerId | the identifier of the InManager |
Definition at line 96 of file CrFwInManager.c.