# Tuesday, January 18, 2005

Mobile and Embedded Developer Conference 2005

Announced on the Windows Mobile blog, this year will see the Mobile and Embedded developer conferences combined into one event happening in Las Vegas 9th-12th May.

This year there will be lots of exciting content around .NETCF v2.0 and Visual Studio 2005 along with coverage of Windows Mobile and Windows CE and XP Embedded.

Go on, write that date somewhere important :-)

#    Comments [0] |
# Saturday, January 15, 2005

Designing Class Libraries Series

Brad Abrams' team at Microsoft have started a series of Webcasts around class library design. The introductory session is available on the site now with a further 13 sessions to follow. A chat session is scheduled to follow on the topic of each week, the first of which will be this Wednesday. There are some exciting topics coming up in the series so it's definately something you should keep an eye out for. A full schedule is on the Designing .NET Class Libraries website:-

http://msdn.microsoft.com/netframework/programming/classlibraries/

#    Comments [0] |

Bluetooth Build 50115

I've posted an updated build of the Bluetooth library here. It adds full support for the desktop, improved class-of-device and other properties.

The sample app is now supplied in Pocket Pc, Smartphone and Desktop versions which all talk to each other.

#    Comments [8] |
# Wednesday, January 05, 2005

.NETCF Service Pack 3 is out - Go Get It!

.NETCF SP3 Redistributable can be downloaded from here:-

http://www.microsoft.com/downloads/details.aspx?amp;displaylang=en&familyid=a5a02311-194b-4c00-b445-f92bec03032f&displaylang=en

List of fixes grabbed from the above page:-

Fixed Issues:
- Transitions between managed and native code can cause memory leaks on ARM platforms.
- A NullReferenceException is thrown when a Web Method returns an empty array using the xsi:Nil attribute.
- Modifying the SoapClientMessage.ContentType property does not modify the Http requests ContentType header.
- Stack corruption can occur on SH, MIPS and x86 platforms when local variables are created but never used.
- Invoking a multicase delegate from a catch handler throws a MissingMethodException on SH, MIPS and x86 platforms.
- Command line arguments containing double byte characters are truncated to a single byte.
- An ObjectDisposedException is thrown when a asynchronous web request is aborted before the response is received.
- Invoke on a disposed control hangs the application.
- Any array containing one or more elements is not sent to the Web Service correctly.
- An application may hang when invoking a Web Method that uses multiple XmlElementAttributes on a single argument, member or property.
- Memory corruption can occur on devices that have the native security model enabled and both .NET CF V1 SP3 and a pre-release version of .NET CF V2 installed.
- Deadlocks can occur when running under severe resource constraints.
- Tool Bar's on Windows Mobile 2003 SE no longer lose their images when removed from the form.
- An uncatchable ObjectDisposedException is thrown when the server closes the socket connection.
- Setting the Minimum and Maximum properties of a progressbar no longer crashes the application.
- Unexpected exception while adding an image to an imagelist on an Hx4700 and hx4705.
- Data Misalignment occurs on Decimal fields in MIPSIV devices.

#    Comments [0] |
# Tuesday, January 04, 2005

GetEntryAssembly for .NETCF

If your application contains multiple levels of DLL files, you may want to determine the name and path of the original calling executable. On the desktop you can use Assembly.GetEntryAssembly() but this is not available in the Compact Framework. I have added an equivalent to the SDF code to work in just the same way, using Platform Invoke. It uses the GetModuleFileName API which when passed IntPtr.Zero for the module handle, returns the path of the calling exe. Assembly.LoadFrom is then used to return the Assembly object corresponding to this path. Since the exe is already loaded this will not increase the overhead of your application. From the returned Assembly object you can determine the Path, Version etc as required.

The full code for AssemblyEx is available in the online Source Browser, and will be built into a future SDF release.

#    Comments [0] |
# Friday, December 24, 2004

Rudolph the Bluetoothed Reindeer

I've uploaded a new release of the Bluetooth library which adds the key feature of hosting services over bluetooth. This now allows two-way communications between devices and to demonstrate how this works I've included a sample Bluetooth Chat application. This registers a custom bluetooth profile and listens for incoming connections, and creates outgoing connections using this service identifier to other devices. In this way it only communicates with other devices exposing this service and wont interfere with any other applications using Bluetooth.

