javatools/javarestoreconverter/src.s60/restoreserver.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Comms server, part of Java platform 2.0 javarestoreconverter process
       
    15 *               When started  in 'poll' mode Java Installer connects to
       
    16 *               this server to get install commands.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef RESTORESERVER_H
       
    22 #define RESTORESERVER_H
       
    23 
       
    24 #include <string>
       
    25 #include <vector>
       
    26 
       
    27 #include "commslistener.h"
       
    28 #include "commsserverendpoint.h"
       
    29 #include "commsmessage.h"
       
    30 
       
    31 using namespace java::comms;
       
    32 
       
    33 /**
       
    34  * The messages known by Restore Server
       
    35  */
       
    36 
       
    37 const int GET_NEXT_OPERATION_MESSAGE_ID = 500;
       
    38 const int OPERATION_MESSAGE_ID = 501;
       
    39 const int OPERATION_RESULT_MESSAGE_ID = 502;
       
    40 
       
    41 /**
       
    42  * The known operations inside messages
       
    43  */
       
    44 
       
    45 const int INSTALL_OPERATION = 0;
       
    46 const int UNINSTALL_OPERATION = 1;
       
    47 const int EXIT_OPERATION = 2;
       
    48 
       
    49 class RestoreServer : public CommsListener
       
    50 {
       
    51 public:
       
    52     RestoreServer();
       
    53     virtual ~RestoreServer();
       
    54 
       
    55     void setOperations(
       
    56         RPointerArray<HBufC> &aInstallFiles, std::vector<std::wstring> &aUninstallUids);
       
    57 
       
    58     // CommsListener methods
       
    59     virtual void processMessage(CommsMessage& aMessage);
       
    60 
       
    61     int start();
       
    62     int stop();
       
    63 
       
    64     CommsEndpoint* getComms()
       
    65     {
       
    66         return &iComms;
       
    67     }
       
    68 
       
    69 private:
       
    70     int iRunning;   // 1 if running, 0 if not running
       
    71     int iFileIndex;
       
    72     int iFilesTotal;
       
    73     std::vector<std::wstring> iInstallFiles;
       
    74     int iUidIndex;
       
    75     int iUidsTotal;
       
    76     std::vector<std::wstring> iUninstallUids;
       
    77     CommsServerEndpoint iComms;
       
    78 };
       
    79 
       
    80 #endif // RESTORESERVER_H