diff options
author | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-12 16:31:58 +0100 |
---|---|---|
committer | Jonatan Pålsson <jonatan.palsson@pelagicore.com> | 2014-02-12 16:31:58 +0100 |
commit | 83990dd5a1a2d8ce8f42dcf290e60084cbf556ba (patch) | |
tree | f291957424bc5f8be776db4d0dfe7961a7f28a8c | |
parent | 58d724a06c806263aa6283cf735f59c78b27cf0f (diff) | |
download | browser-poc-83990dd5a1a2d8ce8f42dcf290e60084cbf556ba.tar.gz |
Added errorlogger stub
-rw-r--r-- | browser/browser.pro | 8 | ||||
-rw-r--r-- | browser/errorlogger.cpp | 39 | ||||
-rw-r--r-- | browser/errorlogger.h | 45 | ||||
-rw-r--r-- | common/IErrorLogger.xml | 37 | ||||
-rw-r--r-- | common/INetworkManager.xml | 45 | ||||
-rw-r--r-- | common/browserdefs.h | 81 |
6 files changed, 255 insertions, 0 deletions
diff --git a/browser/browser.pro b/browser/browser.pro index 61b3883..17665ae 100644 --- a/browser/browser.pro +++ b/browser/browser.pro @@ -35,6 +35,7 @@ SOURCES += main.cpp \ browserview.cpp \ browserconfig.cpp \ cachemanager.cpp \ + errorlogger.cpp \ ../common/bookmark.cpp \ HEADERS += \ @@ -46,6 +47,7 @@ HEADERS += \ browserview.h \ browserconfig.h \ cachemanager.h \ + errorlogger.h \ ../common/bookmark.h \ ../common/browserdefs.h \ @@ -55,3 +57,9 @@ system("$$[QT_INSTALL_PREFIX]/bin/qdbusxml2cpp -i cachemanager.h\ -l cachemanager\ -a icachemanager_adaptor.h:\ ../common/ICacheManager.xml") + +system("$$[QT_INSTALL_PREFIX]/bin/qdbusxml2cpp -i errorlogger.h\ + -i ../common/browserdefs.h\ + -l errorlogger\ + -a ierrorlogger_adaptor.h:\ + ../common/IErrorLogger.xml") diff --git a/browser/errorlogger.cpp b/browser/errorlogger.cpp new file mode 100644 index 0000000..8aa5139 --- /dev/null +++ b/browser/errorlogger.cpp @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2013, Pelagicore + * + * Author: Jonatan Pålsson <jonatan.palsson@pelagicore.com> + * + * This file is part of the GENIVI project Browser Proof-Of-Concept + * For further information, see http://genivi.org/ + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <QObject> +#include <QDBusContext> +#include <QDebug> +#include <QAbstractNetworkCache> +#include <QNetworkDiskCache> + +#include "errorlogger.h" +#include "../common/browserdefs.h" + +errorlogger::errorlogger(QObject *parent) : + QObject(parent) +{} + +uint errorlogger::getItemsCount(qlonglong timeFrom, qlonglong timeTo) +{ + return 0; +} +conn::brw::ERROR_IDS errorlogger::getItems(qlonglong timeFrom, + qlonglong timeTo, + conn::brw::ERROR_SORT_TYPE type, + uint startIndex, + uint itemsCount, + conn::brw::ErrorItemList items) +{ + return conn::brw::EID_NO_ERROR; +} diff --git a/browser/errorlogger.h b/browser/errorlogger.h new file mode 100644 index 0000000..3d5afc3 --- /dev/null +++ b/browser/errorlogger.h @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2013, Pelagicore + * + * Author: Jonatan Pålsson <jonatan.palsson@pelagicore.com> + * + * This file is part of the GENIVI project Browser Proof-Of-Concept + * For further information, see http://genivi.org/ + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef ERRORLOGGER_H +#define ERRORLOGGER_H + +#include <QObject> +#include <QDBusContext> + +#include "browserconfig.h" +#include "../common/browserdefs.h" + +class errorlogger : public QObject, protected QDBusContext +{ + Q_OBJECT +public: + errorlogger(QObject *parent = 0); + +signals: + void onErrorListChanged(); + void onNewErrorItem (const conn::brw::ErrorItem); + +public Q_SLOTS: + uint getItemsCount (qlonglong, qlonglong); + conn::brw::ERROR_IDS getItems (qlonglong timeFrom, + qlonglong timeTo, + conn::brw::ERROR_SORT_TYPE sortType, + uint startIndex, + uint itemsCount, + conn::brw::ErrorItemList items); + +private: +}; + +#endif // ERRORLOGGER_H diff --git a/common/IErrorLogger.xml b/common/IErrorLogger.xml new file mode 100644 index 0000000..9beca00 --- /dev/null +++ b/common/IErrorLogger.xml @@ -0,0 +1,37 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + + +<node> + <interface name="conn.brw.IErrorLogger"> + <version>1.0.0</version> + <doc> + <line>Error logger. Provides list of the errors.</line> + </doc> + + <method name="getItemsCount"> + <arg name="retval" type="u" direction="out"/> + <arg name="a_i64TimeFrom" type="x" direction="in"/> + <arg name="a_i64TimeTo" type="x" direction="in"/> + </method> + + <method name="getItems"> + <arg name="a_i64TimeFrom" type="x" direction="in"/> + <arg name="a_i64TimeTo" type="x" direction="in"/> + <arg name="a_eSortType" type="(i)" direction="in"/> + <arg name="a_u32StartIndex" type="u" direction="in"/> + <arg name="a_u32ItemsCount" type="u" direction="in"/> + <arg name="retval" type="(i)" direction="out"/> + <arg name="a_oItems" type="a(xsssss)" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="conn::brw::ERROR_SORT_TYPE" /> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="conn::brw::ERROR_IDS" /> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="conn::brw::ErrorItemList" /> + </method> + + <signal name="onErrorListChanged" /> + + <signal name="onNewErrorItem"> + <arg name="a_rNewErrorItem" type="(xsssss)"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::ErrorItem &" /> + </signal> + </interface> +</node> diff --git a/common/INetworkManager.xml b/common/INetworkManager.xml new file mode 100644 index 0000000..a4e9d9d --- /dev/null +++ b/common/INetworkManager.xml @@ -0,0 +1,45 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + +<node> + <interface name="conn.brw.INetworkManager"> + + <method name="closeAuthenticationDialog"> + <arg name="a_eResult" type="(i)" direction="in"/> + <arg name="a_oAuthenticationData" type="(sssb)" direction="in"/> + <arg name="retval" type="(i)" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::DIALOG_RESULT" /> + <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="const conn::brw::AuthenticationData &" /> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="conn::brw::ERROR_IDS" /> + </method> + + <method name="closeSslErrorDialog"> + <arg name="a_eResult" type="(i)" direction="in"/> + <arg name="a_bSaveCertificate" type="b" direction="in"/> + <arg name="retval" type="(i)" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::DIALOG_RESULT" /> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="conn::brw::ERROR_IDS" /> + </method> + + <signal name="onAuthenticationDialog"> + <arg name="a_oAuthenticationData" type="(sssb)"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::AuthenticationData &" /> + </signal> + + <signal name="onAuthenticationDialogCancel"> + <arg name="a_oAuthenticationData" type="(sssb)"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::AuthenticationData &" /> + </signal> + + <signal name="onSslErrorDialog"> + <arg name="a_eSsLError" type="(iss)"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::SslError &" /> + </signal> + + <signal name="onSslErrorDialogCancel"> + <arg name="a_eSsLError" type="(iss)"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="const conn::brw::SslError &" /> + </signal> + + </interface> +</node> + diff --git a/common/browserdefs.h b/common/browserdefs.h index c72e05d..8499904 100644 --- a/common/browserdefs.h +++ b/common/browserdefs.h @@ -578,6 +578,84 @@ namespace conn { return args; //#] } + + /*! + * Defines sorting order of error items: + EST_DATE_ASCENDING - the error items are sorted by the date in ascending order; + EST_DATE_DESCENDING - the error items are sorted by the date in descending order; + + */ + //## type ERROR_SORT_TYPE + enum ERROR_SORT_TYPE + { + EST_DATE_ASCENDING = 0, + EST_DATE_DESCENDING = 1 + }; + + struct ErrorItem + { + /*! + * Timestamp when the error happened + */ + qlonglong i64DateTime; //## attribute i64DateTime + /*! + * Browser version + */ + QString strBrowserVersion; //## attribute strBrowserVersion + /*! + * Internet connection used. + */ + QString strConnectionType; //## attribute strConnectionType + /*! + * Error code. It could be HTTP error codes, or internal codes. + */ + QString strCode; //## attribute strCode + /*! + * Information about the place where the error happened. Could be name of a module, class or method. + */ + QString strSource; //## attribute strSource + /*! + * Short text description of the error. + */ + QString strDescription; //## attribute strDescription + }; + + //## package connInterfaces::connPublic::conn::brw::def + //## class ErrorItemList + /*! + * + */ + typedef QList<conn::brw::ErrorItem> ErrorItemList; + + //## operation operator>>(QDBusArgument,ErrorItem) + inline const QDBusArgument& operator>>(const QDBusArgument& args, ErrorItem& error) { + //#[ operation operator>>(QDBusArgument,ErrorItem) + args.beginStructure(); + args >> error.i64DateTime + >> error.strBrowserVersion + >> error.strConnectionType + >> error.strCode + >> error.strSource + >> error.strDescription; + args.endStructure(); + return args; + //#] + } + + //## operation operator<<(QDBusArgument,ErrorItem) + inline QDBusArgument& operator<<(QDBusArgument& args, const ErrorItem& error) { + //#[ operation operator<<(QDBusArgument,ErrorItem) + args.beginStructure(); + args << error.i64DateTime + << error.strBrowserVersion + << error.strConnectionType + << error.strCode + << error.strSource + << error.strDescription; + args.endStructure(); + return args; + //#] + } } } @@ -596,5 +674,8 @@ Q_DECLARE_METATYPE(conn::brw::OBJECT_HANDLE) Q_DECLARE_METATYPE(conn::brw::ObjectHandleList) Q_DECLARE_METATYPE(conn::brw::SelectableOption); Q_DECLARE_METATYPE(conn::brw::CACHE_POLICY); +Q_DECLARE_METATYPE(conn::brw::ErrorItemList); +Q_DECLARE_METATYPE(conn::brw::ErrorItem); +Q_DECLARE_METATYPE(conn::brw::ERROR_SORT_TYPE); #endif // BROWSERDEFS_H |