直接访问 Windows Mobile 中的调制解调器

发布于 2024-07-23 12:30:35 字数 974 浏览 11 评论 0原文

由于某些原因,我需要能够访问 Windows Mobile 智能手机(带有 WM 版本 6.1 的 HTC s740)的内部调制解调器。 我想要的是能够像串行端口一样访问它,以便发出 AT 命令。

我有使用 TAPI Line 接口和 lineGetID() 来获取“句柄”的代码,我应该能够在该“句柄”上执行 ReadFile()/WriteFile() 操作。 可悲的是我还没有让它发挥作用。

我目前所做的是:

  1. 使用 lineInitializeEx() 初始化 TAPI

  2. 使用 lineOpen() 打开线路

  3. 迭代通过每个可用的设备并获取信息。 目前我正在选择“UNIMODEM”/“Hayes 兼容 COM1”设备。 但也许我应该选择“TAPI 蜂窝服务”/“蜂窝线路”? 我尝试过“蜂窝线路”设备,得到了相同的结果。

  4. 在所选设备上使用 lineGetID() 来获取句柄。

  5. 执行 WriteFile("AT\r"),然后直接执行 ReadFile(),如果确实是我访问的调制解调器,这应该给我一个“OK”。

  6. 意识到它不起作用并感到恼火...

但到目前为止这是行不通的。

有人知道如何做吗?

我在 Windows Mobile 6 SDK 上的 Native WIN32 C++ 中执行此操作。

更新: 到目前为止,我已经成功地使用 RIL 在两部手机之间建立了数据连接,这为我提供了一个用于写入和读取的串行端口句柄。 但是,我仍然希望能够直接与调制解调器交互以发送 AT 命令。 因此,我开始的赏金只涉及直接访问调制解调器以发出 AT 命令。 到目前为止,我的调查表明,这在以前版本的 Windows Mobile 中是可能的(通过打开 COM2 和/或 COM9 并杀死 RIL,或类似的东西),但我还没有看到在 WM6 上运行的代码。

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:

  1. Initialize TAPI with lineInitializeEx()

  2. Open the Line with lineOpen()

  3. 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.

  4. Use lineGetID() on the selected device to get a handle.

  5. 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.

  6. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热血少△年 2024-07-30 12:30:38

我不确定您是否可以将 lineGetID 中的句柄与 WriteFile/ReadFile 函数一起使用。 这些是低级函数(可能)不能与 TAPI 一起使用。

我会尝试使用 CreateFile 打开 COM 端口,获取句柄,然后使用 WriteFile 和 ReadFile 函数。 MSDN中有一篇老经典的文章(Win32中的串行通信) ,它描述了这种技术。

但是,我没有 Windows Mobile 编程经验,因此我不确定它是否适合您。

I'm not sure that you can use handle from lineGetID with WriteFile/ReadFile functions. These are low-level functions that (probably) can't be used with TAPI.

I would try to open COM port with CreateFile, get the handle and then use WriteFile and ReadFile functions. There is an old classic article in MSDN (Serial Communications in Win32), which describes this technique.

However, I'm not experienced with Windows Mobile programming, so I'm not sure that it will work for you.

别再吹冷风 2024-07-30 12:30:37

你可能做不到这一点。 无线电接口不一定是 COM 端口 - AT 命令通常是模拟的。 即使您可以获得 COM 端口的句柄,您将如何与内置连接管理器正在执行的活动同步。

You probably can't do this. The interface to the radio isn't necessarily a COM port - the AT commands are often emulated. Even if you could get a handle to the COM port, how would you synchronize with the activity that the built in connection manager is performing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文