Software Bakery

Specialty: Delicious software

 

Wii Device Library released

 

After working on Wii Device Library on and off for several months we (About) have decided to release our work to the public. This is not the first project we have worked on together, but it is the first project we have actually decided to release. Because of this we wanted to do it right, so we came up with a couple of requirements for the release of the library.

In this post we will describe what decisions we made to share this knowledge with others and for ourselfs to look back upon.

Project hosting

As it’s likely we want to release more of our projects in the future, it will be helpful to have a centralized place where we can publish all these projects. That’s why we first started looking into project hosting websites such as SourceForge, Google Code and others. We felt that the projects we would be hosting there would be unrelated to each other and we wanted more control over our content. So, we wanted our own website. But since we were taking as long as we did to publish one project, we also wanted to start as soon as possible with the content. Developing our own website would take too much time. That’s why we chose a CMS, which in our case is WordPress. We chose WordPress because we could test it out on WordPress.com. There we found that it was possible to not only blog, but also create pages. And since we didn’t want to spend a lot of time making a theme, we could easily choose our theme from different theme-galleries. From here, things finally started to get rolling. We quickly found a good webhost and registered our domainname. Here we set up our own WordPress site, added a few plugins and we were ready for the next step.

Version control

We wanted our code to be easily accessable to everyone. For this we wanted a svn repository and an one-click download system. Choosing which svn repository to use was hard at first. There were tons of providers for this, all with different features. We thought about what features we really needed, in the end we just wanted an easily accessable code repository. We have also considered different version control systems. Subversion was more widely used than some of the others (Cvs, SourceSafe and Bazaar), so that was in line with our requirement of keeping everything easily accessable to everyone. Google Code gave us a Subversion repository, was fast and it also allowed people to browse the code online, which was just what we needed.

Download package

The repository was finished, but we still needed a download package, which included the binaries, sourcecode and examples, that had to be a breeze to find, download and extract. For this we have put a large download-button on the project page where a zip file can be downloaded. Other archive formats aren’t that well supported accros platforms, so zip was the only right format for this. We chose to not use external download systems, because this required more searching for mirrors that would like to host our files. Handling our own downloads would result in a fast and reliable user-experience. We only need to be aware of our monthly usage.

Examples

We wanted to make it easy to get started with the library. We found in other libraries and frameworks that the examples are a major factor in choosing the library or not. So we thought about what examples we needed to include. We divided the library in different ascpects. For each aspect we created an example that could be used as a program on its own. This makes it very easy to look into one aspect of the library without getting confused by the previous or next examples.

Go check out the Wii Device Library, and let us know what you think.

 

