usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/acmserver/src/acmserverclient.cpp
changeset 0 c9bc50fca66e
child 29 59aa7d6e3e0f
equal deleted inserted replaced
-1:000000000000 0:c9bc50fca66e
       
     1 /*
       
     2 * Copyright (c) 2005-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 *
       
    16 */
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "acmserverclient.h"
       
    24 #include "acmserverconsts.h"
       
    25 #include <usb/usblogger.h>
       
    26 #include <usb/acmserver.h>
       
    27 
       
    28 #ifdef __FLOG_ACTIVE
       
    29 _LIT8(KLogComponent, "ACMSVRCLI");
       
    30 #endif
       
    31 
       
    32 /** Constructor */
       
    33 RAcmServerClient::RAcmServerClient() 
       
    34 	{
       
    35 	LOG_FUNC
       
    36 	}
       
    37 	   
       
    38 /** Destructor */
       
    39 RAcmServerClient::~RAcmServerClient()
       
    40 	{
       
    41 	LOG_FUNC
       
    42 	}
       
    43 
       
    44 /**
       
    45 Getter for the version of the server.
       
    46 @return Version of the server
       
    47 */
       
    48 TVersion RAcmServerClient::Version() const
       
    49 	{
       
    50 	LOG_FUNC
       
    51 
       
    52 	return TVersion(	KAcmSrvMajorVersionNumber,
       
    53 						KAcmSrvMinorVersionNumber,
       
    54 						KAcmSrvBuildNumber
       
    55 					);
       
    56 	}
       
    57 
       
    58 /**
       
    59 Connect the handle to the server.
       
    60 Must be called before all other methods (except Version and Close).
       
    61 @return Symbian error code
       
    62 */
       
    63 TInt RAcmServerClient::Connect()
       
    64 	{
       
    65 	LOG_FUNC
       
    66 
       
    67 	return CreateSession(KAcmServerName, Version(), 1);
       
    68 	}
       
    69 
       
    70 TInt RAcmServerClient::CreateFunctions(const TUint aNoAcms, const TUint8 aProtocolNum, const TDesC& aAcmControlIfcName, const TDesC& aAcmDataIfcName)
       
    71 	{
       
    72 	LOG_FUNC
       
    73 	LOGTEXT5(_L("\taNoAcms = %d, aProtocolNum = %d, Control Ifc Name = %S, Data Ifc Name = %S"),
       
    74 			aNoAcms, aProtocolNum, &aAcmControlIfcName, &aAcmDataIfcName);
       
    75 
       
    76 	TIpcArgs args;
       
    77 	args.Set(0, aNoAcms);
       
    78 	args.Set(1, aProtocolNum);
       
    79 	args.Set(2, &aAcmControlIfcName);
       
    80 	args.Set(3, &aAcmDataIfcName);
       
    81 	return SendReceive(EAcmCreateAcmFunctions, args);
       
    82 	}
       
    83 
       
    84 TInt RAcmServerClient::DestroyFunctions(const TUint aNoAcms)
       
    85 	{
       
    86 	LOG_FUNC
       
    87 	LOGTEXT2(_L8("\taNoAcms = %d"), aNoAcms);
       
    88 
       
    89 	return SendReceive(EAcmDestroyAcmFunctions, TIpcArgs(aNoAcms));
       
    90 	}