/opc-ua-server-acap

Small ACAP application that gets temperature sensor data on an Axis device via D-Bus and exposes it via OPC UA.

Primary LanguageCApache License 2.0Apache-2.0

Copyright (C) 2022, Axis Communications AB, Lund, Sweden. All Rights Reserved.

OPC UA Server ACAP

Build ACAPs GitHub Super-Linter

This repository contains the source code to build a small example ACAP version 3 application that uses D-Bus to get

  • temperature sensor data from com.axis.TemperatureController
  • IO port states from com.axis.IOControl.State

and expose them as OPC UA with an open62541 server. It serves as an example of how easy it actually is to integrate any Axis device in an OPC UA system.

Architectural overview

Note

Even if this application would fit right into your usecase, its purpose is above all to serve as an example and boilerplate rather than being ready for production.

Build

On developer computer with ACAP SDK installed

# With the environment initialized, use:
acap-build .

Using ACAP SDK build container and Docker

The handling of this is integrated in the Makefile, so if you have Docker and make on your computer all you need to do is:

make dockerbuild

or perhaps build in parallel:

make -j dockerbuild

If you do have Docker but no make on your system:

# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices
DOCKER_BUILDKIT=1 docker build --build-arg ARCH=armv7hf -o type=local,dest=. .
# 64-bit ARM, e.g. ARTPEC-8-based devices
DOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=. .

Setup

Manual installation and configuration

Upload the ACAP application file (the file with the .eap extension for the camera's architecture) through the camera's web UI: Apps->Add app

The OPC UA Server port (default is 4840) can be set through the application's parameter settings, found in the three vertical dots menu:

Web UI Screenshot

Web UI Screenshot

Scripted installation and configuration

Use the camera's applications/upload.cgi to upload the ACAP application file (the file with the .eap extension for the camera's architecture):

curl -k --anyauth -u root:<password> \
    -F packfil=@OPC_UA_Server_<version>_<architecture>.eap \
    https://<camera hostname/ip>/axis-cgi/applications/upload.cgi

To start (or stop/restart/remove) the application, you can make a call like this:

curl -k --anyauth -u root:<password> \
    'https://<camera hostname/ip>/axis-cgi/applications/control.cgi?package=opcuaserver&action=start'

Use the camera's param.cgi to get or set the OPC UA server port number.

The call

curl -k --anyauth -u root:<password> \
    'https://<camera hostname/ip>/axis-cgi/param.cgi?action=list&group=opcuaserver'

will list the current setting:

root.Opcuaserver.port=4840

If you want to set the OPC UA server port to e.g. 4842:

curl -k --anyauth -u root:<password> \
    'https://<camera hostname/ip>/axis-cgi/param.cgi?action=update&opcuaserver.port=4842'

Usage

Attach an OPC UA client to the port set in the ACAP. The client will then be able to read the values (and their timestamps) from the ACAP's OPC UA server.

Note

The application will also log the values in the camera's syslog.

License

Apache 2.0