l0gic Posted July 25, 2016 Share Posted July 25, 2016 Hi guys, I use V Studio and usually code in V Basic as I find it easier. I want to knock up a program for controlling my heating system (eq-Max). There is some C code out in the wild that will interface with the unit and do all the connection and integration but it is the form of cpp & h files and to be honest I don't know where to start with them. For reference, https://github.com/KnuthLohse/MAXCPP/tree/master/DiffSet Can I mix 'n match C with VB by calling the cpp & h files at all? Do I need to write in C? If so, how do I then integrate the supplied code with my code? Worst case the protocols are known so I can start from scratch but obviously would rather reuse what is already out there. TIA for any pointers for a dumb VB hick. l0gic Quote Link to comment Share on other sites More sharing options...
l0gic Posted July 26, 2016 Author Share Posted July 26, 2016 Been doing some digging and it seems that the way forward is to convert the C code to a dll (somehow...) and call the dll from within VB. All I need to do now is convert the code to this dll. The implication is that I need to reference the calls in the dll and get the VB to then reference it. Sounds a bit hard but I'll see if I can find some guides. Quote Link to comment Share on other sites More sharing options...
HackmanSlim Posted July 26, 2016 Share Posted July 26, 2016 i hate to say this m8, but ermm, i got no idea meesa knowa nothing, but if you need ecigs, i can steer you in the right direction hehehe joking aside, i do hope you get this sorted very soon good luck Slim 1 Quote Link to comment Share on other sites More sharing options...
kccsf Posted July 26, 2016 Share Posted July 26, 2016 Hi l0gic Is that not just a c port of this? https://github.com/bietiekay/MAXSharp If so, the above is already in a library and comes with an example project too (albeit all of this is in c#, not vb). I downloaded it and it builds but I don't have the hardware to test. Set MaxSharpExample as the startup project, check ELVMAX_Cube_IP_Adress and ELVMAX_Cube_Port in Main.cs and give it a go. If it works I will convert the example to VB.net for you. Steve 2 Quote Link to comment Share on other sites More sharing options...
HackmanSlim Posted July 26, 2016 Share Posted July 26, 2016 rep coming your way kccsf,nice one buddy Slim Quote Link to comment Share on other sites More sharing options...
kccsf Posted July 26, 2016 Share Posted July 26, 2016 Thanks Slim! Steve Quote Link to comment Share on other sites More sharing options...
l0gic Posted July 26, 2016 Author Share Posted July 26, 2016 Whoop-bloody-do! Nice one kccsf! I've tried it with my IP settings and the console is pumping away readings. All stats & rad valves look like they are there. It only reads, the code is not there to write to the cube to set values but I _may_ not need that at least in the short term. I've had a quick go at changing it into a form based program rather than a console and faffed it up already. C variations are just not my 'thing'. If you could convert the example to VB that would be great and I should be able to take it from there. I'm a one trick pony - I know! Cheers for all your help. l0gic Quote Link to comment Share on other sites More sharing options...
kccsf Posted July 26, 2016 Share Posted July 26, 2016 Hi l0gic https://uploadfiles.io/a7493 (Doesn't let me upload zip or rar here) Archive contains the source from the repo to which I've added MaxSharpFormExample. As per before set the ip and port albeit this time within Form1.vb in the MaxSharpFormExample project and if it is not already, set it as your startup project. Let me know how it goes Steve Quote Link to comment Share on other sites More sharing options...
l0gic Posted July 27, 2016 Author Share Posted July 27, 2016 Hi Steve, fantastic mate. Changed the IP and it all runs - sweet. I'll now start pulling out the feed and splitting it into discrete room data so I can present it as data in a section for each room. Maybe even graphing it, who knows. Again, thanks for the assistance. I can now progress in my recognisable VB bubble Cheers Kevin Quote Link to comment Share on other sites More sharing options...
kccsf Posted July 27, 2016 Share Posted July 27, 2016 No problem, glad it works. Good luck! Steve Quote Link to comment Share on other sites More sharing options...
Fon Posted July 27, 2016 Share Posted July 27, 2016 I love you lot! Great team effort. Thanks, Fon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.