usbmgmt/usbmgr/device/classdrivers/ncm/classcontroller/inc/ncmclientmanager.h
author hgs
Wed, 07 Jul 2010 14:16:40 +0800
changeset 28 f1fd07aa74c9
child 49 93c0009bd947
permissions -rw-r--r--
201025_08

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/

/** @file
@internalComponent
*/


#ifndef NCMCLIENTMANAGER_H
#define NCMCLIENTMANAGER_H

#include <e32std.h>
#include <e32base.h>

#ifdef OVERDUMMY_NCMCC
#include <dummyusbsclddapi.h>
#else
#include <d32usbcsc.h>
#endif // OVERDUMMY_NCMCC

#include "ncmcommon.h"

class RNcmInternalSrv;

/**
 * A class which encapsulates the operations related to USB shared chunk LDD
 */
class CNcmClientManager : public CBase
    {
public:
    /**
     * Constructor
     * @param[in]  aHostMacAddress, the NCM interface MAC address 
     *             which will be used to config.
     */
    CNcmClientManager(const TNcmMacAddress& aHostMacAddress);
    
    ~CNcmClientManager();

    /**
     * Setup NCM interfaces
     * @param[out]   aDataEpBufferSize, NCM data interface EP buffer size
     */
    void SetNcmInterfacesL(TUint& aDataEpBufferSize);
    /**
     * Transfer ownership of NCM interface handles to NCM internal 
     * server which is located in C32 process space
     * @param[in]   aServer, NCM internal server. 
     */
    void TransferInterfacesL(RNcmInternalSrv& aServer);
        
private:
    /**
     * Setup NCM communication interface
     */
    void SetCommunicationInterfaceL();
    /**
     * Setup NCM data interface
     * @param   aDataEpBufferSize, NCM data interface EP buffer size
     */
    void SetDataInterfaceL(TUint& aDataEpBufferSize);
    /**
     * Setup NCM class specific descriptors
     * @param   aDataInterfaceNumber, NCM data interface number
     */
    TInt SetupClassSpecificDescriptor(TUint8 aDataInterfaceNumber);
    /**
     * Set NCM interface MAC address into NCM class specific descriptor
     * @param[out]   aStrIndex, the index of string which contains NCM 
     *               interface MAC address 
     */
    TInt SetMacAddressString(TUint8& aStrIndex);
    /**
     * Get NCM data interface number
     * @param[out]  aInterfaceNumber, NCM data interface number
     */
    TInt DataInterfaceNumber(TUint8& aInterfaceNumber);
    
private:
    const TNcmMacAddress&   iHostMacAddress;
    
    TBool                   iCommLddInitiated;
    RDevUsbcScClient        iCommLdd;
    TBool                   iDataLddInitiated;
    RDevUsbcScClient        iDataLdd;
    };

#endif // NCMCLIENTMANAGER_H