[VB.NET] Bluetooth Setup

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

[VB.NET] Bluetooth Setup

Post by thegamefreak0134 »

I'll be blunt about this. I want to be able to access and controll/update the wiimote with the bluetooth device on my computer.

I use VB.NET for all of my PC developing. I did some basic searches and I'm not quite sure where to start. If I can get my program to send and recieve reports from the Wiimote, I can run from there. So here is what I need to know:

I can already pair with a bluetooth device, I have a program that does that for me. I need to know how (using VB.NET) to access the list of available bluetooth devices on the computer. I then need to know how to send and recieve packets to and from the device. Once I have it doing this (and have a nice event set up for handling recieved packets) I should be able to work out the logic of handling the remote relatively easily, thanks to the wealth of information on the subject.

Can someone help me out with this "should-be-so-simple" operation? Thanks!

-thegamefreak0134
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

It's probably easier to download the Windows joystick driver and treat the controller as a standard joystick.

I can't recommend any Bluetooth libraries for .NET. This one looks good, but $99 is probably a bit much.
I can already pair with a bluetooth device, I have a program that does that for me.
What do you mean by that? Windows manages Bluetooth devices itself - do you mean that?
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

No, I mean I use a program (the one that came with my bluetooth adapter) instead. The windows drivers aren't fully compatable with the wiimote for some odd reason...

Anywho, I need a library? Darnation. OK, I will look into that. I will also need to figure out (once and for all, since I have never known) how to actually install and use libraries.

I will get back to you on which driver I am using. The tutorials I have (for the wiimote implementation) mention a lot about sending "reports" to and from the device. I can only assume this means sending packets that are specially formatted, but if a "report" is a bluetooth specific thing I would need to know that.

I can get some limited functionality with GlovePIE to use it as a joystick. However, I need full low level access to do other things, such as read the memory on the wiimote (to get at mii data) and to play sound through the speaker.

-thegamefreak
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

thegamefreak0134 wrote:No, I mean I use a program (the one that came with my bluetooth adapter) instead. The windows drivers aren't fully compatable with the wiimote for some odd reason...
Probably because it's not intended to be used with anything besides the PC. I wouldn't expect any help on this project, for that reason alone... Sorry.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

maybe this (http://szymonbanka.com/~kari/) could help you
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

OK, ok, so he used a "HID" library. I've seen references to this kind of thing before, and it appears to simply be a .dll file that I could problably use.

Does anyone have more information on HID? These kinds of programs written to convert the wiimote to axis and things are nice, but I need to be able to access it directly, as I've stated. The best I will be able to do with a wrapper is map the wiimote to the axis of an emulated joystick and read them from VB.NET. Not alltogether a bad idea I suppose, but it (unless this program is different, and I will look more into it when I get home with my wiimote again) doesn't let me do things like read out the memory and play with sound and such.

-thegamefreak

PS: HID apparently is able to access devices from within VB.NET, which is a plus. (I sorta figured it was a C thing, which I can do as well, sort of.)
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

I'm making a wii game right now, but it's in C++. There are a couple C++ libs for the wiimote but I'm not sure if there's one for VB.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

we could just build a wrapper around it..
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

You could either write a C++/CLI class library that handled the interop for you, or the requisite DllImport signatures in VB. It's usually pretty straight-forwards - article on P/Invoke.
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

Wow ben, I didn't know you spoke greek...

Well, I apparently am going to have to find some time to dive headfirst into code to understand any of this at all... I'm relatively certain that what I need is a Bluetooth HID (not the USB one, but I think I do have that .dll file) and a way to access it. I believe it has .NET compatibility, so I ask this simple question:

How on earth does one access the functions in a dll file? Better yet, how does one figute out what all is in a dll file in the first place?

I know, I know, I look really stupid right now. Thing is, you don't generally have to use dlls and libraries and things for programming contests (which is what I usually study for) so I am limited in a lot of knowledge.

Thanks again. BTW, (just saw this) congrats on all your MCF awards ben.

-thegamefreak
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

That's basically what the whole P/Invoke article is about..
But it depends on what kind of DLL it is, if its .NET you can just import them, otherwise you'll have to do the P/Invoke trick..

(That's right isn't it?)
Post Reply