One is to integrate the SDK and the UA Server into a new or an existing application. The second task is to integrate the data sources into the SDK. This tutorial gives an introduction on how to integrate data sources into the ANSI C UA SDK by implementing a data provider. It doesn't cover everything. The emphasis is on teaching how to quickly create a new Data Provider with new address space and new IO data.
Please read the Introduction section before working through this tutorial.
Contents:
Folder | Description |
---|---|
uaserverc | Main UA Server source folder containing the generic server sources. |
uaserverc/tools | Folder containing some helper 'classes' like container (TurboList, TurboStack, etc.). |
uaserverc/providers | Folder containing all data providers. |
uaserverc/providers/server | Folder containing the Server Provider which implementes the Server address space defined by OPC UA Specification. |
uaserverc/providers/sample | Folder containing a simple sample provider with demo values. |
uaserverc/providers/xyz | Folder containing your vendor specific XYZ provider. |
File | Description |
---|---|
uaprovider_xyz.h | Contains provider function definitions. Normally only UaProvider_XYZ_Initialize for initializing your provider. |
uaprovider_xyz.c | Implements the provider initialization and cleanup. |
xyz_read.c | Implements the read service of the provider interface. |
xyz_write.c | Implements the write service of the provider interface. |
xyz_subscription.c | Implements the subscription functionality like described in Provider Subscription Mechanism. |
uaserver_helper.h | Contains generic helper functions for using the provider callback interface. |
IFMETHODIMP(UaProvider_XYZ_Initialize)( UaServer_Provider *a_pProvider, UaServer_pProviderCBInterface *a_pProviderCBInterface, UaServer_pProviderInterface *a_pProviderInterface) { OpcUa_StatusCode uStatus = OpcUa_Good; // TODO return uStatus; }
IFMETHOD(Cleanup)(OpcUa_Void) { OpcUa_StatusCode uStatus = OpcUa_Good; // TODO return uStatus; }
//============================================================================ // Exported Initialization Wrapper For Dynamically Loadable Providers //=========================================================================== #ifndef UAPROVIDER_STATIC IFMETHODIMP(InitializeProvider)(OpcUa_Handle a_hProviderHandle, UaServer_pProviderCBInterface *a_pProviderCBInterface, UaServer_pProviderInterface *a_pProviderInterface) { return UaProvider_XYZ_InitializeProvider(a_hProviderHandle, a_pProviderCBInterface, a_pProviderInterface); } #endif // UAPROVIDER_STATIC