CORDET Framework - C2 Implementation
|
Definition of the utility functions for the CORDET Framework. More...
Go to the source code of this file.
Functions | |
CrFwAppErrCode_t | CrFwGetAppErrCode () |
Return the value of the application error code. More... | |
void | CrFwSetAppErrCode (CrFwAppErrCode_t errCode) |
Set the value of the application error code (see CrFwGetAppErrCode ). More... | |
void | CrFwSetPrOutcome (FwPrDesc_t prDesc, CrFwOutcome_t outcome) |
Convenience function to set the outcome field of the component data of a procedure. More... | |
FwPrBool_t | CrFwIsPrOutcomeOne (FwPrDesc_t prDesc) |
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true" or "success"). More... | |
void | CrFwSetSmOutcome (FwSmDesc_t smDesc, CrFwOutcome_t outcome) |
Convenience function to set the outcome of the last check or action of a state machine. More... | |
CrFwOutcome_t | CrFwGetSmOutcome (FwSmDesc_t smDesc) |
Convenience function to get the outcome of the last check or action of a state machine. More... | |
FwSmBool_t | CrFwIsSmOutcomeZero (FwSmDesc_t smDesc) |
Convenience function to check whether the outcome of the last check or action is equal to 0 ("false"). More... | |
FwSmBool_t | CrFwIsSmOutcomeOne (FwSmDesc_t smDesc) |
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true"). More... | |
FwSmBool_t | CrFwIsSmOutcomeTwo (FwSmDesc_t smDesc) |
Convenience function to check whether the outcome of the last check or action is equal to 2. More... | |
FwPrBool_t | CrFwWaitOnePrCycle (FwPrDesc_t prDesc) |
Convenience function which returns true when a procedure has spent more than one cycle in the current action node. More... | |
CrFwBool_t | CrFwPrCheckAlwaysTrue (FwPrDesc_t prDesc) |
Convenience function to be used in a procedure as default implementation for a check which always returns true. More... | |
CrFwBool_t | CrFwSmCheckAlwaysTrue (FwSmDesc_t smDesc) |
Convenience function to be used in a state machine as default implementation for a check which always returns true. More... | |
CrFwBool_t | CrFwSmCheckAlwaysFalse (FwSmDesc_t smDesc) |
Convenience function to be used in a state machine as default implementation for a check which always returns false. More... | |
void | CrFwPrEmptyAction (FwPrDesc_t prDesc) |
Convenience function to be used in a procedure as default implementation for an action which returns without doing anything. More... | |
void | CrFwSmEmptyAction (FwSmDesc_t smDesc) |
Convenience function to be used in a state machine as default implementation for an action which returns without doing anything. More... | |
void | CrFwSmSuccessAction (FwSmDesc_t smDesc) |
Convenience function to be used in a state machine as default implementation for an action which sets the action outcome to 1 (corresponding to 'success') and then returns. More... | |
CrFwCmdRepKindIndex_t | CrFwFindCmdRepKindIndex (CrFwCmdRepKindKey_t *cmdRepKindArray, CrFwCmdRepKindIndex_t length, CrFwCmdRepKindKey_t targetKey) |
Convenience function to retrieve the index of an array where a certain target value is located. More... | |
Definition of the utility functions for the CORDET Framework.
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 CrFwUtilityFunctions.h.
CrFwCmdRepKindIndex_t CrFwFindCmdRepKindIndex | ( | CrFwCmdRepKindKey_t * | cmdRepKindArray, |
CrFwCmdRepKindIndex_t | length, | ||
CrFwCmdRepKindKey_t | targetKey | ||
) |
Convenience function to retrieve the index of an array where a certain target value is located.
This function is used by the InFactory (see CrFwInFactory.h
) and OutFactory (see CrFwOutFactory.h
). The InFactory and OutFactory maintain arrays which store sets of command and report kinds in increasing order. A command or report kind is encoded through a key. This function finds the index corresponding to a given target key value.
cmdRepKindArray | array of key values (the key values must be stored in increasing order) |
length | length of the array of key values |
targetKey | the key value that is searched |
Definition at line 136 of file CrFwUtilityFunctions.c.
CrFwAppErrCode_t CrFwGetAppErrCode | ( | ) |
Return the value of the application error code.
The application error code is set by a framework function when when either of the following situations arises:
Nominally, the application error code should be equal to: crNoAppErr
. If the application error code has a different value, then it is likely that the framework is not configured as the user intended.
Definition at line 40 of file CrFwUtilityFunctions.c.
CrFwOutcome_t CrFwGetSmOutcome | ( | FwSmDesc_t | smDesc | ) |
Convenience function to get the outcome of the last check or action of a state machine.
This function assumes that the data attached to the state machine descriptor is a pointer to type CrFwCmpData
). This type is a data structure which includes an 'outcome' field and this function sets this field to the value of the argument outcome
. Each state machine is free to set its own convention for the interpretation of the outcome. For state machines representing commands and reports, a value of 1 means "success", and a value different from 1 means "failure". In the latter case, the value of the outcome is the failure code describing the reason for the failure.
smDesc | the state machine descriptor |
Definition at line 68 of file CrFwUtilityFunctions.c.
FwPrBool_t CrFwIsPrOutcomeOne | ( | FwPrDesc_t | prDesc | ) |
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true" or "success").
This function returns "true" if and only if the outcome field of the component data (see CrFwCmpData
) is equal to 1. This function is intended to be used as a guard in a procedure.
prDesc | the procedure descriptor |
Definition at line 56 of file CrFwUtilityFunctions.c.
FwSmBool_t CrFwIsSmOutcomeOne | ( | FwSmDesc_t | smDesc | ) |
Convenience function to check whether the outcome of the last check or action is equal to 1 ("true").
This function returns "true" if and only if the outcome field of the component data (see CrFwCmpData
) is equal to 1. This function is intended to be used as a guard in a state machine.
smDesc | the state machine descriptor |
Definition at line 80 of file CrFwUtilityFunctions.c.
FwSmBool_t CrFwIsSmOutcomeTwo | ( | FwSmDesc_t | smDesc | ) |
Convenience function to check whether the outcome of the last check or action is equal to 2.
This function returns "true" if and only if the outcome field of the component data (see CrFwCmpData
) is equal to 2. This function is intended to be used as a guard in a state machine.
smDesc | the state machine descriptor |
Definition at line 86 of file CrFwUtilityFunctions.c.
FwSmBool_t CrFwIsSmOutcomeZero | ( | FwSmDesc_t | smDesc | ) |
Convenience function to check whether the outcome of the last check or action is equal to 0 ("false").
This function returns "true" if and only if the outcome field of the component data (see CrFwCmpData
) is equal to 0. This function is intended to be used as a guard in a state machine.
smDesc | the state machine descriptor |
Definition at line 74 of file CrFwUtilityFunctions.c.
CrFwBool_t CrFwPrCheckAlwaysTrue | ( | FwPrDesc_t | prDesc | ) |
Convenience function to be used in a procedure as default implementation for a check which always returns true.
prDesc | the procedure descriptor |
Definition at line 100 of file CrFwUtilityFunctions.c.
void CrFwPrEmptyAction | ( | FwPrDesc_t | prDesc | ) |
Convenience function to be used in a procedure as default implementation for an action which returns without doing anything.
prDesc | the procedure descriptor |
Definition at line 118 of file CrFwUtilityFunctions.c.
void CrFwSetAppErrCode | ( | CrFwAppErrCode_t | errCode | ) |
Set the value of the application error code (see CrFwGetAppErrCode
).
errCode | the application error code |
Definition at line 45 of file CrFwUtilityFunctions.c.
void CrFwSetPrOutcome | ( | FwPrDesc_t | prDesc, |
CrFwOutcome_t | outcome | ||
) |
Convenience function to set the outcome field of the component data of a procedure.
This function assumes that the data attached to the procedure descriptor is a pointer to type CrFwCmpData
). This type is a data structure which includes an 'outcome' field and this function sets this field to the value of the argument outcome
. Each procedure is free to set its own convention for the interpretation of the outcome but, for procedures defined at CORDET Framework level, a value of 0 means "failure" and a value of 1 means "success".
prDesc | the procedure descriptor |
outcome | the value of the procedure outcome |
Definition at line 50 of file CrFwUtilityFunctions.c.
void CrFwSetSmOutcome | ( | FwSmDesc_t | smDesc, |
CrFwOutcome_t | outcome | ||
) |
Convenience function to set the outcome of the last check or action of a state machine.
This function assumes that the data attached to the state machine descriptor is a pointer to type CrFwCmpData
). This type is a data structure which includes an 'outcome' field and this function sets this field to the value of the argument outcome
. Each state machine is free to set its own convention for the interpretation of the outcome. For state machines representing commands and reports, a value of 1 means "success", and a value different from 1 means "failure". In the latter case, the value of the outcome is the failure code describing the reason for the failure.
smDesc | the state machine descriptor |
outcome | the value of the state machine outcome |
Definition at line 62 of file CrFwUtilityFunctions.c.
CrFwBool_t CrFwSmCheckAlwaysFalse | ( | FwSmDesc_t | smDesc | ) |
Convenience function to be used in a state machine as default implementation for a check which always returns false.
smDesc | the state machine descriptor |
Definition at line 112 of file CrFwUtilityFunctions.c.
CrFwBool_t CrFwSmCheckAlwaysTrue | ( | FwSmDesc_t | smDesc | ) |
Convenience function to be used in a state machine as default implementation for a check which always returns true.
smDesc | the state machine descriptor |
Definition at line 106 of file CrFwUtilityFunctions.c.
void CrFwSmEmptyAction | ( | FwSmDesc_t | smDesc | ) |
Convenience function to be used in a state machine as default implementation for an action which returns without doing anything.
smDesc | the state machine descriptor |
Definition at line 124 of file CrFwUtilityFunctions.c.
void CrFwSmSuccessAction | ( | FwSmDesc_t | smDesc | ) |
Convenience function to be used in a state machine as default implementation for an action which sets the action outcome to 1 (corresponding to 'success') and then returns.
smDesc | the state machine descriptor |
Definition at line 130 of file CrFwUtilityFunctions.c.
FwPrBool_t CrFwWaitOnePrCycle | ( | FwPrDesc_t | prDesc | ) |
Convenience function which returns true when a procedure has spent more than one cycle in the current action node.
This function can be used as a guard in a procedure where there is a need to express the fact that the procedure should remain only one cycle in a node: the guard is false after the action node has been executed the first time and becomes true after it has been executed the second time.
prDesc | the procedure descriptor |
Definition at line 92 of file CrFwUtilityFunctions.c.