BrianPeek.com

A Compendium of Random Uselessness
in Search

Compact Framework

Last post Tue, Aug 12 2008 10:00 AM by Anonymous. 15 replies.
Page 1 of 2 (16 items) 1 2 Next >
Sort Posts: Previous Next
  • Wed, Apr 18 2007 1:54 PM

    • weston
    • Top 50 Contributor
      Male
    • Joined on Wed, Apr 18 2007
    • London, UK
    • Posts 4

    Compact Framework

    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
  • Fri, Apr 20 2007 12:53 PM In reply to

    Re: Compact Framework

    We've already discussed via email, but for the others, you should be able to turn the SafeHandles into plan old IntPtr's and manage the cleanup yourself in the Dispose method.
  • Sun, Apr 22 2007 9:26 AM In reply to

    • weston
    • Top 50 Contributor
      Male
    • Joined on Wed, Apr 18 2007
    • London, UK
    • Posts 4

    Re: Compact Framework

    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
  • Sun, Apr 22 2007 7:21 PM In reply to

    Re: Compact Framework

    Is there no:

     

    FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)

     

    In the Compact Framework? 

  • Mon, Apr 23 2007 1:49 PM In reply to

    Re: Compact Framework

    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. 

  • Tue, Apr 24 2007 7:01 AM In reply to

    • weston
    • Top 50 Contributor
      Male
    • Joined on Wed, Apr 18 2007
    • London, UK
    • Posts 4

    Re: Compact Framework

    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
  • Tue, Apr 24 2007 12:14 PM In reply to

    Re: Compact Framework

    I'm not certain.  I've asked him to post a msg in this thread but I haven't heard back from him.

    What version of Windows Mobile are you compiling against in VS.NET? 

  • Tue, Apr 24 2007 12:43 PM In reply to

    • Lionel
    • Top 75 Contributor
      Male
    • Joined on Tue, Apr 24 2007
    • FRANCE
    • Posts 1

    Re: Compact Framework

    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).

  • Sun, May 6 2007 9:49 PM In reply to

    Re: Compact Framework

    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)
  • Sun, May 6 2007 9:51 PM In reply to

    • justinb
    • Top 50 Contributor
    • Joined on Mon, May 7 2007
    • Posts 2

    Re: Compact Framework

    (signing up for an account in case anyone wants to send a pm)
  • Thu, May 10 2007 10:44 PM In reply to

    • justinb
    • Top 50 Contributor
    • Joined on Mon, May 7 2007
    • Posts 2

    Re: Compact Framework

    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
  • Sun, Aug 26 2007 1:28 PM In reply to

    Re: Compact Framework

    I am very interested in this

  • Thu, Aug 30 2007 11:02 AM In reply to

    Re: Compact Framework

    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?

  • Thu, Aug 30 2007 11:48 AM In reply to

    Re: Compact Framework

    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.
     

Page 1 of 2 (16 items) 1 2 Next >
Copyright (C) 2008 Brian Peek
Powered by Community Server (Commercial Edition), by Telligent Systems