qthighway/tsrc/test_services/src/interface.cpp
branchRCL_3
changeset 9 5d007b20cfd0
equal deleted inserted replaced
8:885c2596c964 9:5d007b20cfd0
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 *
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #include "interface.h"
       
    24 #include <asynctimer.h>
       
    25 
       
    26 #include <QDebug>
       
    27 
       
    28 
       
    29 TestInterface::TestInterface(QString service, QString interface) 
       
    30  : XQServiceProvider(QLatin1String((service + "." + interface).toLatin1())), 
       
    31    mService(service), 
       
    32    mInterface(interface)
       
    33 {
       
    34     publishAll();
       
    35 }
       
    36 
       
    37 TestInterface::~TestInterface()
       
    38 {
       
    39 
       
    40 }
       
    41 
       
    42 QStringList TestInterface::request(QString input)
       
    43 {
       
    44     qDebug() << "[QTH] [TestInterface] request";
       
    45      
       
    46     qDebug() << "[QTH] [TestInterface] service:" << mService; 
       
    47     qDebug() << "[QTH] [TestInterface] interface:" << mInterface; 
       
    48     qDebug() << "[QTH] [TestInterface] input:" << input; 
       
    49     
       
    50     QStringList ret;
       
    51     
       
    52     ret.append(mService);
       
    53     ret.append(mInterface);
       
    54     ret.append(input);
       
    55     
       
    56     qDebug() << "[QTH] [TestInterface] request end";
       
    57     
       
    58     return ret;
       
    59 }
       
    60 
       
    61 void TestInterface::asyncRequest(QString input)
       
    62 {
       
    63     qDebug() << "[QTH] [TestInterface] async request";
       
    64      
       
    65     AsyncTimer* timer = new AsyncTimer(setCurrentRequestAsync(), input); 
       
    66     connect(timer, SIGNAL(timeout(int, QString)), this, SLOT(complete(int, QString)));
       
    67     timer->start(10);
       
    68     
       
    69     qDebug() << "[QTH] [TestInterface] async request end";
       
    70 }
       
    71 
       
    72 void TestInterface::complete(int requestID, QString input)
       
    73 {
       
    74     qDebug() << "[QTH] [TestInterface] complete request";
       
    75      
       
    76     qDebug() << "[QTH] [TestInterface] service:" << mService; 
       
    77     qDebug() << "[QTH] [TestInterface] interface:" << mInterface; 
       
    78     qDebug() << "[QTH] [TestInterface] input:" << input; 
       
    79     
       
    80     QStringList ret;
       
    81     
       
    82     ret.append(mService);
       
    83     ret.append(mInterface);
       
    84     ret.append(input);
       
    85     
       
    86     completeRequest(requestID,  QVariant(ret)); 
       
    87     
       
    88     qDebug() << "[QTH] [TestInterface] complete request end";
       
    89 }
       
    90 
       
    91 void TestInterface::view(QString pathOrUri)
       
    92 {
       
    93     qDebug() << "[QTH] [TestInterface] view";
       
    94      
       
    95     if(mInterface == "com.nokia.symbian.IUriView")
       
    96     {
       
    97         qDebug() << "[QTH] [TestInterface] uri:" << pathOrUri;
       
    98     }
       
    99     else if(mInterface == "com.nokia.symbian.IFileView")
       
   100     {
       
   101         qDebug() << "[QTH] [TestInterface] path:" << pathOrUri;
       
   102     }
       
   103     
       
   104     qDebug() << "[QTH] [TestInterface] view end";
       
   105 }
       
   106 
       
   107 void TestInterface::view(XQSharableFile file)
       
   108 {
       
   109     qDebug() << "[QTH] [TestInterface] view sharable file";
       
   110 }
       
   111 
       
   112