Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Enums, OptStructs and Unions (+ bugfixes) #167

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .ci-local/install-open62541.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
if cue.ci['static']:
build_shared = 'OFF'

if ver[0] == '1' and ver[1] == '3':
sp.check_call(['patch', '-p1', '-i', os.path.join(curdir, '.ci-local', 'open62541-1.3.patch')], cwd=sdkdir)

sp.check_call(['cmake', '..',
'-G', generator,
'-DBUILD_SHARED_LIBS={0}'.format(build_shared),
Expand Down
24 changes: 0 additions & 24 deletions .ci-local/open62541-1.3.patch

This file was deleted.

4 changes: 4 additions & 0 deletions devOpcuaSup/DataElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef DEVOPCUA_DATAELEMENT_H
#define DEVOPCUA_DATAELEMENT_H

#include <map>
#include <vector>
#include <memory>
#include <cstring>
Expand All @@ -24,6 +25,8 @@

namespace DevOpcua {

typedef std::map<epicsUInt32, std::string> EnumChoices;

class RecordConnector;

/**
Expand Down Expand Up @@ -795,6 +798,7 @@ class DataElement
virtual void requestRecordProcessing(const ProcessReason reason) const = 0;

const std::string name; /**< element name */
const EnumChoices* enumChoices = nullptr; /**< enum definition if this element is an enum */

protected:
/**
Expand Down
22 changes: 22 additions & 0 deletions devOpcuaSup/RecordConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <dbStaticLib.h>
#include <errlog.h>
#include <alarm.h>
#include <epicsVersion.h>

#define epicsExportSharedSymbols
#include "RecordConnector.h"
Expand Down Expand Up @@ -76,6 +77,16 @@ long reProcess (dbCommon *prec)
return status;
}

#if EPICS_VERSION_INT >= VERSION_INT(3,16,0,1)
#define SAVE_FLNK(prec) struct lset *lset = prec->flnk.lset
#define DISABLE_FLNK(prec) prec->flnk.lset = NULL
#define RESTORE_FLNK(prec) prec->flnk.lset = lset
#else
#define SAVE_FLNK(prec) short type = prec->flnk.type
#define DISABLE_FLNK(prec) prec->flnk.type = 0
#define RESTORE_FLNK(prec) prec->flnk.type = type
#endif

void processCallback (epicsCallback *pcallback, const ProcessReason reason)
{
void *pUsr;
Expand All @@ -85,14 +96,25 @@ void processCallback (epicsCallback *pcallback, const ProcessReason reason)
prec = static_cast<dbCommon *>(pUsr);
if (!prec || !prec->dpvt) return;

// Do not process writeComplete on struct elements that have not been written
if (reason == writeComplete && !prec->pact)
return;

RecordConnector *pvt = static_cast<RecordConnector*>(prec->dpvt);
dbScanLock(prec);
ProcessReason oldreason = pvt->reason;
pvt->reason = reason;

// Do not process FLNK on updates if not "I/O Intr"
SAVE_FLNK(prec);
if (reason != writeComplete && prec->scan != menuScanI_O_Intr)
DISABLE_FLNK(prec);
if (prec->pact)
reProcess(prec);
else
dbProcess(prec);
RESTORE_FLNK(prec);

pvt->reason = oldreason;
dbScanUnlock(prec);
}
Expand Down
Loading
Loading