14 Responses to “Wii Device Library released”

  1.  

    This lib is wonderful! I’m really looking into some nice app that allows me to configure and use my wiimote as the tools already over there.

    What I really love is the auto-sync part of it, as well as the no need to mess with the bluetooth stacks! Great work!

  2.  

    I tried the examples included right away, they all crash when trying to connect to the device (discover and auto-connect like a charm thought).

    This is the output:

    C:\Binaries>Examples.exe
    1. DiscoverExample
    2. ConnectExample
    3. LedsExample
    4. ButtonExample
    5. ReportingModeExample
    6. AccelerometerExample
    7. IrExample
    8. NunchukExample
    Enter a number to run one of the examples: 4
    The IDeviceProvider is discovering…
    A device has been found.

    Unhandled Exception: System.IO.IOException: El parámetro no es correcto.

    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.BeginWriteCore(Byte[] bytes, Int32 offset, Int32 numB
    ytes, AsyncCallback userCallback, Object stateObject)
    at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
    at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
    at WiiDeviceLibrary.Bluetooth.MsHid.MsHidStream.WriteHidReport(Byte[] writeBu
    ffer, Int32 offset, Int32 count)
    at WiiDeviceLibrary.Bluetooth.MsHid.MsHidStream.WriteHidReport()
    at WiiDeviceLibrary.Bluetooth.MsHid.MsHidStream.Write(Byte[] buffer, Int32 of
    fset, Int32 count)
    at WiiDeviceLibrary.ReportDevice.WriteReport(Byte[] buffer, Int32 offset, Int
    32 count)
    at WiiDeviceLibrary.ReportDevice.SendReport(Byte[] report)
    at WiiDeviceLibrary.ReportDevice.SendReport()
    at WiiDeviceLibrary.ReportWiimote.SendReport()
    at WiiDeviceLibrary.ReportDevice.SendAndReturnReport(InputReport returnReport
    Type, TimeSpan timeout)
    at WiiDeviceLibrary.ReportDevice.SendAndReturnReport(InputReport returnReport
    Type)
    at WiiDeviceLibrary.ReportDevice.UpdateStatus()
    at WiiDeviceLibrary.ReportWiimote.Initialize()
    at WiiDeviceLibrary.Bluetooth.MsHid.MsHidWiiProviderHelper.TryConnectWiimote(
    IDeviceInfo deviceInfo, HidStreamHandler createCommunicationStream, ReportWiimot
    e& wiimote)
    at WiiDeviceLibrary.Bluetooth.Bluesoleil.BluesoleilDeviceProvider.Connect(IDe
    viceInfo deviceInfo)
    at Examples.ButtonExample.deviceProvider_DeviceFound(Object sender, DeviceInf
    oEventArgs e)
    at WiiDeviceLibrary.Bluetooth.Bluesoleil.BluesoleilDeviceProvider.OnWiimoteFo
    und(DeviceInfoEventArgs e)
    at WiiDeviceLibrary.Bluetooth.Bluesoleil.BluesoleilDeviceProvider.OnWiimoteFo
    und(BluesoleilDeviceInfo deviceInfo)
    at WiiDeviceLibrary.Bluetooth.Bluesoleil.BluesoleilDeviceProvider.Discovering
    ()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
    ontextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

  3.  

    Thanks for your interest! Your exception really helped finding the problem. It seems hardware-dependend, so I have made a temporary fix. I’ll send you the binaries of the fixed code, if you’d like to test it out it would help us greatly.

  4.  

    Thanks for the info, works great!

  5.  

    The fix I mentioned earlier didn’t work for Suloku, but uninstalling BlueSoleil did. It seemed like something was wrong with BlueSoleil.
    It’s good to know that the library ‘just works’ for some people (thanks for the feedback Jimm). Though some bugs were found after more testing.

    These bugs are Windows-only, so Windows users might experience the example application to hang when using a Wiimote-extension and have some trouble with multiple Wiimotes.

    We will be working on a new version (1.1) to fix these bugs. We will release it when it’s done.

  6.  

    Thanks for the information. Bookmarked your site.

  7.  

    Enjoyed your post. Thanks!

  8.  

    Hello

    I tried to run the WindowsGUITest example but I get every time a Win32Exception error = “Handle is invalid” (translated from german).
    This error is fired every time from function HandleError().
    This function is called after the call of function BluetoothFindFirstDevice().

    I have a Toshiba bluetooth-stack installed. Version 5.10.2.
    On the following link from Microsoft
    http://msdn.microsoft.com/en-us/library/aa362784(VS.85).aspx
    there is a hint (under more Details) that the function BluetoothFindFirstDevice() will not working on Toshiba stack !

    Hope this will give you some Hint to make the great looking Wii Device Library running for all bluetooth stacks.

    Maybe the bluetooth library from 32feet
    http://inthehand.com/content/32feet.aspx
    can help to solve the problem.

    Thank you for your big job and the will to share your code !
    Best wishes and good luck!

  9.  

    Hi HalloUniversum (nice name),

    32feet seems to be supporting only the Microsoft stack, so I’m afraid the library does not help much for your problem.

    I’m sorry to hear you’re using Toshiba stack. We don’t (and can’t) support the auto-discovery feature for Toshiba bluetooth devices, since Toshiba does not release its SDK for free! Maato, the other author of Wii Device Library, has tested the library on his Toshiba laptop, but there was no way to get auto-discovery to work.

    There are ways to use the Wii device Library without the auto-discovery feature. I’ve created the class WiiDeviceLibrary.Bluetooth.MsHid.MsHidDeviceProvider (it’s already in the WDL version you have) which should work when you manually connect to the Wiimote using Toshiba’s bluetooth application. Although I haven’t tested it and it isn’t officially supported at the moment.

    What you also can try is using another bluetooth stack to use WDL’s auto-discover feature. I’ve tested different bluetooth devices and some seem to be working with other stacks than the one they were supplied with. You could try to install BlueSoleil or Microsoft’s bluetooth driver.

    I hope that helps. I’m looking forward for your findings

    Thank you all for the comments. I still haven’t found the time to fix the Windows problem, because of all the school-work. If you run into any other problems, please post them so we can fix them when we’ve got the time.

  10.  

    Hey.

    I have been running the examples only and I have made it work for the wii mote. It’s really nice! But when I try to connect the balance board nothing ever happens. It just acts like the balance board isn’t there at all. So no exception or anything like that. When I try to connect the board with a bluetooth manager it works just fine. I am running Windows Vista. Hope you can help. I would really like to use your library with the balance board.

  11.  

    Hi Muus,
    We’re aware of the bug you mentioned. It happens with Wiimote-extensions that are connected when you connect the wiimote through bluetooth. The balanceboard is essentially a Wiimote with ‘balanceboard’-extension, so this bug also applies to the balanceboard. This only happens under Windows and not Linux.
    I still haven’t fixed this bug, since I do not have a Wiimote with extension available and lack the time to do something about that atm :( .
    As soon as I’ve got the time and Wiimote, I’ll fix the problem.

  12.  

    I am using the library for some Wiimote related work, and it works quite well (I especially like the discovery feature).

    I think there are a few changes which would make the MsHid interface usable — I have patched a local copy to include these changes, and I am including these patches (as I don’t know where else to direct said patched).

    First, a patch to avoid a NullReferenceException if acceleration data arrives before calibration (this can happen if the Wiimote is already configured for reporting acceleration):

    (see next comment)

  13.  

    Since WordPress ate my formatting, here’s a permanent copy on Pastebin: http://pastebin.com/d7e2c286c

  14.  

    Thanks for the fixes! The first two can be considered approved, but we have to check the third patch since it removes some sensitive report-response code.

Leave a Reply