Page 1 of 1
How to determine Subscription interface to support in HW
Posted: Mon Sep 13, 2004 1:04 am
by csharp
I want to build a hardware device for the Weeder input cards. You already have an Input software device that I could use without reinventing the wolrd. However, how do I tell what the Subscription interace is that the hardware device should implement in order to send commands to a software device?
I can determine how to add a new Relay hardware device that supports the Relay software device because the Ocelot device will show me Interface list that is support. I can see "SetRelay" and implement it. But you don't show Subscriptions Interfaces anywhere.
Posted: Mon Sep 13, 2004 8:34 am
by ScottBot
I agree that it would be helpful in being able to reuse existing Devices if the subscription names were published somehow. The HardwareAPI.h file in the Interface SDK does list most of the subscription names in the comments, but it doesn't give the filters that may be used.
The Input Devices subscribes to the Input State Change notification list. It uses "M=<Module>;I=<Input>".
<Module> = the module ID (as a string) that corresponds to the input module (if applicable).
<Input> = the input number (as string) that corresponds to the interface input (if applicable).
Posted: Mon Sep 13, 2004 1:05 pm
by csharp
But the subscription doesn't say what the new state is? Only that it changed. The software device would then queriy this value.
From experience, I don't trust the software to accurately maintain a shadow of the state of the device. At initialization time, I have the software device get its state from the hardware. They you can make sure thinks stay in sink by passing up the state with the subscritpion.
Posted: Mon Sep 13, 2004 1:34 pm
by ScottBot
I forgot to mention that when the subscription notification has been received, the DataPack will contain (or needs to contain if you're writing the Interface plugin) a Property named State that will be either Opened or Closed. The Input Device will use this to update its State Property.