javatools/javaappconverter/src.s60/convertserver.h
branchRCL_3
changeset 18 9ac0a0a7da70
parent 17 0fd27995241b
child 19 71c436fe3ce0
equal deleted inserted replaced
17:0fd27995241b 18:9ac0a0a7da70
     1 /*
       
     2 * Copyright (c) 2008 - 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 "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 javappconverter process
       
    15 *               When started  in 'poll' mode Java Installer connects to
       
    16 *               this server to get install commands.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CONVERTSERVER_H
       
    22 #define CONVERTSERVER_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 Convert 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 ConvertServer : public CommsListener
       
    50 {
       
    51 public:
       
    52     ConvertServer();
       
    53     virtual ~ConvertServer();
       
    54 
       
    55     void setInstallFiles(RPointerArray<HBufC> &aInstallFiles);
       
    56 
       
    57     // CommsListener methods
       
    58     virtual void processMessage(CommsMessage& aMessage);
       
    59 
       
    60     int start();
       
    61     int stop();
       
    62 
       
    63     CommsEndpoint* getComms()
       
    64     {
       
    65         return &iComms;
       
    66     }
       
    67 
       
    68 private:
       
    69     int iRunning; // 1 if running, 0 if not running
       
    70     int iFileIndex; // decremented when install files (.jad or .jar or .dcf) are handled
       
    71     int iFilesTotal;
       
    72     std::vector<std::wstring> iInstallFiles;
       
    73     CommsServerEndpoint iComms;
       
    74 };
       
    75 
       
    76 #endif // CONVERTSERVER_H