Ideas about web browser in Qt using GSM/GPRS modem
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, als开发者_如何学运维o 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 ?
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.
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...
精彩评论