Tuesday 15 May 2007

New contributor

This is my first post and should go someway to introduce myself and let you know my relevant background and experience.

My name is Nigel Goodyear and I've spent 19 years in the mobile and embedded computer industry. 14 of these working at a rugged handheld manufacturer, Husky Computers (now Itronix) and have been with Intrinsyc since 2002.

Both jobs have led to in depth experience with mobile computers, embedded systems and wireless communications.
My Microsoft Windows Embedded experience includes:
  • Porting BSP's, device drivers and low level firmware
  • Windows Embedded CE version 2.11 to 6.0 and Windows Mobile
  • Customer Account and Project Management
(q) No prize - but does anybody remember the o/s variant and kernel this device executed?




Thursday 3 May 2007

Bluetooth Stacks and Windows Mobile

If you want to programmatically access the Bluetooth stacks on Windows Mobile its worth knowing that the Pocket PC stack is different from the stack in Smartphone.

Pocket PC uses the Broadcom stack, the SDK can be freely downloaded from Broadcom at http://www.broadcom.com/products/bluetooth_sdk.php

Smartphone uses the standard Microsoft stack that has its API set built into the Smartphone SDK, the details of which can we seen on MSDN http://msdn2.microsoft.com/en-us/library/ms834669.aspx

Wednesday 2 May 2007

Routing IP traffic via specified adapter

On a recent project it became necessary to be able to route certain IP traffic via a specified network adapter. Although rather involved this is not as hard as it may first seem. On a desktop this would be achieved by changing the IP routing tables using the ROUTE command, but how do you do this programmatically on a handheld?

First it is necessary to find the IP address, gateway address and interface index of the adapter that you wish to route over. This information can easily be obtained by calling GetAdapterAddresses() a number of times to enumerate all network device data.

Once the IP information has been obtained for the selected adapter then CreateIpForwardEntry() can be called to setup the route. The CreateIpForwardEntry() API takes a PMIB_IPFORWARDROW parameter essentially a route definition. This needs to be setup as follows:
  • dwForwardDest - Set to the IP address of server you will be connecting too.
  • dwForwardMask - Mapping IP address mask. This will need to be 255.255.255.255 for specified traffic.
  • dwForwardPolicy - Set to zero.
  • dwForwardNextHop - This needs to be set to the discovered IP adapters gateway address.
  • dwForwardIfIndex - This needs to be set to the discovered IP adapters index.
  • dwForwardType - This is set to MIB_IPROUTE_TYPE_INDIRECT.
  • dwForwardProto - This is set to MIB_IPPROTO_NETMGMT.
  • dwForwardAge - Set to zero.
  • dwForwardNextHopAS - Set to zero.
  • dwForwardMetric1 - Set to 1.
  • dwForwardMetric2-5 - Set to 0xFFFFFFFF.
It is now possible to simply use sockets to connect to the server or service that you specified in the dwForwardDest. All IP traffic over this socket will be directed via the adapter that was specified.

At the end of the session the DeleteIpForwardEntry() API should be called to tear down the route.

Changing start menu appearance

I've just read this on the newsgroup 'microsoft.public.smartphone.developer' and did not realise how easy it was to do. The display setting for the start menu is controlled by the registry key:

HKCU\Software\Microsoft\Shell\StartMenu\GridView

Set it to 0 to get a list view and a 1 to get a grid view.