Create Hardware Interface Plugin in VB?

HouseBot Plugin Development Discussions.
pzand
Member
Posts: 10
Joined: Tue Jun 10, 2003 8:43 am

update

Post by pzand »

Hey guys,



After looking at hardware interface and software device code for 5 hours today, I'm sorry to tell you that I don't think this is going to happen. Not anything time soon anyway :(



For those of you who have read through (and grasped the concept of the C SDKs): the whole deal with sending InterfaceArgumentPacks to "interfaces" and the arguments involved works well in C, but just isn't very portable to the COM way of doing things. VB gets very upset when it comes to arrays of structures, and even more so when those structures may contain pointers. Wrapping the interface arguments in a COM object (a la IEnumVARIANT) is not undoable, but would require much more time than the separation between Interface and Device is worth IMHO. And I haven't even looked at the IRCode part...



If anyone wants to take a stab at it and use my code as a base or example, by all means, let me know and I'll send you what I have. I may even explain my convoluted thought process when I wrote it :wink:



Peter
Automate

Post by Automate »

Peter, thanks for trying.

Are you still considering writing a DDE client Software Device for HB or should I look for another approach?
pzand
Member
Posts: 10
Joined: Tue Jun 10, 2003 8:43 am

Post by pzand »

DDE could be easy, although I've never done much with it. Do you only want to read values? Or would you want to write them also? How flexible do you need this?
Automate

Post by Automate »

Initially I would like to use it with http://home.tiscali.no/henriksen/1-wire/

so just being able to read DDE values would be enough. We could always add writing and doing NetDDE in a future version.



I was thinking the user would need to specify the application name and topic. For WServer application name will be "WServer" and topic is "Weather". Then the user would be able to create a list of "items" to be read such as temperature, wind speed, etc. They would probably also want to specify how often to update the values. You can see an example of how Excel can get values from WServer here http://home.tiscali.no/henriksen/1-wire/sw/dde.zip.
pzand
Member
Posts: 10
Joined: Tue Jun 10, 2003 8:43 am

DDEDevices.dll, initial version

Post by pzand »

Per your request, I have made a plugin for HouseBot that allows you to define DDE devices.



http://users.planetcable.net/pzand/ddedevices.zip



The concept is similar to HouseBot's own IRDevices; you make an XML file (example in the zip) that describes the device you want to make, and add an instance of that device to HouseBot as a normal software device.



The overall structure of the XML is as follows:

<Devices ... >

<Device ... >

<Property ... />

<Property ... />

...

</Device>

...

</Devices>



Available attributes for the Device node:

- NAME: the name as it appears in HouseBot's "Add Device" dialog

- DDEService: the application name used in the DDE conversation

- DDETopic: the topic name used in the DDE conversation

- DDEConnectInterval: interval, in ms, between connection attempts. The plugin will automatically attemp to reconnect when the DDE server disappears.



Available attributes for the Property node:

- NAME: Name of the property

- Description: Description of the property

- InitialValue: Initial value of the property

- Default: set to "Yes" to indicate that this property is the default property. Note: Only ONE default property per device is allowed! Values: Yes|No

- Persistent: set to "Yes" to indicate that the value of this property should be stored in HouseBot's database. Normally, you'd set this to "No". Values: Yes|No

- SameValueChanges: Leave at "No"

- TraceToLog: Set to "Yes" to indicate that changes to this property's value should be logged in HouseBot's device log.

- DDEItem: The item name used in the DDE conversation.



The example in the zip tries to connect to Excel and display whatever is in Row1:Column1 and Row1:Column2. I hope that gives you enough to go on...



Finally: I have no idea what the dependencies of this code are yet, or if it'll even work right on other machines than my own. It's very beta and as such may cause things to happen that you never believed were possible. Use at your own risk!



Enjoy!!

Peter
Automate

Post by Automate »

Thanks a lot Peter!! I will give it a try.
Automate

Post by Automate »

Good work Peter!



It worked first time with Excel. I like the way you made it a "hot link" so when a value changes in the DDE server it changes in HouseBot at the same time. No waiting for a polling interval.



Now I am going to have the get my 1-wire temperature sensors going.



Thanks again.
ScottBot
Site Admin
Posts: 2787
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Peter,



Your DDE Device is pretty neat. I've only tried your Excel demo, but it worked the first time.



I'll be more than happy to host the Device Plugin as a download from the web site once you feel comfortable that it is stable. Just let me know.



Thanks again,

Scott
MediaStorm
Member
Posts: 30
Joined: Sat Jun 28, 2003 1:58 pm

Re: DDEDevices.dll, initial version

Post by MediaStorm »

pzand wrote:Per your request, I have made a plugin for HouseBot that allows you to define DDE devices.

http://users.planetcable.net/pzand/ddedevices.zip

SNIP..


This link is dead.. Anyone have an alternate link or a copy of the zip?
MediaStorm
Member
Posts: 30
Joined: Sat Jun 28, 2003 1:58 pm

Re: DDEDevices.dll, initial version

Post by MediaStorm »

MediaStorm wrote:
pzand wrote:Per your request, I have made a plugin for HouseBot that allows you to define DDE devices.

http://users.planetcable.net/pzand/ddedevices.zip

SNIP..
This link is dead.. Anyone have an alternate link or a copy of the zip?


Nevermind... I found a copy I downloaded a while back.



Thx.
Post Reply