Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: P2140 API Release 4/11/06

  1. #1
    Administrator carnetix_mikeh's Avatar
    Join Date
    Jun 2006
    Posts
    834

    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!

  2. #2
    Junior Member
    Join Date
    Apr 2007
    Posts
    14
    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. #3
    Administrator carnetix_mikeh's Avatar
    Join Date
    Jun 2006
    Posts
    834
    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.

  4. #4
    Junior Member
    Join Date
    Feb 2007
    Posts
    17

    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. #5
    Junior Member
    Join Date
    Apr 2007
    Posts
    14
    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. #6
    Member
    Join Date
    Apr 2007
    Posts
    43
    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. #7
    Administrator carnetix_mikeh's Avatar
    Join Date
    Jun 2006
    Posts
    834
    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.
    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.

  8. #8
    Member
    Join Date
    Apr 2007
    Posts
    43
    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. #9
    Junior Member
    Join Date
    Jan 2007
    Posts
    19
    great to see that an api/sdk was released.

    Now someone needs to hack together a .dll for frontend integretion.

  10. #10
    Junior Member
    Join Date
    Jan 2007
    Posts
    19
    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.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •