UA ANSI C Server Professional  1.4.2.297
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
custom_provider_helper.h
/******************************************************************************
**
** Copyright (C) 2011-2014 Unified Automation GmbH. All Rights Reserved.
** Web: http://www.unifiedautomation.com
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** Project: OPC Ansi C OPC Server Examples
**
******************************************************************************/
#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;
/* Data logging information */
OpcUa_NodeId nodeIdTemperatureValue;
OpcUa_Int hDataLogItemTemperatureValue;
};
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;
#if HAVE_DATA_LOGGER
extern OpcUa_Int g_hDataLogger;
#endif /* HAVE_DATA_LOGGER */
OPCUA_END_EXTERN_C
#endif /* _CUSTOM_PROVIDER_HELPER_H_ */