关于 Qt 中使用 GSM/GPRS 调制解调器的网络浏览器的想法

发布于 2024-11-26 03:40:28 字数 338 浏览 1 评论 0原文

我已成功将 Telit GL 865 GSM/GPRS 调制解调器连接至我的 Atmel 微处理器。我的 POC 板运行嵌入式 Linux,我还交叉编译了 Qt 库(包括 Webkit)并将其传输到板。

我还可以通过打开 FD(文件描述符)然后执行命令来从 Qt 应用程序读取和写入 AT 命令。

我还能够连接到 GPRS,并获得 HTTP 响应。目前,我正在通过 QWebView 的 setHTML() 函数设置从 AT 命令获取的 HTML。但这样图像不会加载(显然),而且我也无法浏览链接,因为浏览器无法直接访问互联网。那么,我的 Qt Webkit 浏览器可以使用调制解调器直接通过 GPRS 进行通信的正确实现是什么?

I have successfully interfacted Telit GL 865 GSM/GPRS modem to my Atmel microprocessor. My POC board is running embedded linux and I have also cross compiled Qt libraries(including Webkit) and transferred it to the board.

I can also read and write AT commands from Qt application by opening an FD(File descriptor) and then executing commands.

I'm also able to connect to the GPRS, also getting HTTP response. Currently I'm setting the HTML that I get from AT commands, through the QWebView's setHTML() function. But by this the images doesn't load(obviously) and also I cannot navigate through the links as the browser doesn't have a direct access to the Internet. So what is the proper implementation by which my Qt Webkit browser can directly communicate over GPRS using my modem ?

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

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

发布评论

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

评论(2

尐偏执 2024-12-03 03:40:28

看来您正在应用程序级别构建 TCP/IP 堆栈。通常这是一个内核任务。

WebKit 完全能够创建 HTTP 响应,但它希望将它们交给内核。具体来说,它通常创建一个 TCP 套接字,连接到 Web 服务器的端口 80,通过套接字发送 HTTP 请求,并从套接字检索 HTTP 响应。

所以,看来你只是缺少一个驱动程序。与其说这是一个真正的编程问题,不如说这是一个 Linux 问题。

It seems you're building your TCP/IP stack at application level. Normally that's a kernel task.

WebKit is perfectly capable of creating HTTP responses, but it expects to hand them off to the kernel. Specifically, it normally creates a TCP socket, connect to port 80 of the webserver, sends the HTTP request over the socket, and retrieves the HTTP response from the socket.

So, it seems you're just missing a driver. That's not really a programming question so much as a Linux question.

挖鼻大婶 2024-12-03 03:40:28

您需要为 QWebPages 设置属性。像这样的东西:

QWebSettings * settings=QWebSettings::globalSettings ();
settings->setAttribute(QWebSettings::JavascriptEnabled,true);
settings->setAttribute(QWebSettings::PluginsEnabled,true); 
settings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
settings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls,true);
settings->setAttribute(QWebSettings::LocalStorageEnabled,true);
settings->setAttribute(QWebSettings::AutoLoadImages,true);
settings->setAttribute(QWebSettings::JavascriptCanOpenWindows,true);
settings->setAttribute(QWebSettings::PrintElementBackgrounds,true);

查看 QWebSettings 文档 了解更多 Webkit 属性。 ..

UPD:如果您直接使用 AT 命令而不是驱动程序来使用 tcp-ip,那么@MSalters 解释也是您的浏览器工作的先决条件...

You need to set up attributes for your QWebPages. something like this:

QWebSettings * settings=QWebSettings::globalSettings ();
settings->setAttribute(QWebSettings::JavascriptEnabled,true);
settings->setAttribute(QWebSettings::PluginsEnabled,true); 
settings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
settings->setAttribute(QWebSettings::LocalContentCanAccessFileUrls,true);
settings->setAttribute(QWebSettings::LocalStorageEnabled,true);
settings->setAttribute(QWebSettings::AutoLoadImages,true);
settings->setAttribute(QWebSettings::JavascriptCanOpenWindows,true);
settings->setAttribute(QWebSettings::PrintElementBackgrounds,true);

look into QWebSettings docs for more Webkit attributes...

UPD: if you work with tcp-ip directly with AT commands, not with drivers, than @MSalters explanation is also pre-requisite for your browser to work...

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