Author Topic: Reformated WiimoteLib to WiimoteController  (Read 8507 times)

Offline k^s

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
on: January 11, 2008, 04:19:43 PM
Hi,

I've been analizying the source code of the wiiprojects and I relized that all of them have the sources of the WimmoteLib, so I decided to change a little the structure of the projects, in order to be a little smart with the code.

So I've created a new project called WiimoteController, which has all the files included in the WiimoteLib.

By the way I've made some changes to the code, because its structure seemed more to C++ programming structure than C#.

Ok, here are the list of changes i've made:

* Code outlined by regions.
* InputReport Added type Unknown with 0xFF value (it really doesn't belong to the Wiimote protocol, just added with programatically purpose only).
* WiimoteChangedEventArgs now has an InputReport parameter in order to indicate what has been changed when the WiimoteChangedEventHandler event is raised.

o Wiimote :
* ParseInput now returns InputReport instead of boolean. Now you can use "Unknown" instead of False in order to pass it to the WiimoteChangedEventHandler event, and when its catched you can determine by this parameter what to to.
* Deleted unnecesary castings to float.
* IsRemoteConnected now is static
* DecryptBuffer now is static.
* Added ActualReportType property to expose mReportType because was assigned but never used.
* Changed GetNumConnectRemotes() to property ConnectRemotes.
* Changed GetRemoteID() to property RemoteID.

The sources and compiled libreary can be downloaded from here:
http://www.kas.unexpected.es/Software/WiimoteController.rar

I absolutely recommend all of you using ReSharper when programming with C#, it really brings yo to a new deveolpment era.

I will contact Brian Peek as soon as posible to inform him about this post.



Offline k^s

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Reply #1 on: January 12, 2008, 04:37:33 AM
Today I've spent about an hour to document the HIDImports.cs, gathering the infromation from the MSDN and http://www.osronline.com.

Also I've "regioned" this code codument. Maybe is not a big  change, but now every programmer can know what is doing with every HID funciont fithout having to leave visual studio and consult google or msdn :)

Because isn't a big change, if decided to overwrite the first version at my ftp and don't control version by now.



Offline Thomas

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #2 on: January 14, 2008, 11:43:37 AM
Nice work but I am sad that it use C#. A multiplatform language would be better, like C ANSI or JAVA. If I will have free time, I will try to convert WiimoteLib into a more multiplatform language;



Offline skobyjay

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #3 on: January 15, 2008, 03:05:00 PM
Hi,

I've been analizying the source code of the wiiprojects and I relized that all of them have the sources of the WimmoteLib, so I decided to change a little the structure of the projects, in order to be a little smart with the code.

So I've created a new project called WiimoteController, which has all the files included in the WiimoteLib.

By the way I've made some changes to the code, because its structure seemed more to C++ programming structure than C#.

Ok, here are the list of changes i've made:

* Code outlined by regions.
* InputReport Added type Unknown with 0xFF value (it really doesn't belong to the Wiimote protocol, just added with programatically purpose only).
* WiimoteChangedEventArgs now has an InputReport parameter in order to indicate what has been changed when the WiimoteChangedEventHandler event is raised.

o Wiimote :
* ParseInput now returns InputReport instead of boolean. Now you can use "Unknown" instead of False in order to pass it to the WiimoteChangedEventHandler event, and when its catched you can determine by this parameter what to to.
* Deleted unnecesary castings to float.
* IsRemoteConnected now is static
* DecryptBuffer now is static.
* Added ActualReportType property to expose mReportType because was assigned but never used.
* Changed GetNumConnectRemotes() to property ConnectRemotes.
* Changed GetRemoteID() to property RemoteID.

The sources and compiled libreary can be downloaded from here:
http://www.kas.unexpected.es/Software/WiimoteController.rar

I absolutely recommend all of you using ReSharper when programming with C#, it really brings yo to a new deveolpment era.

I will contact Brian Peek as soon as posible to inform him about this post.

I have tried to download your WinRAR and the file doesn't contain sources and I recieve errors when trying to open the RAR. Would you mind posting a new RAR ?

if it helps the error is "end of file expected"
 

Thanks in advance



Offline dice

  • Site Admin
  • Administrator
  • *
  • Posts: 441
  • Karma: +18/-0
    • View Profile
    • Wiimote Project
Reply #4 on: January 15, 2008, 03:25:27 PM
I have tried to download your WinRAR and the file doesn't contain sources and I recieve errors when trying to open the RAR. Would you mind posting a new RAR ?

if it helps the error is "end of file expected"
 

Thanks in advance

Same I did a repair and still got errors.. Might need to repack this and reupload it. I use 7zip it seems not to have errors as much.

Dice



Offline bryanarby

  • *
  • Posts: 89
  • Karma: +2/-1
    • View Profile
Reply #5 on: January 16, 2008, 10:59:27 AM
if it's gonna be translated to a diferent language i would say C or C++ first. most comonly used by programmers as it has huge capability's. When it's done translate that to java or what ever you want.

wiipen
point ATM: building V2
V1: 1 LED on 1 AAA battery feed
V2: 1 LED on USB feed
V2 will be remodded too V3
V3: 1 LED on USB feed /w LMB and RMB
V4: 1 LED WIRELESS /w LMB and RMB
V5: we'll see :3
Vmany: Bluetooth IR pen with mouse functions.


Offline tgraupmann

  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Reply #6 on: January 19, 2008, 08:35:47 PM
* Changed GetNumConnectRemotes() to property ConnectRemotes.

Where does this property reside? I can't find ConnectRemotes anywhere?



Offline PixelPartner

  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Reply #7 on: May 09, 2008, 11:26:15 AM
Nice work but I am sad that it use C#. A multiplatform language would be better, like C ANSI or JAVA. If I will have free time, I will try to convert WiimoteLib into a more multiplatform language;

With Mono, Gtk# and Moonlight C# and cobra already became multiplatform languages.
But I agree with you that it's a long way to cover ALL type of projects with anything except C/C++.

I'll have a look at ReSharper but definately cobra also started a new era.
Coding in python style with the best features of 8 modern languages and your result is a well formed and documented C# source file AND a multiplatform .NET executable.


I just started an open hardware project as a building block for all sorts of head tracking AND stereo3D related Wiimote projects
« Last Edit: May 09, 2008, 11:43:05 AM by PixelPartner »