Ignition 8.3 SDK UA Device - activating and deactivating items

In order to manage the set of items to be acquired in a UA Device I am trying to use the hooks:

@Override
public void onDataItemsCreated(List dataItems) {
subscriptionModel.onDataItemsCreated(dataItems);
}
@Override
public void onDataItemsModified(List dataItems) {
subscriptionModel.onDataItemsModified(dataItems);
}
@Override
public void onDataItemsDeleted(List dataItems) {
subscriptionModel.onDataItemsDeleted(dataItems);
}

But these methods never fire in the debugger when referencing/displaying the datapoints in the application. So I tried to use these hooks:

`/**

  • Called when a new item (tag) is added to this device.
    */
    @Override
    public void onDeviceItemAdded(DeviceItem item) {
    logger.info("Item added for data acquisition: {}", item.getNodeId());
    super.onDeviceItemAdded(item);
    }`

`/**

  • Called when an item becomes active (Ignition client starts subscribing to it).
    */
    @Override
    public void onDeviceItemActivated(DeviceItem item) {
    logger.info("Item activated: {}", item.getNodeId());
    // You could start polling or reading hardware here.
    super.onDeviceItemActivated(item);
    }`

`/**

  • Called when the item is deactivated (no subscribers).
    */
    @Override
    public void onDeviceItemDeactivated(DeviceItem item) {
    logger.info("Item deactivated: {}", item.getNodeId());
    super.onDeviceItemDeactivated(item);
    }`

But the corresonding references don't resolve in the POM:

<dependency>
<groupId>com.inductiveautomation.ignition</groupId>
<artifactId>opc-ua</artifactId>
<version>8.3.4</version>
<scope>provided</scope>
</dependency>
<!-- XOPC Driver API (DeviceItem, DriverContext, etc.) -->
<dependency>
<groupId>com.inductiveautomation.ignition</groupId>
<artifactId>xopc-driver-api</artifactId>
<version>8.3.6</version>
<scope>provided</scope>
</dependency>

Which is the correct way to be informed of items being requested for data updates?

Please advise

Where did you get these method names? They are not part of the Device interface. AI hallucinations?

Did you add your driver's address space to the root? And implement the browse operations?

Your device startup should have operations like this:

    context.getServer().getAddressSpaceManager().register(nodeManager);
    nodeManager.addNode(deviceFolder);
    deviceFolder.addReference(new Reference(deviceFolder.getNodeId(),
            NodeIds.Organizes,
            context.getRootNodeId().expanded(),
            false));
    onDataItemsCreated(context.getSubscriptionModel().getDataItems(name));

That final call pulls in subscription items that already exist for your device (in the server's subscription model) before your device gets started.

Hello Phil, thanks for the reply. Yes I certainly added the browse address space on startup. But I certainly don't want to acquire data for all items unconditionally (these could be several 100k items). I need to have a hook were the device gets informed which items are actually requested in the application, which would be a dynamically changing subset. Please advise

That call just retrieves the items for your device. Tags, on startup, are likely to request their OPC items for your device before your device gets started. So you would miss the method calls at that point. That's why your device startup needs to ask the subscription manager for the items that are already requested.

Explain.

Data items are created/deleted only for subscriptions. Polling and explicit OPC reads do not create monitored items.