CORDET Framework - C2 Implementation
|
Implementation of OutRegistry component. More...
Go to the source code of this file.
Data Structures | |
struct | CrFwTrackedState_t |
An instance of this type holds the information about an incoming command or report which is being tracked by the InRegistry. More... | |
Functions | |
static void | OutRegistryInitAction (FwPrDesc_t initPr) |
Initialization action for OutRegistry. More... | |
static void | OutRegistryConfigAction (FwPrDesc_t resetPr) |
Configuration action for OutRegistry. More... | |
static void | OutRegistryShutdownAction (FwSmDesc_t smDesc) |
Shutdown action for OutRegistry. More... | |
FwSmDesc_t | CrFwOutRegistryMake () |
Factory function for the singleton instance of the OutRegistry. More... | |
CrFwServType_t | CrFwOutRegistryGetServType (CrFwCmdRepIndex_t cmdRepIndex) |
Get the service type of the argument command or report index. More... | |
CrFwServSubType_t | CrFwOutRegistryGetServSubType (CrFwCmdRepIndex_t cmdRepIndex) |
Get the service sub-type of the argument command or report index. More... | |
CrFwDiscriminant_t | CrFwOutRegistryGetUpperDiscriminant (CrFwCmdRepIndex_t cmdRepIndex) |
Get the upper bound of the argument command or report index. More... | |
CrFwDiscriminant_t | CrFwOutRegistryGetLowerDiscriminant (CrFwCmdRepIndex_t cmdRepIndex) |
Get the lower bound of the argument command or report index. More... | |
CrFwBool_t | CrFwOutRegistryIsDiscriminantEnabled (CrFwCmdRepIndex_t cmdRepIndex, CrFwDiscriminant_t disc) |
Get the enable status of a discriminant in the argument command or report index. More... | |
CrFwCmdRepIndex_t | CrFwOutRegistryGetCmdRepIndex (CrFwServType_t servType, CrFwServSubType_t servSubType) |
Get the index corresponding to the argument [service type, service sub-type] of an out-going command or report. More... | |
void | CrFwOutRegistrySetEnable (CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t discriminant, CrFwBool_t isEnabled) |
Set the enable state of a set of out-going commands or reports. More... | |
CrFwBool_t | CrFwOutRegistryIsEnabled (FwSmDesc_t outCmp) |
Query the enable status of an out-going command or report. More... | |
void | CrFwOutRegistryStartTracking (FwSmDesc_t outCmp) |
Ask the OutRegistry to start tracking an out-going command or report. More... | |
void | CrFwOutRegistryUpdateState (FwSmDesc_t outCmp, CrFwOutRegistryCmdRepState_t newState) |
Ask the OutRegistry to update the state of an out-going command or report. More... | |
CrFwOutRegistryCmdRepState_t | CrFwOutRegistryGetState (CrFwInstanceId_t cmdRepId) |
Query the OutRegistry for the state of an out-going command or report. More... | |
Variables | |
static CrFwServDesc_t | servDesc [CR_FW_OUTREGISTRY_NSERV] = CR_FW_OUTREGISTRY_INIT_SERV_DESC |
Array of service descriptors (see CrFwServDesc_t ). | |
static CrFwTrackedState_t | cmdRepState [CR_FW_OUTREGISTRY_N] |
Array to track the state of out-going commands or reports. | |
static CrFwTrackingIndex_t | cmdRepStateIndex = 0 |
The index of the most recent entry in cmdRepState . | |
static FwSmDesc_t | outRegistry = NULL |
The OutRegistry singleton. | |
static CrFwCmpData_t | outRegistryData |
The data for the OutRegistry singleton. | |
Implementation of OutRegistry component.
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 CrFwOutRegistry.c.
CrFwCmdRepIndex_t CrFwOutRegistryGetCmdRepIndex | ( | CrFwServType_t | servType, |
CrFwServSubType_t | servSubType | ||
) |
Get the index corresponding to the argument [service type, service sub-type] of an out-going command or report.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. This function returns the index corresponding to a specific [service type, service sub-type] pair. If either of the two arguments has an illegal value (i.e. if it has a value which does not correspond to any [service type, service sub-type] declared in the initializer of the service descriptor CR_FW_OUTREGISTRY_INIT_SERV_DESC
.), the function returns CR_FW_OUTREGISTRY_NSERV.
servType | the service type |
servSubType | the service sub-type |
Definition at line 167 of file CrFwOutRegistry.c.
CrFwDiscriminant_t CrFwOutRegistryGetLowerDiscriminant | ( | CrFwCmdRepIndex_t | cmdRepIndex | ) |
Get the lower bound of the argument command or report index.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. This function returns the lower discriminant value corresponding to a certain index value. If the index value is out of range (i.e. if it is greater than CR_FW_OUTREGISTRY_NSERV
-1), the behaviour of this function is undefined.
cmdRepIndex | the command or report index |
Definition at line 156 of file CrFwOutRegistry.c.
CrFwServSubType_t CrFwOutRegistryGetServSubType | ( | CrFwCmdRepIndex_t | cmdRepIndex | ) |
Get the service sub-type of the argument command or report index.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. This function returns the service sub-type corresponding to a certain index value. If the index value is out of range (i.e. if it is greater than CR_FW_OUTREGISTRY_NSERV
-1), the behaviour of this function is undefined.
cmdRepIndex | the command or report index |
Definition at line 146 of file CrFwOutRegistry.c.
CrFwServType_t CrFwOutRegistryGetServType | ( | CrFwCmdRepIndex_t | cmdRepIndex | ) |
Get the service type of the argument command or report index.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. This function returns the service type corresponding to a certain index value. If the index value is out of range (i.e. if it is greater than CR_FW_OUTREGISTRY_NSERV
-1), the behaviour of this function is undefined.
cmdRepIndex | the command or report index |
Definition at line 141 of file CrFwOutRegistry.c.
CrFwOutRegistryCmdRepState_t CrFwOutRegistryGetState | ( | CrFwInstanceId_t | cmdRepId | ) |
Query the OutRegistry for the state of an out-going command or report.
If the specified index does not correspond to any command or report being tracked by the OutRegistry, a value of crOutRegistryNotTracked
is returned. This function searches all locations in the InRegistry in sequence until it finds the out-going command or report.
cmdRepId | the instance identifier of the out-going command or report. |
crOutRegistryNotTracked
if the command or report is not tracked) Definition at line 307 of file CrFwOutRegistry.c.
CrFwDiscriminant_t CrFwOutRegistryGetUpperDiscriminant | ( | CrFwCmdRepIndex_t | cmdRepIndex | ) |
Get the upper bound of the argument command or report index.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. This function returns the upper discriminant value corresponding to a certain index value. If the index value is out of range (i.e. if it is greater than CR_FW_OUTREGISTRY_NSERV
-1), the behaviour of this function is undefined.
cmdRepIndex | the command or report index |
Definition at line 151 of file CrFwOutRegistry.c.
CrFwBool_t CrFwOutRegistryIsDiscriminantEnabled | ( | CrFwCmdRepIndex_t | cmdRepIndex, |
CrFwDiscriminant_t | disc | ||
) |
Get the enable status of a discriminant in the argument command or report index.
For out-going commands or reports the index uniquely identifies a pair: [service type, service sub-type]. For each [service type, service sub-type], the OutRegistry stores the range of discriminant values and stores the current enable type of each discriminant value (the boudanries of the range are returned by functions CrFwOutRegistryGetUpperDiscriminant
and CrFwOutRegistryGetLowerDiscriminant
). This function returns the enable status of a discriminant in that range.
If the index value is out of range (i.e. if it is greater than CR_FW_OUTREGISTRY_NSERV
-1) or if the argument discriminant is out of range (i.e. if it is outside the interval [l,u] where l and u are the return values of CrFwOutRegistryGetUpperDiscriminant
and CrFwOutRegistryGetLowerDiscriminant
), or if there are no discriminants associated to the argument command or report index, the behaviour of this function is undefined.
cmdRepIndex | the command or report index |
disc | the value of the discriminant |
Definition at line 161 of file CrFwOutRegistry.c.
CrFwBool_t CrFwOutRegistryIsEnabled | ( | FwSmDesc_t | outCmp | ) |
Query the enable status of an out-going command or report.
If the argument does not represent an out-going command or report (i.e. if it is not a component of type OutComponent), the behaviour of the function is undefined. The enable state of an out-going command or report is determined by running the Enable State Determination Procedure shown in the figure.
outCmp | the out-going command or report as an OutComponent |
Definition at line 257 of file CrFwOutRegistry.c.
FwSmDesc_t CrFwOutRegistryMake | ( | ) |
Factory function for the singleton instance of the OutRegistry.
The first time this function is called, it creates and configures the OutRegistry. Subsequent calls returns the same singleton instance. The first time this function is called, it returns the OutRegistry in state CREATED.
If the creation or the configuration of the OutRegistry fails, the function returns NULL.
Definition at line 97 of file CrFwOutRegistry.c.
void CrFwOutRegistrySetEnable | ( | CrFwServType_t | servType, |
CrFwServSubType_t | servSubType, | ||
CrFwDiscriminant_t | discriminant, | ||
CrFwBool_t | isEnabled | ||
) |
Set the enable state of a set of out-going commands or reports.
The enable state of out-going command and reports can be controlled at three levels:
This function allows all three enable levels to be set according to the logic in the activity diagram shown below. Use of illegal values for the function parameters results in the application error code being set to: crIllServType
(if the service type is illegal), or to crIllServSubType
(if the service sub-type is illegal), or to crIllDiscriminant
(if the discriminant value is illegal). A service type or sub-type or a discriminant value are illegal if they are not covered in the list of [type, sub-types, discriminant] in the CrFwOutRegistryUserPar.h
(see CR_FW_OUTREGISTRY_INIT_SERV_DESC
).
servType | the service type |
servSubType | the service type |
discriminant | the discriminant |
isEnabled | the enable state (1 means enabled and 0 means disabled) |
Definition at line 193 of file CrFwOutRegistry.c.
void CrFwOutRegistryStartTracking | ( | FwSmDesc_t | outCmp | ) |
Ask the OutRegistry to start tracking an out-going command or report.
The OutRegistry tracks the state of the last N out-going command or reports to have been loaded with this function. Initially, when this function is called, the out-going command or report is placed in state PENDING. This function runs the procedure in the left-hand side of the activity diagram shown in the figure.
outCmp | the out-going command or report to be tracked |
Definition at line 278 of file CrFwOutRegistry.c.
void CrFwOutRegistryUpdateState | ( | FwSmDesc_t | outCmp, |
CrFwOutRegistryCmdRepState_t | newState | ||
) |
Ask the OutRegistry to update the state of an out-going command or report.
If the argument component is not tracked by the OutRegistry (perhaps because too many OutComponents have been added to the list of tracked components), nothing is done. This function runs the procedure in the right-hand side of the activity diagram shown in the figure.
outCmp | the out-going command or report to be tracked |
newState | the new state of the out-going command or report |
Definition at line 294 of file CrFwOutRegistry.c.
|
static |
Configuration action for OutRegistry.
This function sets the enable state of all service types, sub-types and discriminant to "enabled" and resets the queue of tracked commands and reports. The outcome of the configuration action is always: "successful"
resetPr | the Configuration Procedure of the OutRegistry |
Definition at line 357 of file CrFwOutRegistry.c.
|
static |
Initialization action for OutRegistry.
This function allocates the memory for the OutRegistry data structures and initializes all data structures which depend on the set of services supported by the application. The outcome of the initialization action is always "success". The situation where the memory allocation for the OutRegistry data structures fails is not handled and will result in undefined behaviour (probably a run-time exception).
initPr | the Initialization Procedure of the OutRegistry |
Definition at line 331 of file CrFwOutRegistry.c.
|
static |
Shutdown action for OutRegistry.
This function sets the enable state of all service types, sub-types and discriminant to "enabled" and resets the queue of tracked commands and reports. This function also releases the memory allocated when the OutRegistry was initialized.
smDesc | the OutRegistry state machine |
Definition at line 382 of file CrFwOutRegistry.c.