#include "uaprovider_demo_methods_1.h"
#include <opcua_guid.h>
#include <opcua_timer.h>
#include <opcua_statuscodes.h>
#include <opcua_memory.h>
#include <opcua_errorhandling.h>
#include <uabase_p_atomic.h>
#include <uaserver_instance.h>
#include <uaserver_call.h>
#include "uaprovider_demo_simulation.h"
#include "uaprovider_demo_identifiers_1.h"
static int g_iDynNodeId = 8001;
static OpcUa_Boolean g_bDynNodeIdExists = OpcUa_False;
static OpcUa_UInt32 iNodeVersion = 0;
OpcUa_StatusCode UaProvider_Demo_Demo_CTT_References_Has3ForwardReferences2_Method1(
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
OpcUa_StatusCode UaProvider_Demo_Demo_CTT_References_Has3ForwardReferences2_Method2(
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
OpcUa_StatusCode UaProvider_Demo_Demo_CTT_References_Has3ForwardReferences2_Method3(
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
OpcUa_StatusCode UaProvider_Demo_Demo_CTT_References_Has3ForwardReferences5_ReferencedNode3(
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
OpcUa_UInt32 a_Summand1,
OpcUa_UInt32 a_Summand2,
OpcUa_UInt32 *a_Sum)
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
*a_Sum = a_Summand1 + a_Summand2;
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
{
OpcUa_BaseNode *pNode = OpcUa_Null, *pParentNode = OpcUa_Null;
char szVersion[11];
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
if (g_bDynNodeIdExists) return OpcUa_BadInvalidState;
&nodeId,
&typeId,
"DynamicNode",
"DynamicNode",
0,
OpcUa_Null);
OpcUa_ReturnErrorIfBad(ret);
OpcUa_ReturnErrorIfBad(ret);
#if UASERVER_SUPPORT_EVENTS
UaProvider_Demo_SendModelChangeEvent(pParentNode, OpcUa_ModelChangeStructureVerbMask_ReferenceAdded);
#endif
g_bDynNodeIdExists = OpcUa_True;
if (pNode)
{
OpcUa_String_Clear(&pValue->
Value.String);
OpcUa_SnPrintfA(szVersion, 11, "%u", iNodeVersion++);
szVersion[10] = 0;
OpcUa_String_AttachCopy(&pValue->
Value.String, szVersion);
}
return ret;
}
{
OpcUa_BaseNode *pNode = OpcUa_Null, *pParentNode = OpcUa_Null;
char szVersion[11];
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
if (!g_bDynNodeIdExists) return OpcUa_BadInvalidState;
OpcUa_ReturnErrorIfBad(ret);
#if UASERVER_SUPPORT_EVENTS
UaProvider_Demo_SendModelChangeEvent(pParentNode, OpcUa_ModelChangeStructureVerbMask_ReferenceDeleted);
#endif
g_bDynNodeIdExists = OpcUa_False;
if (pNode)
{
OpcUa_String_Clear(&pValue->
Value.String);
OpcUa_SnPrintfA(szVersion, 11, "%u", iNodeVersion++);
szVersion[10] = 0;
OpcUa_String_AttachCopy(&pValue->
Value.String, szVersion);
}
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
#if HAVE_DATA_LOGGER
ret = UaProvider_Demo_StartLogging();
#endif
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
#if HAVE_DATA_LOGGER
ret = UaProvider_Demo_StopLogging();
#endif
return ret;
}
OpcUa_UInt32 a_AnimationSpeed )
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
#if UAPROVIDER_DEMO_HAVE_ANIMATION_ITEM && UABASE_USE_FILESYSTEM
ret = UaProvider_Demo_SetAnimationSpeed(a_AnimationSpeed);
#else
OpcUa_ReferenceParameter(a_AnimationSpeed);
ret = OpcUa_BadConfigurationError;
#endif
return ret;
}
OpcUa_Timer g_methodTimer;
typedef struct _UaProvider_Demo_Method_CB_Data
{
} UaProvider_Demo_Method_CB_Data;
OpcUa_StatusCode OPCUA_DLLCALL UaProvider_Demo_Method_DoSomethingAfter10s_CB(OpcUa_Void* pvCallbackData,
OpcUa_Timer hTimer,
OpcUa_UInt32 msecElapsed)
{
UaProvider_Demo_Method_CB_Data *pCBData = pvCallbackData;
OpcUa_ReferenceParameter(hTimer);
OpcUa_ReferenceParameter(msecElapsed);
pCBData->pCallStatus = OpcUa_Good;
OpcUa_Timer_Delete(&g_methodTimer);
OpcUa_Free(pCBData);
return OpcUa_Good;
}
{
UaProvider_Demo_Method_CB_Data *pCBData;
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReturnErrorIfTrue(g_methodTimer != OpcUa_Null, OpcUa_BadInvalidState);
pCBData = OpcUa_Alloc(sizeof(UaProvider_Demo_Method_CB_Data));
OpcUa_ReturnErrorIfAllocFailed(pCBData);
pCBData->pCallContext = a_pCallContext;
pCBData->pCallStatus = a_pCallStatus;
ret = OpcUa_Timer_Create(&g_methodTimer, 10 * 1000, UaProvider_Demo_Method_DoSomethingAfter10s_CB, OpcUa_Null, pCBData);
return ret;
}
Demo_HeaterStatus a_HeaterStatus,
Demo_Priority a_Priority,
Demo_HeaterStatus *a_RetHeaterStatus,
Demo_Priority *a_RetPriority)
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
*a_RetHeaterStatus = a_HeaterStatus;
*a_RetPriority = a_Priority;
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
return ret;
}
OpcUa_Double a_a ,
OpcUa_Double a_b ,
OpcUa_Double *a_result )
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
*a_result = a_a * a_b;
return ret;
}
Demo_Vector *a_v1,
Demo_Vector *a_v2,
Demo_Vector *a_result)
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
a_result->X = a_v1->X + a_v2->X;
a_result->Y = a_v1->Y + a_v2->Y;
a_result->Z = a_v1->Z + a_v2->Z;
return ret;
}
OpcUa_UInt32 a_speed )
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
ret = UaProvider_Demo_SetSimulationSpeed(a_speed);
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
ret = UaProvider_Demo_StartSimulation();
return ret;
}
{
OpcUa_ReferenceParameter(a_pCallContext);
OpcUa_ReferenceParameter(a_pObjectId);
OpcUa_ReferenceParameter(a_pCallStatus);
ret = UaProvider_Demo_StopSimulation();
return ret;
}