|
|
Compact Framework
Last post Tue, Aug 12 2008 10:00 AM by Anonymous. 15 replies.
-
Wed, Apr 18 2007 1:54 PM
|
|
-
weston



- Joined on Wed, Apr 18 2007
- London, UK
- Posts 4
|
Hi, Love the library, but I really want to get it working on the compact framework. (I'm making an accelarometer display for my car first off!) I've tried to put all the code into a CF 2.0 library, but Microsoft.Win32.SafeHandles is not in the mscorlib for CF. Any chance you can make a CF version? Alan
Alan
|
|
-
-
-
weston



- Joined on Wed, Apr 18 2007
- London, UK
- Posts 4
|
Hi Brian, I've changed the SafeHandles for IntPtrs, but I am having trouble converting a line over to use them. I changed HIDImports.CreateFile to return an IntPtr, but I can't see how to translate the line: mStream = new FileStream(mHandle, FileAccess.ReadWrite, REPORT_LENGTH, true); As the FileStream constructor you are using is from Microsoft.Win32.SafeHandles. I've tried things like: mStream = new FileStream(diDetail.DevicePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, REPORT_LENGTH, true); But this raises exception that illegal characters are in the path. Can you dig out your early tests using IntPtrs, or remember how you did that line? Cheers, Alan
Alan
|
|
-
-
Brian Peek



- Joined on Sat, Mar 18 2006
- Niskayuna, NY
- Posts 1,127
|
Is there no: FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync) In the Compact Framework?
|
|
-
-
weston



- Joined on Wed, Apr 18 2007
- London, UK
- Posts 4
|
No, just: FileStream Constructors FileStream(System.String, System.IO.FileMode) Constructor FileStream(System.String, System.IO.FileMode, System.IO.FileAccess) Constructor FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare) Constructor FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, int) Constructor FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, int, bool) Constructor
Alan
|
|
-
-
Brian Peek



- Joined on Sat, Mar 18 2006
- Niskayuna, NY
- Posts 1,127
|
Hmmmmm....you may be out of luck then. I dug around a bit and couldn't find anything regarding turning a handle into a FileStream on the CF. I'm not sure it's possible. If it isn't, you'd have to implement the read/write routines using pinvoke's to the Win32 Read/Write file equivalents which would be a gigantic pain. I'll continue to research but I don't think I'm going to find much... I've been chatting with someone else attempting to get things running on the CF and he's run into issues with the pinvoke signatures for the hid.dll methods. Have you run into this? From what I gather, hid.dll and the standard HID interface isn't on Windows Mobile devices...or at least his device and my Treo 700w.
|
|
-
-
weston



- Joined on Wed, Apr 18 2007
- London, UK
- Posts 4
|
I've not got that far, does that mean he has got over my problem some how? Or is he not starting out with your library code? My device is an SPV M500.
Alan
|
|
-
-
-
Lionel



- Joined on Tue, Apr 24 2007
- FRANCE
- Posts 1
|
Hello Brian and Weston. Sorry for my late answer but I was very busy these last days. Indeed Weston, I exactly met the same problems when I started to work on a .Net CF version of Brian's library (the SafeFileHandle and the FileStream compatibility problems with .Net CF). I fixed the SafeFileHandle problem by replacing it by IntPtr. And for the FileStream problem, the following line worked for me : mStream = new FileStream(diDetail.DevicePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, REPORT_LENGTH, true) It's strange that it doesn't work on your SPV M500. Which version of Windows Mobile do you have on your device ? After that, as Brian said, I've got some problems with the hid.dll library that isn't on Windows Mobile (for information, my device is an Axim X51v with Windows Mobile 5.0). Now, I'm trying to find a solution by using the Device Manager functions of .Net CF (http://msdn2.microsoft.com/en-us/library/ms849618.aspx).
|
|
-
|
|
I'm looking to put in some work on making the wiimote available in WM5 as well. I've got a strong general programming background and have done a little driver-level work with apple's IR remote. I ended up here after discovering the lack of SafeHandles in the .NET CF. My goal is to get generic gamepad support with buttons and analog sticks (can't see any immediate need for linear data from the accelerometer/sensor for gamepad support).
Is this goal pretty much in line with everyone else's? Could we maybe setup a wiki or pick a place on irc to meet up? I think there would be a lot of happy ppc/smartphone users if we could get generic gamepad support working. And since it's been done in all the major desktop os's, it can't be too hard, right? :)
-justinb (Also working off an x51v)
|
|
-
-
-
justinb


- Joined on Mon, May 7 2007
- Posts 2
|
ok lionel, weston and I are marginally in contact. anyone else that wants to join a team that's officially forming, now's the time to speak up :)
any kind of usb hid experience would be useful, i have found free source code to a usb hid driver for winmobile that contains the button emulation that will work across most if not all games.
as I understand it bluetooth is a tcp-like network connection that serves to carry a standard usb hid protocol.
specific experience with compact framework might help, but it seems at the managed level to be scarcely any different than programming for desktop windows.
It looks like ALL of the native p/invoke calls in brian's code can be replaced with an even simpler winmobile equipment, the interface is the usb hid filehandle, and we can easily round up the calls to get that on winmobile.
First and foremost I would like for us to get a source repository going, but I would like to give people a chance to speak up and have input on what we use. I would be equally happy with Codeplex/TFS or Sourceforge or a managed (or if someone wants to admin and/ host...) SVN server.
so c'mon, speak up people, we need your help and your input! :) :)
Justin Burns justinb(26)at(gmail.com) judas1045@aim
|
|
-
|
|
I am very interested in this
|
|
-
|
|
I am very interested in this too. It would be great to have these changes included in the library itself with some # defines so if you build it on CF or full .NET the library works on both. Did anyone get this working? If so could they provide the patches so we can include it in the main library?
|
|
-
-
Brian Peek



- Joined on Sat, Mar 18 2006
- Niskayuna, NY
- Posts 1,127
|
A few people were working on this, but I don't think they got very far. It's not nearly as easy to do on Windows Mobile as it is on a PC. Here's a link to their project: http://www.codeplex.com/WiiMoB/ Regardless, I don't think it'll be as easy as a couple of defines to block out code. The Windows Mobile side of things is pretty different in terms of BT and I don't believe the concept of the USB HID stuff exists, or at least not in the same way, which is how the library currently connects on the PC.
|
|
|
|
|