Friday, February 26, 2010

How to return Images or Files with the HTTP Server (MFToolkit)

Is it somehow possible to have a static webpage with some images stored in Resources? I mean the web page can be treated just as string and sent to client, but i have been unable so far to send image file. I can get the image from resources

Bitmap image = Resources.GetBitmap(
    Resources.BitmapResources.Image1
);

But what to do then? how to read bytes from these image and send them to client? Or is there some other way? I don’t want to use SD card or anything external, that would be a waste of resources.

Well, if you add an image to the embedded resources (Resources.resx) Visual Studio will use it as a bitmap (see the example above). In older Micro .NET Framework it isn’t really easy to get the bytes from an image.

The best way to return images do following:

  1. Rename your image xxxx.jpg to xxxx.bin
  2. Open Resources.resx and select the type files (instead of type images)
  3. Click on add new file, select file filter *.*
  4. Select the image xxxx.bin which will be added as xxxx embedded resource

Then you can use following code in your HttpHandler:

if (context.Request.RawUrl == "/xxxx.jpg")
{
    context.Response.ContentType = "images/jpeg";
    context.Response.Write(
        Resources.GetBytes(Resources.BinaryResources.xxxx)
    );
}

You can do the same with any static file as well as text files (*.html).

TFT Display / VGA Monitor connected to .NET MF Device

GHI Electronics offers many hardware modules running .NET Micro Framework, like EMX and ChipworkX. They all support TFT displays with 16-bit 5:6:5 RGB color depth.

GHI-00123 With this interface, users can use about any TFT display. Some applications, like handheld devices, may require a 320x240 3.4" display. Others, like vending machines, may need a 640x480 7" displays. What about airport informational center? Those will probably need a 12" 800x600 displays. What is important is that GHI NETMF modules can work with all these options. Through a simple call to the GHI managed libraries, a user can set the default settings for display, including resolution, HSYNC, VSYNC and clock.

Read the full story

Friday, February 19, 2010

.NET Micro Framework Partners at Embedded World 2010, Nuremberg

The big embedded show for the year in Europe is coming up and some of the .NET MF partners there have gotten together to present a booth on the .NET Micro Framework. This is the first time that the platform has had it's own booth since we first started. The companies include the full range of services, hardware, and add-on libraries:

Look them up when you are at the show. They will be in hall 11, stand 226.

If you have more time we (.NET MF developers and hardware partners) will meet each other outside the Embedded World somewhere in the city of Nuremberg, more details later.

Still don’t have a free ticket? Get your free 3-day-ticket worth 25 EUR here.