ANSI C UA Server SDK  1.6.0.341
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
custom_provider_helper.h
/*****************************************************************************
* *
* Copyright (c) 2006-2016 Unified Automation GmbH. All rights reserved. *
* *
* Software License Agreement ("SLA") Version 2.5 *
* *
* Unless explicitly acquired and licensed from Licensor under another *
* license, the contents of this file are subject to the Software License *
* Agreement ("SLA") Version 2.5, or subsequent versions as allowed by the *
* SLA, and You may not copy or use this file in either source code or *
* executable form, except in compliance with the terms and conditions of *
* the SLA. *
* *
* All software distributed under the SLA is provided strictly on an "AS *
* IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, *
* AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT *
* LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR *
* PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the SLA for specific *
* language governing rights and limitations under the SLA. *
* *
* The complete license agreement can be found here: *
* http://unifiedautomation.com/License/SLA/2.5/ *
* *
* Project: Unified Automation ANSI C based OPC UA Server SDK *
* *
*****************************************************************************/
#ifndef _CUSTOM_PROVIDER_HELPER_H_
#define _CUSTOM_PROVIDER_HELPER_H_ 1
#include <uaserver_config.h>
#include <uaserver_providers.h>
OPCUA_BEGIN_EXTERN_C
/*============================================================================
* Global Provider data
*===========================================================================*/
extern UaServer_Provider *g_pCustomProvider;
extern UaServer_pProviderInterface *g_pCustomProviderInterface;
extern OpcUa_UInt16 g_uCustomProvider_NamespaceIndex;
/*============================================================================
* Structs and global variables for managing custom user data
*===========================================================================*/
/* Enum of custom user data types */
enum _UserDataType
{
UserDataTemperature,
UserDataMachine,
UserDataMachineSwitch
};
typedef enum _UserDataType UserDataType;
/* All user data structs contain the same header with type information.
* This concept is application specific and only an example.
* You can store whatever you like in UserData.
*/
struct _UserDataCommon
{
UserDataType Type; /* Currently only the type info is needed in the common header */
};
typedef struct _UserDataCommon UserDataCommon;
struct _TemperatureSensor
{
/* User data header */
UserDataType Type;
/* Protocol information */
OpcUa_Double *pValue;
};
typedef struct _TemperatureSensor TemperatureSensor;
struct _MachineSwitch
{
/* User data header */
UserDataType Type;
/* Protocol information */
OpcUa_Boolean *pValue;
};
typedef struct _MachineSwitch MachineSwitch;
struct _Machine
{
/* User data header */
UserDataType Type;
/* Machine data */
TemperatureSensor *pTemperatureSensor;
MachineSwitch *pHeaterSwitch;
OpcUa_NodeId nodeId;
OpcUa_String sMachineName;
UaServer_Event *pTemperatureAlarm;
};
typedef struct _Machine Machine;
extern Machine *g_pMyCustomMachine;
extern OpcUa_Boolean g_bMyCustomMachineSwitch;
extern OpcUa_Double g_bMyCustomMachineTemperature;
extern OpcUa_UInt32 g_HeaterSwitchedEventTypeId;
extern OpcUa_UInt32 g_TemperatureAlarmTypeId;
OPCUA_END_EXTERN_C
#endif /* _CUSTOM_PROVIDER_HELPER_H_ */