We are working on migrating one of our modules from Ignition 7.9 to 8.1. In our module we are creating a custom implementation of OPC Connection (in 7.9, we implemented for SROPCServer) and OpcConnectionType. So far we have made some changes to make it compatible with Ignition 8.1 and its compiling successfully. The module is getting installed successfully as well in the Ignition 8.1. But when we are trying to create a new OPC Connection then the connection state remains unchanged as ‘Unknown’, whereas logs in the custom implementation class shows the connection state to be ‘Connected’. Any idea why on Ignition Server the Opc connection state is not getting changed?
The state value comes from
It looks like the only time we’d substitute in
State.UNKNOWN is when
OpcConnectionManager::getConnectionState is given the name of an OPC server that doesn’t exist in the manager’s bookkeeping.
We have overridden OpcConnection::getState to provide the current state of the connection. This is providing the updated state as ‘Connected’ as well. I believe this should also refresh the connection state on the ignition server right? Or do we need to explicitly do something in Ignition 8.1 to achieve the same?
You shouldn’t need to do anything. Are you sure this method is being called at whatever page in the gateway you’re viewing it?
How did you create the connection instance - manually in code or by going through the gateway web UI?
We are using Gateway web UI. In the UI, we are using Opc Connections → Create new Opc Connection → Selected the custom module that we have implemented and added few configurations that are required for our module. The connection is getting created successfully but the status of the connection remains Unknown. We have added a debug log explicitly to check the state using OpcConnection::getState() where it gives the state as Connected.
What page are you viewing the Unknown status? If you breakpoint or put a logger in your
getState method does it trigger every time you refresh that page?
We are using the Opc Connections page to view all the connections and their respective states.
“If you breakpoint or put a logger in your
getState method does it trigger every time you refresh that page?” → Thanks for the lead. I do see repeated calls to getState. I need to further look into our code base to see where the state is getting set to unknown back from connected.