CarNetix Support Forum  

Go Back   CarNetix Support Forum > Main Forum > CNX-PSUmoni2140 Software

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 04-11-2007, 12:06 PM
mikeh's Avatar
mikeh mikeh is offline
Administrator
Site Admin
 
Join Date: Jun 2006
Posts: 834
Default P2140 SDK/API Released 4/11/07

Today we are releasing V1.0 of our Software Devleopment Kit (SDK) which includes an Application Program Interface (API) DLL for the P2140 regulator. Please note that this API requires version 1.8+ firmware.

CarNetix P2140 SDK V1.0

The SDK includes:
1) SDK Guide
2) Demo program
3) P2140API.dll
4) USB drivers
5) P2140API Help File

Unfortunately, I am by no means an expert in this area and will be relying on some of you experts to help me get the appropriate information documented for the various applications you may want develop.

FYI, for those of you who have not taken the C# .NET 2.0 plunge, Microsoft is giving away (ie free) the Visual Studio Express IDE. It can make decent programmers out of your averae Joe (ie me). You may want to give it a try since it may make developing applications with the P2140API a bit easier.

Please provde any comments, questions, or feedback in this thread.

Enjoy!
__________________
Mike H
CarNetix
www.carnetix.com
mikeh@carnetix.com

Last edited by mikeh; 09-12-2007 at 09:55 PM.
  #2  
Old 04-17-2007, 03:18 PM
zPilott zPilott is offline
Junior Member
Site Admin
 
Join Date: Apr 2007
Posts: 14
Default

Hi Mike, I have just started looking over the API, trying to get a feel for how I might use it. One suggestion I might have right off the bat is to move any fields that are not normally writable to a property (with only a get) supplied.
Code:
public bool Connected = false;
would change to
Code:
private bool connected = false;
public bool Connected{
  get{
    return connected;
  }
}
This helps to self document the api by making sure that the developer doesn't assume that he/she can connect/disconnect by changing this value. This also means for the larger struct objects especially the client program isn't creating unnecessary garbage by setting cb to a new cbP2140.

It looks like the cbP2140 struct is all read only values, so it seems like all of these would like to be get only properties. To achieve that, you would need to add a method that takes the received data and sets everything (preferably) or makes the set part internal.

For the paramP2140 you could have the setter for each field set a bit indicating that it has been changed.

You might also consider changing the Mode field to an enum, maybe something like:
Code:
enum Mode {
    u = 117,
    User = 117,
    b=98,
    Bootloader = 98,
    x=120,
    NotConnected=120
  };
to enable easy conversion between the ascii character value and the enum.

These are of course, just suggestions, and I think the SDK seems perfectly usable as is and makes me very happy I bought a P2140 and external PSU instead of an integrated device.

I haven't had the time to actually get down and start working on any software that uses this yet, but I am excited about the posssibilities. The first thing that comes to mind is of course making a skinnable psuimon clone. I would also like to create an app that monitors the ignition state and kicks off some tasks when the ignition goes off, then (once they complete) start the shutdown process.
  #3  
Old 04-17-2007, 05:07 PM
mikeh's Avatar
mikeh mikeh is offline
Administrator
Site Admin
 
Join Date: Jun 2006
Posts: 834
Default

zPilott,

Excellent feedback. No I just need to figure out how to do the stuff you suggested.... I'm sort of a newbie C# programmer. Seriously, I understand what you are saying and agree that it would be a good idea. I'll give it a shot (a bit later).

I'm glad to see your excitement about writing apps. I have been hoping folks would jump on this opportunity. I'd love to see some sort of integration with an existing front end.

Let me know if you run into any problems. And thanks for the feedback.
__________________
Mike H
CarNetix
www.carnetix.com
mikeh@carnetix.com
  #4  
Old 05-10-2007, 08:03 PM
Game_Ender Game_Ender is offline
Junior Member
Site Admin
 
Join Date: Feb 2007
Posts: 17
Default How to use the API?

Is there a quick howto on using this api? I can't seem to find "mpusbapi.dll" where do I get this dll and once I have it where do I put it?
  #5  
Old 05-11-2007, 10:19 AM
zPilott zPilott is offline
Junior Member
Site Admin
 
Join Date: Apr 2007
Posts: 14
Default

I think the mpusbapi.dll is included with psumoni. It is probably easiest to just put it in the same directory as your application, but you can also put it anywhere in your path. The help files included seem pretty complete and you might want to look at the demo application included in the sdk for help getting started.
  #6  
Old 05-23-2007, 07:00 PM
changeip changeip is offline
Member
Site Admin
 
Join Date: Apr 2007
Posts: 43
Default

is there a way to emulate a 2140 so we can program against it without physically having a unit connected ? A feature request for the future I guess.

Also, I'd like to add history and long term graphs to psumoni, is there a chance you would release the source for psumoni so we don't have to rewrite all from scratch ?

Sam
  #7  
Old 05-24-2007, 08:19 AM
mikeh's Avatar
mikeh mikeh is offline
Administrator
Site Admin
 
Join Date: Jun 2006
Posts: 834
Default

Quote:
is there a way to emulate a 2140 so we can program against it without physically having a unit connected ? A feature request for the future I guess.
Hmmm...I'll have to think about this. I'm not quite sure how to do it.
Quote:
Also, I'd like to add history and long term graphs to psumoni, is there a chance you would release the source for psumoni so we don't have to rewrite all from scratch ?
Sorry, can't really do this. Also, you'd have to buy a $700 software license to use the existing tools.
__________________
Mike H
CarNetix
www.carnetix.com
mikeh@carnetix.com
  #8  
Old 05-24-2007, 11:49 AM
changeip changeip is offline
Member
Site Admin
 
Join Date: Apr 2007
Posts: 43
Default

I understand about releasing the code - no problem, just worth asking before I start doing it as a side project. $700 tools - for visual studio or some 3rd party stuff ?

For development I will be testing the eltima.com usb to ethernet package. . . this will let me bring my 2140 USB port to another machine that I have all my development software on. I'll report back to let you know how it works out.

Sam
  #9  
Old 06-16-2007, 10:48 PM
Ruffy Ruffy is offline
Junior Member
Site Admin
 
Join Date: Jan 2007
Posts: 19
Default

great to see that an api/sdk was released.

Now someone needs to hack together a .dll for frontend integretion.
  #10  
Old 06-16-2007, 10:51 PM
Ruffy Ruffy is offline
Junior Member
Site Admin
 
Join Date: Jan 2007
Posts: 19
Default

Quote:
Originally Posted by zPilott
I haven't had the time to actually get down and start working on any software that uses this yet, but I am excited about the posssibilities. The first thing that comes to mind is of course making a skinnable psuimon clone. I would also like to create an app that monitors the ignition state and kicks off some tasks when the ignition goes off, then (once they complete) start the shutdown process.

That + Fusion Brain ( Link Here )

Would make for an AWESOME setup.
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
The contents of this forum are copyright 2010 CarNetix