Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Force client to rebrowse after database change
June 22, 2015
12:01, EEST
Avatar
danko
Member
Members
Forum Posts: 6
Member Since:
June 4, 2015
sp_UserOfflineSmall Offline

Hi everyone,

is there a way for a server to tell a client (in my case: the UaExpert client for testing purposes) to rebrowse automatically after a certain operation, like a method call? The client has no subscription for any events. Specifically, I need it to rebrowse a folder two layers above the node that has been called, in order to make visible what changed after calling the method.

There is a RefreshRequiredEventType in the Types folder which sounds like it could be the right direction. However, the following code put after the method call’s handling does not seem to do anything.

RefreshRequiredEventTypeNode rebrowseCall = nodeManager.createEvent(RefreshRequiredEventTypeNode.class);
rebrowseCall.triggerEvent(null);

Do I need to add an EventManager or Listener somewhere (where?) or does the client have to subscribe in order to be influenced by events?

Thanks and regards,
danko

June 23, 2015
11:45, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

RefreshRequiredEventType is related to ConditionRefresh calls: the client is instructed to call that.

For model changes (address space changes) UA defines the GenericModelChangeEventType. UaExpert is also listening to these events (with a MonitoredItem) and will refresh the address space view automatically, when it receives such an event.

The SDK enables automatic model change events with NodeManagerRoot.beginModelChange()/endModelChange(). You will also need to define the NodeVersion property to the object nodes that are changing, to enable the event for these nodes. See the Javadoc of the mentioned NodeManagerRoot methods for more details.

June 23, 2015
14:35, EEST
Avatar
danko
Member
Members
Forum Posts: 6
Member Since:
June 4, 2015
sp_UserOfflineSmall Offline

Thanks a lot for the reply!

Jouni Aro said
RefreshRequiredEventType is related to ConditionRefresh calls: the client is instructed to call that.

Ah well, I was way off then.

Jouni Aro said
For model changes (address space changes) UA defines the GenericModelChangeEventType. UaExpert is also listening to these events (with a MonitoredItem) and will refresh the address space view automatically, when it receives such an event.

How would I send one of these? Following the example in MyNodeManager I think there needs to be an alarm node which triggers the event in a given situation. But a client would have to monitor this alarm node in order to get its events, wouldn’t it?

Jouni Aro said
The SDK enables automatic model change events with NodeManagerRoot.beginModelChange()/endModelChange(). You will also need to define the NodeVersion property to the object nodes that are changing, to enable the event for these nodes. See the Javadoc of the mentioned NodeManagerRoot methods for more details.

I’m probably doing it wrong. Here is what I have:

NodeManagerRoot rootManager = getNodeManagerTable().getNodeManagerRoot();
rootManager.beginModelChange();
rootManager.addModelChange(getNamespaceTable().toNodeId(myFolderId), Identifiers.FolderType, ModelChangeType.ReferenceAdded);
rootManager.endModelChange();

These lines are called when a new subfolder has been addes to myFolder. Rebrowsing myFolder manually makes the new subfolder appear in the list but without the rebrowse nothing changes.
Reading the documentation of NodeManagerRoot and I guess the problem lies in the versioning – as I’m using a custom NodeManager there is no node for myFolder I could call incNodeVersion() on to initialise the counter, only the ExpandedNodeId. Using a node here would beat the purpose of losing it in the first place, creating the address space dynamically from data. However, I’d still like changes concerning this data to show.

June 24, 2015
8:41, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

That’s the correct way to do it, but it seems indeed that UaExpert (I have version 1.3.1) is not refreshing the address space automatically as I remembered.

June 29, 2015
7:38, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Turned out there was a minor bug in the SDK: UaExpert is using QueueSize=0 for the model change monitoring and this was not properly handled in the server side SDK to use the maximum queue size, instead. Fixed now and available as beta on request and also included in the (soon) upcoming 2.2.0 release.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6451

Newest Members:

jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1