[PythonCE] How do you develop on the PocketPC?
Luke Dunstan
coder_infidel at hotmail.com
Wed Jan 11 13:38:11 CET 2006
----- Original Message -----
From: "Thomas Heller" <theller at python.net>
To: <pythonce at python.org>
Sent: Wednesday, January 11, 2006 3:42 PM
Subject: Re: [PythonCE] How do you develop on the PocketPC?
> "Luke Dunstan" <coder_infidel at hotmail.com> writes:
>
>> ----- Original Message -----
>> From: "Thomas Heller" <theller at python.net>
>> To: <pythonce at python.org>
>> Sent: Monday, January 09, 2006 10:42 PM
>> Subject: Re: [PythonCE] How do you develop on the PocketPC?
>>
>> I have noticed that IE works on the PDA when cradled, but I know that
>> ActiveSync is not providing a real network adapter on the PC side
>> because an extra IP does not appear in the output of 'ipconfig'. This
>> prevents running TCP listen servers on the PDA but it is true that
>> your method works nicely in this case.
>
> Luke,
>
> Do you know of any other way except TCP/IP to establish a two-way
> communication between the desktop and the PDA?
>
> Thomas
One way I know is using the CeRapiInvoke() API, which is a kind of remote
procedure call:
STDAPI_( HRESULT ) CeRapiInvoke(
LPCWSTR pDllPath,
LPCWSTR pFunctionName,
DWORD cbInput,
BYTE * pInput,
DWORD * pcbOutput,
BYTE ** ppOutput,
IRAPIStream ** ppIRAPIStream,
DWORD dwReserved
);
You can specify a DLL and function name and the device-side part of RAPI
will load the DLL and call the function, but it must have the following
prototype (see also wincerapi.py):
typedef HRESULT (STDAPICALLTYPE RAPIEXT)(
DWORD cbInput,
BYTE * pInput,
DWORD * pcbOutput,
BYTE ** ppOutput,
IRAPIStream * pIRAPIStream
);
In block mode (ppIRAPIStream == NULL) you can simply pass a block of data in
each direction. The interesting part is that if you pass a pointer then you
will receive a IRAPIStream* that allows the device and PC to communicate in
both directions similar to a socket.
I have tested this in one direction only using the CeInvoke sample from the
Pocket PC 2003 SDK, and I also tested replacing the desktop-side program
with a Python script. However, so far this API does not seem robust; for
example if the device-side DLL releases the stream then IRAPIStream::Read()
seems to block forever in the desktop program. The CeInvoke sample handles
this by sending a command over the stream to let the desktop know that it
has finished, but to my mind it is a hack because it would be like sending a
disconnect command over a TCP socket and relying on that to shut down the
other end. The function IRAPIStream::SetRapiStat can supposedly set a
timeout for Read() but so far I can't get it to work. There is a two-way
stream sample in an MSDN KB article that I have yet to try.
For creating development tools there is also the possibility of using the
Platform Manager APIs, which are installed and used by eMbedded Visual C++
to communicate with the remote debugger, among other things. Platform
Manager supports multiple "transports" including TCP/IP and ActiveSync and
you can even create your own transport. I haven't actually tried using it
yet though :-).
Luke
More information about the PythonCE
mailing list