hti/PC_Tools/HTIGateway/HtiGateway/inc/HtiDispatcher.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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 "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:
       
    15 *   This file contains headers of HtiDispatcher class.
       
    16 */
       
    17 
       
    18 #ifndef __HTI_DISPATCHER_H__
       
    19 #define __HTI_DISPATCHER_H__
       
    20 
       
    21 #include <windows.h>
       
    22 #include <map>
       
    23 #include <string>
       
    24 
       
    25 #include "safequeue.h"
       
    26 #include "thread.h"
       
    27 
       
    28 //forward declarations
       
    29 struct soap;
       
    30 class SoapHandler;
       
    31 class HtiMessage;
       
    32 class Data;
       
    33 
       
    34 typedef map<string, SoapHandler*> htiSoapActionHashMap;
       
    35 typedef map<int, SoapHandler*> htiUIDHashMap;
       
    36 
       
    37 using namespace std;
       
    38 //**********************************************************************************
       
    39 // Class HtiDispatcher
       
    40 //
       
    41 // This class 
       
    42 // -forwards Soap requests and Hti messages to correct SOAPHandlers
       
    43 // -Is used to initiate SOAPHandlers by reading them from dll's and start them 
       
    44 //**********************************************************************************
       
    45 class HtiDispatcher : public Thread<HtiDispatcher>
       
    46 {
       
    47 public:
       
    48 	HtiDispatcher(SafeQueue<Data*>* qIn, SafeQueue<Data*>* qOut);
       
    49 	~HtiDispatcher();
       
    50 	void Run();
       
    51 	void Stop();
       
    52 	bool IsRunning();
       
    53 
       
    54 	bool DispatchSoapServe(struct soap* soapEnv);
       
    55 	//pass m_IncomingHtiMessage to available handlers
       
    56 	void DispatchToSoapHandlers();
       
    57 
       
    58 	void SendHtiMessage(HtiMessage* msg);
       
    59 
       
    60 private:
       
    61 	/**
       
    62 	* read dll plugins and load handlers
       
    63 	*/
       
    64 	void InitHandlers();
       
    65 	void StartHandlers();
       
    66 	//void ProcessIncomingDataMessage();
       
    67 
       
    68 private:
       
    69 	//incoming queue from PC side, outgoing to CommChannelPlugin side
       
    70 	SafeQueue<Data*>* m_QueueIn;
       
    71 	//outgoing queue to PC side, incoming from CommChannelPlugin side
       
    72 	SafeQueue<Data*>* m_QueueOut;
       
    73 
       
    74 	//handlers hash map divided by soap action, it owns handlers
       
    75 	htiSoapActionHashMap m_SoapHandlers;
       
    76 	//the same as above but of service UID; doesn't own handlers!!!
       
    77 	htiUIDHashMap m_HanlersUidMap; 
       
    78 
       
    79 	HtiMessage* m_IncomingHtiMessage;
       
    80 
       
    81 	bool m_Running;
       
    82 };
       
    83 
       
    84 #endif // __HTI_DISPATCHER_H__