summaryrefslogtreecommitdiff
path: root/NodeStateMachineStub/NodeStateMachine.cpp
diff options
context:
space:
mode:
authorMonika Forstner <Monika_Forstner@mentor.com>2020-09-16 10:20:03 +0200
committerMonika Forstner <Monika_Forstner@mentor.com>2020-09-16 10:50:27 +0200
commit2fb502b4bc23aa13fee1db3395b3cae5e34cc871 (patch)
treed9cd2c64522f190500dc53291b4fbcf5100b9720 /NodeStateMachineStub/NodeStateMachine.cpp
parent253d10aada6bf5cdfe307aaff55363f08194c85e (diff)
downloadnode-state-manager-release_NSM_CommonAPI.tar.gz
NSM Release 3.0release_NSM_CommonAPI
Diffstat (limited to 'NodeStateMachineStub/NodeStateMachine.cpp')
-rw-r--r--NodeStateMachineStub/NodeStateMachine.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/NodeStateMachineStub/NodeStateMachine.cpp b/NodeStateMachineStub/NodeStateMachine.cpp
new file mode 100644
index 0000000..00de5fa
--- /dev/null
+++ b/NodeStateMachineStub/NodeStateMachine.cpp
@@ -0,0 +1,140 @@
+/**********************************************************************************************************************
+*
+* Copyright (C) 2012 Continental Automotive Systems, Inc.
+*
+* Author: Jean-Pierre.Bogler@continental-corporation.com
+*
+* Header for the NodestateMachine stub.
+*
+* The header file defines the interfaces offered by the NodeStateMachine stub.
+*
+* 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/.
+*
+* Date Author Reason
+* 27.09.2012 Jean-Pierre Bogler CSP_WZ#1194: Initial creation.
+* 24.10.2012 Jean-Pierre Bogler CSP_WZ#1322: Changed parameter types of interface functions.
+*
+**********************************************************************************************************************/
+
+
+/**********************************************************************************************************************
+*
+* Header includes
+*
+**********************************************************************************************************************/
+
+#include "NodeStateMachine.hpp" /* own header file */
+
+#include "NodeStateManager.h"
+#include "NodeStateTypes.h"
+#include <stdio.h>
+#include <CommonAPI/CommonAPI.hpp>
+
+#ifdef ENABLE_TESTS
+#include "Test_StubImpl.hpp"
+#include "v1/org/genivi/nodestatemachinetest/TestInstanceIds.hpp"
+#endif
+/**********************************************************************************************************************
+*
+* Local defines, macros, constants and type definitions.
+*
+**********************************************************************************************************************/
+
+// CommonAPI connection ID
+const char* gConnectionID = "NSMimpl";
+const char* gCapiDomain = "local";
+
+/**********************************************************************************************************************
+*
+* Local variables
+*
+**********************************************************************************************************************/
+#ifdef ENABLE_TESTS
+static std::shared_ptr<CommonAPI::Runtime> gRuntime = NULL;
+static std::shared_ptr<Test_StubImpl> gTestStub = NULL;
+#endif
+/**********************************************************************************************************************
+*
+* Prototypes for file local functions (see implementation for description)
+*
+**********************************************************************************************************************/
+
+/* There are no file local functions */
+
+/**********************************************************************************************************************
+*
+* Local (static) functions
+*
+**********************************************************************************************************************/
+
+/* There are no file local functions */
+
+/**********************************************************************************************************************
+*
+* Interfaces, exported functions. See header for detailed description.
+*
+**********************************************************************************************************************/
+unsigned char NsmcDeInit(void)
+{
+ printf("NSMC: NsmcDeInit called.\n");
+#ifdef ENABLE_TESTS
+ gRuntime->unregisterService(gCapiDomain, Test_StubImpl::StubInterface::getInterface(), v1::org::genivi::nodestatemachinetest::Test_INSTANCES[0]);
+ gTestStub = NULL;
+#endif
+
+ return 1;
+}
+
+unsigned char NsmcInit(void)
+{
+ printf("NSMC: NsmcInit called.\n");
+#ifdef ENABLE_TESTS
+ // Get CommonAPI runtime
+ gRuntime = CommonAPI::Runtime::get();
+
+ gTestStub = std::make_shared<Test_StubImpl>();
+ if (gRuntime->registerService(gCapiDomain, v1::org::genivi::nodestatemachinetest::Test_INSTANCES[0], gTestStub, gConnectionID) == false)
+ {
+ printf("NSMC: Failed to create NSMTest\n");
+ }
+#endif
+ return 1;
+}
+
+
+unsigned char NsmcLucRequired(void)
+{
+ printf("NSMC: NsmcLucRequired called.\n");
+
+ return 1;
+}
+
+
+NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigned int u32DataLen)
+{
+ printf("NSMC: NsmcSetData called. enData: %d. pData: 0x%08X. u32DataLen: %d\n", enData, (int)(size_t) pData, u32DataLen);
+
+ return NsmErrorStatus_Ok;
+}
+
+
+unsigned char NsmcRequestNodeRestart(NsmRestartReason_e enRestartReason, unsigned int u32RestartType)
+{
+ printf("NSMC: NsmcRequestNodeRestart called. Restart reason: %d. RestartType: 0x%02X\n", enRestartReason, u32RestartType);
+
+ return 1;
+}
+
+
+unsigned int NsmcGetInterfaceVersion(void)
+{
+ printf("NSMC: NsmcGetInterfaceVersion called.\n");
+
+ return NSMC_INTERFACE_VERSION;
+}
+
+
+
+