How to determine Subscription interface to support in HW

HouseBot Plugin Development Discussions.
Post Reply
csharp
Member
Posts: 16
Joined: Tue Aug 31, 2004 10:40 am

How to determine Subscription interface to support in HW

Post 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.
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post 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).
Scott
csharp
Member
Posts: 16
Joined: Tue Aug 31, 2004 10:40 am

Post 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.
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post 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.
Scott
Post Reply