We’re developing an AC plug-in and having a bit of a problem. The access control system comes with a compiled DLL library with classes used to connect to it and subscribe to changes. The problem is that handlers added to events after connection have been made are not fired.
In the ConnectionManager Connect() method, I’ve basically done this:
if(_client.Connect(IP, port, password)) {
FireACSystemConnectionStateChanged(true);
} else {
FireACSystemConnectionStateChanged(false);
}
In the CredentialHolderManager constructor, I have this line:
_client.ConnectionHandler += ConnectionHandler;
_client is being instantiated by the System class where it is a member variable and then passed to the managers through their constructors.
The ConnectionHandler method works fine and is run when the connection is established. It looks like this:
ConnectionHandler(object sender, bool connected) {
if(connected) {
_client.PersonRegistry.OnPersonEvent += PersonChangedHandler;
_client.PersonRegistry.SubscribeToChanges();
}
}
It adds a method to handle changes to any registered person in the AC system and then subscribes to them. However, the PersonChangedHandler is never fired when I change a person. Is this the correct way to do this in an AC plug-in or do I need to structure the code some other way?
I’ve also tried some of the other events the _client supports, such as a heart beat event which is supposed to be fired ever 20 seconds from the AC server. The result is the same. I’ve checked with Wireshark and the packets are sent from the AC server to the event server.