Compile OpenZwave to DLL

Forum and Topics about Z-Wave devices.
Post Reply
soitjes
Member
Member
Posts: 67
Joined: Wed Feb 10, 2010 10:35 pm

Compile OpenZwave to DLL

Post by soitjes »

Hi,

I'm trying to integrate OpenZwave in Delphi (to use it in my home project -> domoticaforum.eu/viewtopic.php?f=17& ... amp;t=6210), and I started my research based on the work of Maarten Damen (python wrapper for OpenZwave). However, after checking with the Delphi community the best way to do the integration is to first compile the OpenZwave library to a DLL. I can compile the OpenZwave with Visual Studio Express 2010, but that only produces a .lib which I can't use. However I did found a dll wrapper on the openzwave site (which is strangely enough not available through svn), but this one does not compile without errors. As I have never worked with C++ before I have no idea on how to fix those errors.

The DLL wrapper is here : code.google.com/p/open-zwave/source/bro ... 253Dclosed

Anybody here who has tried to compile the OpenZwave to a DLL ?

Thanks,

Soitjes.
My Digital Home Server - http://www.digitalhomeserver.net
Ixus74
Starting Member
Starting Member
Posts: 10
Joined: Tue Apr 19, 2011 2:55 pm

Re: Compile OpenZwave to DLL

Post by Ixus74 »

Hi Soitjes,

I'm trying exactly the same, altough I have acces to VS2010 Profesional.
The DLL source you are referring to is probably for .NET integration.

I'm going to start with a basic interface that i can later expand on. I will use the Domotiga wrapper as starting point to create a DLL.
I'm going for a step by step approach, these are the steps I am planning :
  • Make a C++ Dll with basic functions we need (also a callback event), but not implementing zwave.
  • Test this DLL with a Delphi application.
  • Make a C++ Dll based on the domotiga wrapper, with openzwave implementation.
  • Use this DLL with Delphi.
Maybe we can share our efforts, because it will be tricky to get it to work.

Patrick.
soitjes
Member
Member
Posts: 67
Joined: Wed Feb 10, 2010 10:35 pm

Re: Compile OpenZwave to DLL

Post by soitjes »

Well, good to meet another Delphi developer :)

I posted this on Embarcadero forum, and I got some interesting links :

http://rvelthuis.de/articles/articles-convert.html
http://rvelthuis.de/articles/articles-cobjs.html
http://rvelthuis.de/articles/articles-cppobjs.html

No problem to share whatever, but I'm an absolute beginner with C/C++ :(

Soitjes.
My Digital Home Server - http://www.digitalhomeserver.net
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Compile OpenZwave to DLL

Post by Digit »

Here's another Delphi developer :)
Ixus74
Starting Member
Starting Member
Posts: 10
Joined: Tue Apr 19, 2011 2:55 pm

Re: Compile OpenZwave to DLL

Post by Ixus74 »

Hi Soitjes (and Digit),

What approach do you like in Delphi, I'm currently working on the flattened object approach. That is that I will make a wrapper around the OpenZwave Manager class that I will acces from Delphi.

I think it is important to leave the OpenZWave code as-is because of possible future changes tand ease of adaption of the wrapper to those changes.
Eventually I like the pure virtual class with C++ aggregation (multiple inheritance) approach.

I've done C++ in the past, but that was 10 years back so it's a bit rusty but I will get on it soon.

Regards,
Patrick.
soitjes
Member
Member
Posts: 67
Joined: Wed Feb 10, 2010 10:35 pm

Re: Compile OpenZwave to DLL

Post by soitjes »

Patrick,

I don't have a preference. We should just be able to call the C++ methods, either using the flattened approach or directly mapped onto the C++ classes. And receive the callbacks as well.

I agree that you certainly should not change the openzwave code. Once we have a wrapper we can maybe put it on the openzwave site.

Soitjes.
My Digital Home Server - http://www.digitalhomeserver.net
Ixus74
Starting Member
Starting Member
Posts: 10
Joined: Tue Apr 19, 2011 2:55 pm

Re: Compile OpenZwave to DLL

Post by Ixus74 »

I've compiled OpenZWave to a DLL wich I can load in a Delphi application. It is not nearly finished and I had to change the OpenZWave code a bit due to my lack of experience with MS C++. This is what I have ATM :

I have a project containing all OpenZwavecode in wich I removed the hidapi calls (I couldn't get it to compile with it, a linker error).
This project compiles into a dll that uses the cdecl calling convention.

The DLL has one callback function, that gives all notify-types and some node data, but not yet Valuedata.
There is basic control, to turn a node on or off, and to set a level.
Also there is an Init and a destroy method and a method to setup the callback function.

As my code is far from complete and I had to made some alterations I don't know if it is interesting for anyone here yet (You can allways PM me.)

Just to let you know my progress until now.
Post Reply

Return to “Z-Wave Forum”