Thanks go out to Wei-Meng Lee for giving permission to base the sample on his previous IrDA chat application available with this MSDN article. The Bluetooth version works in a very similar way, with the exception of doing a device discovery when it first loads. An enhancement yet to be added is the ability to periodically discover in a background thread. From the app screen select the target device which must also be running the software and Bluetooth must be Discoverable. Then type your message and click send and it will appear onscreen on the other device. In the below example I had a brief conversation with Santa who was half-way up a chimney at the time - such is the versatility of Bluetooth :)

Bluetooth Chat

The ZIP file below includes the Bluetooth library project and compiled output, and the BTChat sample project. As I get time to do more work on the library I'll post some other examples, and include versions for other platforms e.g. Smartphone and XP.

Known issues:-

  • Hosting services doesn't yet work on XP (some of the structures are slightly different so this requires a little more work)
  • BluetoothClient.RemoteDeviceName doesn't work so you can't retrieve the device name from an open connection (Device names work correctly during discovery on both Windows CE and XP)
  • BluetoothSerialPort (For emulating a COM port) is not fully tested and probably doesn't work - SerialPortProfile connections work great using sockets (BluetoothClient).

Requirements:-

  • SDF v1.2
  • Windows CE Device or Windows XP computer using the Microsoft Bluetooth stack (Sorry but Widcomm is not supported).

Download:-

Downloads

 

If you have any comments or questions please drop me an email. For now all that remains is for me to wish you a Very Merry Christmas!

#    Comments [2] |
# Wednesday, December 15, 2004

New in .NETCF v2.0

Jono posted a link to a new section in the online Beta documentation at MSDN which describes in some detail whats new in v2.0 of the Compact Framework. This includes new framework features and a list by namespace of the new classes introduced in v2.0.

 

#    Comments [0] |
# Monday, December 13, 2004

System.Net.IrDA for the desktop (Part 2)

