BCS 4.0 .NET API and BCS Temperature Logger

Applications that run on PC/Mac.
Post Reply
MikeRussell
Posts: 33
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

BCS 4.0 .NET API and BCS Temperature Logger

Post by MikeRussell »

Too long; didn't read? Just download the BCSTempLogger attachment

Unzip and run the executable. If your BCS has the older v3 firmware, use the v3 temp logger below.


While writing the temperature logger found near the end of this thread viewtopic.php?f=13&t=257 I found the need to make my code a little more modular.

To make my life easier, I wrote a quick .net api for dealing with the interactions with the BCS. Well, the theoretical BCS anyways, as I don't actually have a BCS to test with.

Essentially what this library will help you do is create a connection to your BCS and then provide methods to get or set specific pieces of data from it.

For example you can do:

BCSWebConnection connection = new BCSWebConnection(address, port);
BCSWrapper wrapper = new BCSWrapper(connection);

and then you can do

wrapper.GetCurrentTemperatures() which will give you an array of temperatures from the BCS or you can do wrapper.GetTemperatureProbe(probeIndex) which will give you all of the details from a probe (setpoint, etc)

Anyways, here is a zip with the API (BCSNet.Core.dll) as well as an example front end. I would really appreciate anyone's time testing it out. You can reference the BCSNet.Core.dll in your .net project and leverage the work i've done.

I've also added version 1.1.0 to the attachments which includes some customizations requested by a friend - it also saves output and DIN status to the log. You can use the existing version if this isn't useful for you
Attachments
BCSTempLogger1.1.0.zip
(241.64 KiB) Downloaded 379 times
BCSTempLogger (v3).zip
(7.77 KiB) Downloaded 523 times
BCSTempLogger (v4).zip
(250.83 KiB) Downloaded 573 times
Last edited by MikeRussell on Thu Aug 15, 2019 7:48 am, edited 4 times in total.
brahn
Posts: 543
Joined: Thu Dec 13, 2012 11:01 am
Bot?: No

Re: BCS 4.0 .NET API

Post by brahn »

Mike, this is awesome, and you don't even have a BCS! Thanks for putting this together.

I'm on a Mac, but I may have to see if this works with the .Net Core preview that MS put out earlier this year.
MikeRussell
Posts: 33
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by MikeRussell »

Thanks, brahn! I love to brew and I love to code - things like this just happen to come together sometime.

You and another forum user have talked about Mac compatibility. Are there a large number of BCS users on Macs?

I analyzed my other app (BCSTempLogger) with the Mono Migration Analyzer (MoMA) tool and it told me that the stock WebRequest.DefaultCredentials (no username/password when connecting to the BCS) is marked as TODO in Mono 2.8. This means it could potentially still work fine using Mono, or it might not connect at all.

If you could give this a try via .net Core or Wine or Mono and let me know how it works I would be eternally grateful. I think other users would benefit as well. Of course since I don't have access to a mac, there is little I can do on that front as well. I hate having my hands tied like that.

Let me know if you get error messages when using the .net core - I may have to target a different framework to make things work OK with that.
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: BCS 4.0 .NET API

Post by JonW »

Mike,
I need to see what's wrong with our demo BCS unit and I'll get it back online. Once that's working, you can test your utilities against demo.embeddedcc.com .

Great work on the API.
MikeRussell
Posts: 33
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by MikeRussell »

Oh awesome, that will make life (and code) a lot easier!

Thanks for the reply JonW!
User avatar
SamIam
Posts: 51
Joined: Fri Aug 19, 2011 1:34 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by SamIam »

Mike, I created a VS2012 project a while back that does the same thing. It generates a bsc_library.dll that can be used in any other .NET project. I've tested it against a very early alpha version of the 4.0 firmware and it worked at the time. If your interested, I can send you the what I've done.
MikeRussell
Posts: 33
Joined: Thu Jun 18, 2015 7:58 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by MikeRussell »

Awesome!

Glad to hear others are interested in the same type of thing. I didn't spend any time looking around to see if anyone had started a similar api. I just wanted a quick and easy way of helping a buddy log temperatures from his BCS but it turned into this already.

You can find the source for what I've done so far here: https://bitbucket.org/ransidmeat/bcsnet/ It should be flexible enough that the rest of the commands can be implemented with minimal effort. Feel free to post/host what you've got as well. I wouldn't mind taking a look at what you have done.

Oh also, how did you handle the json? I decided to try json.net since it appeared to be straightforward - I don't have much experience with parsing this stuff so maybe there is a better way.
User avatar
SamIam
Posts: 51
Joined: Fri Aug 19, 2011 1:34 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by SamIam »

I can't remember I think I just used the Javascript deserializer within .NET. I don't have it hosted anywhere and it's been over a year since I've done anything with it. Let me dig it up and I'll just shoot it to you in a PM. Do with it as you wish.
User avatar
SamIam
Posts: 51
Joined: Fri Aug 19, 2011 1:34 pm
Bot?: No

Re: BCS 4.0 .NET API

Post by SamIam »

Project is pretty small so I thought I would just post it up here. It just builds a dll that can be used in other projects for making calls the BCS. Let me know if anyone has any questions.
NET_BCS_Library.zip
(79.68 KiB) Downloaded 687 times
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: BCS 4.0 .NET API

Post by JonW »

Sam, is that for BCS 3.x or 4.x?
Post Reply