Im new to cascades programming. Im trying to develop an app that could give me the number of bytes received and sent.
Im using QnetworkSession methods bytesReceived()
and bytesWritten()
for it, but getting errors.
Any help would be appreciable.
Thanks
Code:
#include "Monitor.hpp"
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <QtCore/QFile>
#include <QtNetwork/QNetworkSession>
#include <QtNetwork/QNetworkConfiguration>
#include <QtNetwork/QNetworkConfigurationManager>
using namespace bb::cascades;
QNetworkSession::QNetworkSession ( const QNetworkConfiguration & connectionConfig, QObject * parent = 0 );
Monitor::Monitor(bb::cascades::Application *app)
: QObject(app)
{
QNetworkSession qnetworksession;
// create scene document from main.qml asset
// set parent to created document to ensure it exists for the whole application lifetime
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("app", this);
// create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
app->setScene(root);
}
quint64 Monitor::Received() const
{
quint64 rec=qnetworksession.bytesReceived ();
return(rec);
}
quint64 Monitor::Sent() const
{
quint64 sen=qnetworksession.bytesWritten ();
return(sen);
}