Following my previous post, I did some further development to the code to make it fully match the .NETCF assembly (yes, in my haste I'd missed a few properties and cut a couple of corners). So now I have compiled a System.Net.IrDA.dll assembly which has exactly the same classes and methods as is available in device projects. So you can easily move device code over to Tablet and laptop PCs.

Download the DLL here (zip 7kb)

The package includes just the dll and xml documentation. The next task for the project is to build an installer for both the source and binaries...

This was a useful learning experience since I've based the Bluetooth code on the existing model of the IrDA library, so it was useful to spend some time studying this particular library and the classes it contains.

The functionality is now part of 32feet.NET a library for personal area networking for .NET. The downloads are here:-

http://inthehand.com/files/folders/releases/default.aspx

#    Comments [2] |
# Thursday, December 09, 2004

System.Net.IrDA for the desktop

Following on from a question which cropped up on today's MVP chat. I did some investigation into IrDA support on the desktop framework. Turns out you can't use System.Net.IrDA.dll from .NETCF on the desktop as I had read on some blog, but since the basic Socket class supports the IrDA address family, it is necessary to build a couple of helper classes for the IrDAEndPoint and IrDAClient and IrDAListener to match the .NETCF implementation. I built these rather hastily and therefore have omitted a few overrides and non critical items. I intend to flesh this out later to fully match the .NETCF class. However the code zipped up below will give you the classes necessary to migrate your .NETCF IrDA code to the desktop. It was tested using the sample code in the .NETCF Quickstart on the subject to Discover my Pocket PC and send it a file. When I get the chance I'll compile it into a System.Net.IrDA.dll, for now you'll have to make do with C# source, and I didn't really stop to write comments this evening - sorry :)

Download Source

#    Comments [1] |

Online Bluetooth code updated

There were some recent enquries on the OpenNETCF Forums about the current Bluetooth code. It seems I had refreshed the website with some development code which would only work if a couple of items were commented out. This is because these classes (Sdp related) are still under development and require COM interop and are currently built against InTheHand.Interop.dll which does COM interop with no native DLL required, and is used in my PocketOutlook and ADOCE products.

So I've updated the code online and attached a .zip of the project below which will build successfully against the v1.2 SDF (and the compiled dll is included in the bin folder). Documentation is in the online library at http://32feet.net/library/

I'm working on a sample application to accompany the library, but it's been tested with a Bluetooth GPS unit and a Jabra headset successfully (Before you ask it only uses the control functionality of the headset, not the audio stream). But you can programmatically make the headset ring and capture the event when the user presses the answer button. Not terribly exciting but an interesting start, I guess I need some more unusual Bluetooth devices to test against.

What isn't working in this release is the ability to host a service and allow other devices to discover it, since this requires some of the ongoing Sdp work. Once this is in place you will be able to do data transfer between devices which is when the fun will really begin!

Also bear in mind this is designed to work only with devices with the Microsoft Bluetooth stack, for example HTC Phone Edition devices and most Smartphone 2003 models.

Downloads

#    Comments [2] |
# Saturday, December 04, 2004

Forms Anywhere built around OpenNETCF Smart Device Framework

Via Jono's Blog:-

'Forms Anywhere is an attempt to provide a development platform for data capture using the Pocket PC. It handles all data collection tasks from creation to capture, all that is needed on the back end is the code to integrate your application.'

The code for Jim Lavin's Forms Anywhere is available in a GotDotNet workspace. The project uses OpenNETCF's Smart Device Framework for missing controls such as the DateTimePicker and the Desktop Communications library to implement desktop synchronisation. An impressive project, well worth a look.

#    Comments [1] |

Using OpenNETCF.Phone.Sms

Dag König has posted an example to his blog showing how to add Sms sending to your application using the OpenNETCF.Phone.Sms class and just 4 lines of code - check it out.

#    Comments [0] |
# Wednesday, December 01, 2004

New version of .NETCF GDI+ Library

XcrossOne Studio have just released a new v1.2 release of their incredible looking GDI+ library for .NETCF. A key change in this release is a switch to a Shared Source license, similar to what we use with our OpenNETCF projects.

This means that you are no longer restricted to releasing any works using the code in source form, this should have a dramatic effect on the number of people able to use the library. You can achieve some pretty impressive visuals, as demonstrated in the large gallery of samples on the site. This latest version adds the ability to combine raster images and anti-aliased text with the vector based drawing.

#    Comments [0] |
# Saturday, November 27, 2004

CLS Compliant WaitForSingleObject

Maartens recent blog post highlighted an issue with the current SDF implementation of Core.WaitForSingleObject when used from VB.NET since this method was not CLS Compliant and used unsigned integer types for both parameters and return type. Because of the values used by this function its very easy to convert it to be CLS compliant, so from the next release you'll be able to call it just as easily from both C# and VB. The method only accepts a timeout value up to 0x7fffffff which incidently is the maximum positive value for an Int32. The exception to this is a special constant passed when you want to wait indefinately on a handle - 0xffffffff which just happens to be -1 when interpreted as a signed integer. The same transformations are posible on the Wait enumeration which is the return type for the method. The amended code is already up on the online source browser. Therefore to wait with a 1s timeout on a handle in a loop you can now do this from VB:-

While WaitForSingleObject(myWin32Event, 1000) <> Wait.Object

            'do stuff here

End While

#    Comments [0] |
# Monday, November 22, 2004

Toggle Bluetooth on an iPaq device

We can already enable and disable Bluetooth on devices equipped with Microsoft's Bluetooth stack. In the case of iPaq devices, which use the Widcomm stack, it is possible to toggle the radio state using an API provided in HP's iPAQUtil.dll. This can be P/Invoked from a .NETCF project like so:-

[DllImport("iPAQUtil.dll", SetLastError=true)]

public static extern bool iPAQSetBlueToothRadio(ref int lpdwValue);

Which you can then call with:-

int val = 0;

iPAQSetBlueToothRadio(ref val);

Where val is either 0 to disable Bluetooth, or 1 to enable it. Tested on an iPaq 2210 but should work on any other iPaq device with Bluetooth.

Update:-

The following should also work for devices with WiFi built in:-

[DllImport("iPAQUtil.dll", SetLastError=true)]

public static extern bool iPAQSetWLANRadio(ref int lpdwValue);

But I've not been able to test this myself.
#    Comments [1] |
# Friday, November 19, 2004

From the Mobility Road Show

Thom Robbins posts some Powerpoint slides and code from the recent Mobility Road Shows. Check out "Mobility and Visual Studio 2005" for a good overview of NETCF 2.0 development features.

#    Comments [0] |
# Saturday, November 13, 2004

Hosting a Native Windows Control - The desktop approach

As a follow on to my recent article, I have compared and contrasted the System.Windows.Forms.Control classes in desktop and compact frameworks.
#    Comments [0] |