Directly accessing the modem in Windows Mobile
Posted
by kigurai
on Stack Overflow
See other posts from Stack Overflow
or by kigurai
Published on 2009-06-15T17:29:43Z
Indexed on
2010/04/11
12:53 UTC
Read the original article
Hit count: 354
For some reasons I need to be able to access the internal modem of a Windows Mobile smartphone (a HTC s740 with WM version 6.1). What I want is to be able to access it like it was a serial port in order to give AT-commands.
I have code that uses the TAPI Line interface and lineGetID() to get a "handle" on which I shuld be able to do ReadFile()/WriteFile(). Sadly I have not gotten it to work.
What I do currently is:
Initialize TAPI with lineInitializeEx()
Open the Line with lineOpen()
Iterate through each available device and get info. Currently I am selecting the "UNIMODEM"/"Hayes compatible on COM1" device. But maybe I should choose the "TAPI cellular service"/"Cellular Line" instead? I have tried the "Cellular Line" device with the same result.
Use lineGetID() on the selected device to get a handle.
Do WriteFile("AT\r") and then directly do a ReadFile(), which should give me a "OK" back if it really was the modem I accessed.
Realize that it doesn't work and get annoyed...
But this has so far been a no-go.
Does anyone have any idea on how to do it?
I am doing this in Native WIN32 C++ on Windows Mobile 6 SDK.
UPDATE: I have so far managed to get a data connection between two phones using RIL, which gives me a serial port handle to write and read from. BUT, I still would like to be able to interact directly with the modem to send AT-commands. So, the bounty I am starting only concerns getting direct access to the modem in order to give AT-commands. My investigations so far indicates that this was possible in previous versions of Windows Mobile (by opening COM2 and/or COM9 and slaying RIL, or something like that) but I have not yet seen code which works on WM6.
© Stack Overflow or respective owner