Accessing DeviceSettingsRecord Fields

In the opc-ua-device example, the device settings end up in 2 tables. I’d like to confirm how to access fields for a specific device instance in the DEVICESETTINGS table.

For example, I want to use NAME and ENABLED elsewhere in my code.



Can you provide any more context about what you’re trying to do?

You can use an extension point type and the “child” settings record to reference its parent (if it extends BaseExtensionPointType): com.inductiveautomation.ignition.gateway.model.BaseExtensionPointType#findProfileSettingsRecord

Really the only sane way for a Device instance to get and use its DeviceSettingsRecord is to pass it into the Device instance as you construct it here: ignition-sdk-examples/ at 1c2dcb8d3a5282f72ab2b21cad44afdb7126a1d7 · inductiveautomation/ignition-sdk-examples · GitHub

The example doesn’t do that because it doesn’t need it, but that’s what other Device implementations tend to do.

@PGriffith we are writing a buffered TCP module. We are doing so because the stock TCP driver in Ignition is polled and we have messages from a shipping sorter that arrive so close together than we miss messages (i.e. we count less than we should even at 25ms).

It will allow the same function as the Ignition provided TCP driver (most recent message provided as an OPC-UA tag, but will also allow the user to execute something like this from the designer:


Inside the module that will access this:

# This is socket object will be stored in a hashmap whose key is the connection name
this.input = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));

# It gets read like this
message = this.input.readLine();

When I check or uncheck the enabled field, I want to open or close the socket.

Normally I would have a field in my own settings record that I can access like this:

public Boolean getEnabled() {return getBoolean(Enabled);}

But here since the enabled setting is in a seperate table, I am wondering how to access it.



Any time the settings record is saved your whole Device instance will be shut down and possibly started again unless it's now disabled.

So looking at the opc-ua-device example under the ExampleDevice class there is a method called “onShutdown”. I guess that would be the appropriate place to close the socket?

If so I would have no need to access the actual property.

Thanks for the advice, as always.


Yeah, you should close it there regardless of the value of the Enabled property.

1 Like