Sunday, September 04, 2005

libnjb.NET and Stuff

First off, I was recently successful in getting libnjb to compile in VC++ 8.0 (beta 2), got my code changes merged into their CVS, and got my name added to their AUTHORS file. Another open source project with my name on it - woo! Anyhow, the real reason this is exciting is that I can now continue with my .NET wrapper library and then, my cool iTunes playlist syncing app for the Nomad Zen Xtra I bought awhile back.

Here is containing my current work. The libnjb.dll requires MSVCR80.DLL and libnjb.NET.dll requires .NET Framework 2.0 beta 2. So, here is a link to dotnetfx.exe which should give you what you need.

Nowhere near everything is available in the .NET DLL yet, but you can do things like read/write the owner string, read the device's used and free space, read the current battery level, read if the battery is currently charging, etc. Documentation for libnjb.dll is available at their site. Here are pre-compiled binaries of their sample programs too. Sorry, no documentation for the .NET DLL yet and no example program (but post a comment here if you're really interested and I'll throw something together).

Oh, did I mention that the wrapper is written in C++/CLI ? Managed C++ sucked. C++/CLI sucks much, much less. I can actually see myself using it for more projects going forward...

And if you're completely uninterested in this, then sorry for wasting your time. But if you know anyone with a Creative Nomad or Dell DJ that also uses iTunes for Windows - let them know about this stuff because I hope to have my sync app completed in time for .NET 2.0's launch in November. :)


Zak said...

Oops, I couldn't resist... Here's a small sample of what's currently possible using the .NET DLL. This code is written in C#.

using System;
using libnjb;

Jukebox[] jbs = Jukebox.GetJukeboxes();
Jukebox jb = jbs[0];


Console.WriteLine( "Owner String: '" + jb.Owner + "'" );
Console.WriteLine( "The battery level is " + jb.BatteryLevel + "%" );
Console.WriteLine( "DeviceName: " + jb.DeviceName );
Console.WriteLine( "Used space (in bytes): " + jb.UsedSpace );
Console.WriteLine( "Free space (in bytes): " + jb.FreeSpace );

jb.Owner = "Test String";
Console.WriteLine( "Owner string changed to: " + jb.Owner );

if ( jb.IsCharging )
Console.WriteLine( "The battery is charging" );
Console.WriteLine( "The battery is NOT charging" );


11:26 PM  

Post a Comment

<< Home