Wednesday, 19 December 2007
Determining Broadcom vs Microsoft Bluetooth Stack on PPC
OEMs for PocketPC can use any stack, so some PPC devices still use the Microsoft stack.
To determine this at runtime try loading the broadcom dll:
HINSTANCE hInst = LoadLibrary(L"btsdkce50.dll");
If this fails then try the microsoft bluetooth APIs...!
Sunday, 9 December 2007
TrakAx Video Mixing Application Is Released!
I've been lucky to be involved in the development of the new Highandes TrakAx video mixing application for Windows Smartphones and PocketPC devices.
This has got to be one of the most powerful mobile video editing applications, taking phone content such as music, pictures, videos you can mix them together with effects to create a video to MMS, Email or save to your device to show your friends!
Heres a quick mix I made on my S710 (E650) 200Mhz phone from a recent skiing trip:
All mixed from the hotel bar afterwards!
A must for all Windows mobile phone owners!
See http://www.trakax.com/ for more information including a 7 day free trial!
Thursday, 13 September 2007
SDHC support in Windows CE 5.0
A 4GB+ card is part of the SDHC (Secure Digital High Capacity, SD 2.0) Standard.
SDHC uses the FAT32 file system which supports a higher data density than FAT16. It uses the same form factor as SD, but the SD 2.0 standard in SDHC uses a different memory addressing method (sector addressing vs byte addressing). SDHC cards only work in SDHC compatible devices, but standard SD cards work in both SD and SDHC devices. The SDHC trademark is licensed to ensure compatibility.
To support this there is an update for CE 5.0, which can be found here http://support.microsoft.com/kb/933809. This enables deployment of SD 2.0 specification functionality which can theoretically take you up to 32GB. SD 2.0 functionality is available out-of-the-box in Windows CE 6.0.
Wednesday, 25 July 2007
In the dark with backlights...
On PPC/Smartphone if your app needs to keep the backlight on you can requst that the backlight driver is kept in a high power state (i.e. ON!)
// force backlight on
SetPowerRequirement(TEXT("BKL1:"), D0, POWER_NAME POWER_FORCE, NULL, 0);
On PPC you may need to keep the system alive as well else it'll go into suspend, but this'll work indefinately on smartphone.
Use ReleasePowerRequirement to return the backlight to system timeout control. Note unlike some SatNav software this is nicer than editing the control panel system settings...! ;)
Friday, 13 July 2007
Enabling DShow Debug
When using a debug CE build (or a retail build with a debug quartz.dll) if you can enable DShow logging by turing on the following debug zones of quartz (tested in CE6.0):
Good luck debugging!
[HKEY_LOCAL_MACHINE\SOFTWARE\Debug\GLOBAL]
"TIMING"=dword:0
"TRACE"=dword:0
"MEMORY"=dword:0
"LOCKING"=dword:0
"ERROR"=dword:0
The levels go from 0 (none) to 5 (full). Try first changing TRACE and ERROR to 5 to start with.
Thursday, 12 July 2007
Video Driver Speedup
I've been working recently on improving the video performance on a Samsung 2413 processor.
The platform I'm working on does not have hardware video acceleration or a hardware cursor.
Did you know that if you disable the software cursor in the driver and remove the overlap detection for emulated line and blit you can get a two fold speed increase at least with drawing polygons.
The hardware supports DMA and I've started to look at using this to accelerate line fills and various blits. Unfortunately the hardware does not support block DMA which cuts down how it could help with majority of blit operations. Another snag with this approach is the overhead it takes to setup the DMA controller and cope with odd end of line conditions.
Tuesday, 19 June 2007
DeviceEmulator Slow?
Add a DWORD value in HKCU\Software\Microsoft\Platform Builder\6.00\Debug called "SynchronousDebugMessage" and set it to 0.
This tip found here:
http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/860b1ff6347ed62c/0d3af9395d161fce?lnk=st&q=%22(un)load%22+windowsce&rnum=3&hl=en#0d3af9395d161fce
The other thing you can try is to ignore module loads until later.
Go to target->connectivity options dialog
Switch to the "service status" tab
Click "settings" for "Kernel Debugger OS Awareness".
Switch the "Module (un)load notification to the debugger" option
The help from the dialog says the following options are available:
Always off: Never catch notification, module changes are updated on each halt. Boot time and execution is fast, real-time, but breakpoints cannot be instantiated on time.
Always on: Catch notification of all module changes immediately. Boot time and execution is slow, non real-time, but breakpoints can be instantiated on time.
Off until first halt: Suppress notification until first target halt, then catch all notifications.
This tip found here:
http://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_thread/thread/860b1ff6347ed62c/0d3af9395d161fce?lnk=st&q=%22(un)load%22+windowsce&rnum=3&hl=en#0d3af9395d161fce
Command line (Console) over serial
To configure the command processor shell on windows CE to run over a serial connection add the following to your registry
[HKEY_LOCAL_MACHINE\Drivers\Console]
OutputTo = REG_DWORD:1 // Redirects CMD to COM1
COMSpeed = REG_DWORD:19200 // Speed of serial connection
This redirects all input and output for all console applications to the serial port, hmm wonder if it'll work with bluetooth as well... :)
Thursday, 14 June 2007
Using Image Factory under CE/Windows Mobile
The code below will load a JPG/GIF/PNG (or whatever decoders are installed on your device) etc from a file and paint it to the screen:
CoInitializeEx(NULL, 0);
IImagingFactory* pImageFactory;
IImage *pImage = NULL;
HDC dc = GetDC(0); // insert your window handle here, else this is the desktop
HRESULT hr = CoCreateInstance(CLSID_ImagingFactory, NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IImagingFactory),
(LPVOID *)&pImageFactory);
// Load image from file
pImageFactory->CreateImageFromFile(bitmapName, &pImage);
// Get image information
ImageInfo info;
pImage->GetImageInfo(&info);
RECT rc={0,0,info.Width, info.Height};
// draw jpg/gif etc onto temp dc
pImage->Draw(dc, &rc, NULL);
// Clean up
pImage->Release();
pImageFactory->Release();
CoUninitialize();
Wednesday, 13 June 2007
Memory Leaks with MFC CPtrArray
Just finished debugging some 3rd party code with memory leaks.
The code used the RemovalAll member operation on the MFC CPtrArray class. This operation needs to be used with care as all the array elements need to be deleted AFTER the call to RemoveAll. Calling RemoveAll before deleting all the array objects will cause a memory leak.
Another memory leak was caused by deleting a class pointer that had been passed to a function as a void pointer. When delete is executed on a void pointer the destructor of the class is obviously not called.
One final comment on memory leaks fixing is beware when using the EVC4 debug environment. Over the past few days I was chasing a memory leak that did not exist but was a symptom of using the debugger!
Tuesday, 12 June 2007
Windows Mobile Device Center 6.1 for Windows Vista
The key updates delivered in this release include:
- IRM activation
- HTML mail
- Certificate enrollment
- File synchronization on all WM 6 devices (Yes, even Smartphone!)
- Windows Embedded CE 6.0 support
- Automatic device authentication
- Product registration
- Silent-mode install for corporate deployment
And more!
But from our basic testing it looks like it solves the previous versions problem which is connecting Vista to a Windows Embedded CE device via it's Activesync module. Even though the MS official descriptions only indicate WinCE 6.0 I have had it tested with a WinCE 4.2 device (seen here). So I see no reason why it's not going to work with 4.0, 4.2 & 5.0 etc.
Tuesday, 15 May 2007
New contributor
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
Thursday, 3 May 2007
Bluetooth Stacks and Windows Mobile
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
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.
At the end of the session the DeleteIpForwardEntry() API should be called to tear down the route.
Changing start menu appearance
HKCU\Software\Microsoft\Shell\StartMenu\GridView
Set it to 0 to get a list view and a 1 to get a grid view.
Monday, 30 April 2007
Using Multi/Dual Core Processors with Platform Builder
set BUILD_MULTIPROCESSOR=2
You’ll then see in taskmanager that your CPU usage goes up to 100% now instead of just past 50%!
Removable disk timeouts in CE
Ever wondered why it takes ages for the Windows CE filesystem to remove SDCards from the filesystem after physically removing the card?
Well its because there are two FATFS registry settings which affect this behaviour. Also these are the reason why after a resume an SDCard can take 12 seconds to become responsive again if a ReadFile operation was called when the driver was powering down for the suspend.
"PNPUnloadDelay"
Specifies the time delay in milliseconds between unmounting and detaching a device.
Used during suspend/resume cycles where a block driver might unload and reload on resume.
Default is 5000 microseconds.
"PnPWaitIoDelay"
Specifies the amount of time waited before re-trying an I/O operation on an unavailable device.
This subkey is not present in the default registry, but may be added by the OEM. If this value is not specified, it is assumed to be three times that of PNPUnloadDelay
See :
http://msdn2.microsoft.com/en-us/library/aa912238.aspx
The default is set in CE5.0 as 4 seconds to unmount the volume after device removal, this is the delay you see in explorer. And 3 x 4 seconds if any IO operation fails (i.e. if an app is reading/writing to an SDCard whilst the device is suspending/resuming)
Wednesday, 25 April 2007
Bluetooth (serial) SPP using Sockets...!
// create your BT socket
SOCKET s = socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
// Create the connection information, this is the RFComm protocol for SPP
SOCKADDR_BTH sa;
memset (&sa, 0, sizeof(sa));
sa.addressFamily = AF_BTH;
sa.btAddr = device;
sa.port = BT_PORT_ANY;
sa.serviceClassId = RFCOMM_PROTOCOL_UUID;
// connect...
connect (s, (SOCKADDR *)&sa, sizeof(sa))
Once connected you can use send/recieve to send over the SPP connection:
send (connectedSocket, (char*)str, len,0)
recv( connectedSocket, str, len,0)
This way you don't have to map serial ports, this was tested on Windows XP but should also work on windows CE.
It was tested printing GPS information from a TOMTOM reciever.
CE6.0 and DumpMem()
Debug in CE6.0 and PB6.0
Sync Mode
Here the target device waits until the host displays the debug message. The advantage being that you see messages when they were sent but it does slow down the target device.
Async Mode
Here the target device runs as fast as possible. The debug message is queued on the host to allow the device to continue. Debug is only displayed on the host as time permits.
These debug modes are available via the host's registry.
HKCU\Software\Microsoft\Platform Builder\6.00\Debug
DWORD value "SynchronousDebugMessage"
0 == ASYNC
1 == SYNC
Tuesday, 24 April 2007
How to get IMEI, SIM number, Operator and country
- The Modem IMEI number
- The SIM number (not the phone number)
- The SIM operator
- The SIM operator ID and cell country
Monday, 23 April 2007
Taking control of the "Back" button on Windows Mobile
Thursday, 19 April 2007
How to get your phone number
Wednesday, 18 April 2007
EVC 4.0 Remote Tools
View the file properties of the directories:
C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\Bin
C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\Bin\WCE500
Click the "Advance" button
Click to check the "For fast searching, allow Indexing Service to index this folder" check box
Click "OK"
Vista and ActiveSync
One unfortunate oversight is that it will not currently Sync with the new Vista Windows Calendar or Email applications. Microsoft, however, are planning a new service release that will support this applications in the future.
Signing Windows Mobile Application Code using Miicrosoft Visual Studio 2005
- Navigate to C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 SDk\Tools
- Double-click on the SDKSamplePrivDeveloper.pfx file
- Press the "Next" button on the "Welcome to the Certificate Import Wizard" dialogue
- Press the "Next" button on the "File to Import" dialogue
- Press the "Next" button on the "Password" dialogue
- Press the "Next" button on the "Certificate Store" dialogue
- Press the "Finish" button on the "Completing the Certificate Import Wizard" dialogue
- Press "Ok" on "Completed" dialogue
- Repeat the process for the SDKSampleUnprovDeveoper.pfx file
Having installed the certificates you will now need to sign your CAB's, DLL's and EXE's against them. This is done as follows:
- Open your Microsoft Visual Studio project solution
- Select from the menu Project->Properties
- Expand the "Configuration Properties" tree in the left-hand pane
- Expand the "Authenticode Signing" in the "Configuration Properties" tree
- Select "General"
- In the right-hand pane change the "Authenticode Signature" selection to "Yes"
- Select the "Certificate" field and press the "browse" ellipse to the left
- Select the certificate you wish to sign against marked "TEST USE ONLY - Sample Privileged Root for Windows Mobile SDK" or "TEST USE ONLY - Sample UnPrivileged Root for Windows Mobile SDK" and hit OK
- Select "OK" to properties dialogue
On your next build Visual Studio will now automatically sign your executable.
Visual Studio 2005 and Windows CE6.0 Problems
Also SP1 is needed when running on Windows Vista.
Unlocking a Smartphone for development
- Navigate to HKLM\Security\Policies\Policies\
- Change the "00001001" value to a decimal 1
- Change the "00001005" value to a decimal 40
- Reboot the device
- First install the Windows Mobile Smartphone SDK. This is available here from Microsoft.
- Copy the file C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Tools\SDKCerts.cab onto the device.
- Launch the CAB file.
- Reboot the device.
- Navigate to HKLM\Security\Policies\Policies\
- Change the "00001001" value to a decimal 2
- Change the "00001005" value to a decimal 16
- Reboot the device
Cellcore on Windows CE6.0
CE6.0 comes with two examples modem drivers (RIL - Radio Interface Layers) for the TTPCom and Enfora Modems.
Most of the sources, headers and registry entries can be found under the CE6.0 tree here:
C:\WINCE600\PUBLIC\CELLCORE
Here you’ll also find the 710 Multiplexer, this component effectively splits the single serial port that the modem is available on into two virtual serial ports (default is COM9 and COM7).
To make phone calls Cellcore uses TAPI (Telephone Application Programming Interface) see some of the Smartphone/PocketPC SDK examples for some coding examples.
Making data calls can be done using RAS Dial up, but the RAS setup needs to specify the APN for the data connection. There are no examples under Windows Mobile as this is all handled in Connection Manager on WinMobile.
CE6.0 comes with a WWANDIS component which looks like it virtualises data connections to have a ‘Virtual Ethernet’ driver over GPRS, but there aren’t any docs I can find, anyone know how this works?
Mike Hall has a demo of Cellcore in action on an electronic picture frame… see Mikes Cellcore Demo
C4All The start of a new era
Rob Nock
- Spent 9 Years working with Mitsubishi PC Division (Apricot Computers) and has been with Intrinsyc since 1999.
- Both jobs have led to in depth experience with embedded systems.
- Worked on Windows CE from version 3.0 up to 6.0.
- Worked on Windows Mobile 5.0 and 6.0.
- Ported BSP's, written numerous drivers and applications.
Graeme Wintle
- Previous to Intrinsyc (also since 1999 - Rob started the same day!) working at Nokia Telecoms and GST Technology
- 15 Years of experience in the embedded space
- Experience ranging from OS Porting to Application design on Windows CE and Windows Mobile
- 17 hardware platforms under my porting belt so far...!