# Monday, May 29, 2006

For those interested in the quick version of how I got where I am, I just posted my partner profile at OpenNETCF.  If you want a more detailed version you'll have to catch me in person and buy me a beer.

Monday, May 29, 2006 2:19:41 PM (Central Daylight Time, UTC-05:00)  #     | 
# Friday, May 26, 2006

Ever have to do manual serialization of data in a DataSet?  The challenge is being able to call BitConverter.GetBytes on the data element when at compile time you have no idea what it's type is, and GetBytes doesn't accept an Object (though I'd argue maybe it should and attempt to convert the underlying type if it's resolvable).

Here's my solution:

byte[] elementBytes = (byte[])typeof(BitConverter).GetMethod(
   
"GetBytes", new Type[] { dataRow[columnNumber].GetType() }).Invoke(
    null, new object[] { dataRow[columnNumber] });

Friday, May 26, 2006 12:09:56 PM (Central Daylight Time, UTC-05:00)  #     | 
# Tuesday, May 16, 2006

Well actually it's not a first look.  You might recall the .netcpu development kits that shipped over a year ago that I wrote a little bit on.  Well the TinyCLR went back into the Microsoft oven to bake a while more and samples were pulled out at MEDC 2006 for attendees to try.

What is the Micro Framework (.NET MF)?
It's a very scaled down CLR and BCL that is capable of running on 32-bit architecture processors without any underlying OS.  Basically the MF has its own bootloader and OAL.  Developers write managed code (C# is the only thing supported in the community preview) that runs directly against the MF.  The MF code can directly catch interrupt vectors and set hardware pin states (how cool is that?).  The working size of the MF is ~250k. Yes 250k.

Where can I get the MF?
The MF is still in very early stages and isn't quite ready for a broad release.  MEDC provided a somewhat controllable release area where immediate feedback could be gotten from users and the hardware was a specific known set.

What exactly did MEDC attendees get?
They got a SumoRobot kit that was based on the Parallax SumoBOT.  It was not just a Parallax bot.  It had a custom PCB running a non-commercial ARM processor.  That means that even if you get the SDK, you cannot just go get a Parallax bot and use it (I've been asked a few times about this now - sorry for not being clear on it at the conference).  The attendees also got a early SDK that allowed for development against the bot.  The lucky 40 or so who actually got hardware got to take it home.

On Tuesday I held a lab where I walked through development and how to test the hardware, plus provided a little sample code.  On Wednesday night those with SumoRobots got to test them in a competitioon against one another.

I'm jealous.  Where can I get MF hardware?
There isn't anything available today, but the beta MF will be out in a few months and there are some hardware vendors working hard to have development kits ready to ship when that happens.  To keep up to date sign up at the MF web site.

Will OpenNETCF be doing stuff with the Micro Framework?
Silly question.  We already are.  We wrote the documentation for the SumoRobot and the lab and are working hard to make sure we can provide the value and platform extension work that you've come to expect from us.

Tuesday, May 16, 2006 10:12:39 AM (Central Daylight Time, UTC-05:00)  #     | 
# Thursday, May 11, 2006

For those who attended any of my sessions at MEDC, below are links to the downloads.

SumoRobot Lab Manual
SumoRobot Sample Code
HeapTest RPM Test App
CF RPM provisioning file for WM 5.0

Thursday, May 11, 2006 5:38:12 PM (Central Daylight Time, UTC-05:00)  #     | 
# Tuesday, May 09, 2006

In one of the hands-on labs here at MEDC a developer asked how to pass a managed funtion to a native DLL as a callback function.  I promised him a sample, so here's a simple one that shows how to call EnumWindows:

 

public delegate int EnumWindowsProc(IntPtr hwnd, IntPtr lParam);

public partial class Form1 : Form
{
    EnumWindowsProc callbackDelegate;
    IntPtr callbackDelegatePointer;

    [DllImport("coredll.dll", SetLastError = true)]
    public static extern bool EnumWindows(IntPtr lpEnumFunc, uint lParam);

    public Form1()
    {
        InitializeComponent();

        callbackDelegate = new EnumWindowsProc(EnumWindowsCallbackProc);
        callbackDelegatePointer = Marshal.GetFunctionPointerForDelegate(callbackDelegate);

        EnumWindows(callbackDelegatePointer, 0);
    }

    public int EnumWindowsCallbackProc(IntPtr hwnd, IntPtr lParam)
    {
        System.Diagnostics.Debug.WriteLine("Window: " + hwnd.ToString());

        return 1;
    }
}

Tuesday, May 09, 2006 7:44:10 PM (Central Daylight Time, UTC-05:00)  #     |