remotecontrol/remotecontrolfw/client/inner/src/bulksession.cpp
changeset 51 20ac952a623c
equal deleted inserted replaced
48:22de2e391156 51:20ac952a623c
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <bluetooth/logger.h>
       
    25 
       
    26 #include "remconbulkclient.h"
       
    27 
       
    28 #ifdef __FLOG_ACTIVE
       
    29 _LIT8(KLogComponent, LOG_COMPONENT_REMCON_INNER);
       
    30 #endif
       
    31 
       
    32 EXPORT_C RRemConBulk::RRemConBulk() 
       
    33 :	iUidPckg(0),
       
    34 	iOpIdPckg(0)
       
    35 	{
       
    36 	LOG_FUNC
       
    37 	}
       
    38 
       
    39 EXPORT_C TVersion RRemConBulk::Version() const
       
    40 	{
       
    41 	LOG_FUNC
       
    42 	return(TVersion(	KRemConBulkSrvMajorVersionNumber,
       
    43 						KRemConBulkSrvMinorVersionNumber,
       
    44 						KRemConBulkSrvBuildNumber
       
    45 					)
       
    46 			);
       
    47 	}
       
    48 
       
    49 EXPORT_C TInt RRemConBulk::Connect()
       
    50 	{
       
    51 	LOG_FUNC
       
    52 	const TInt KNumberOfBulkSessionAsyncApis = 2;
       
    53 	return CreateSession(KRemConBulkServerName, Version(), KNumberOfBulkSessionAsyncApis);
       
    54 	}
       
    55 
       
    56 EXPORT_C TInt RRemConBulk::SendUnreliable(TUid aInterfaceUid, 
       
    57 		TUint aOperationId, 
       
    58 		const TDesC8& aData)
       
    59 	{
       
    60 	LOG_FUNC
       
    61 	TIpcArgs args;
       
    62 	
       
    63 	args.Set(0, aInterfaceUid.iUid);
       
    64 	args.Set(1, aOperationId);
       
    65 	args.Set(2, &aData);
       
    66 	TInt err = SendReceive(ERemConBulkSendUnreliable, args); 
       
    67 	return err;
       
    68 	}
       
    69 
       
    70 
       
    71 EXPORT_C void RRemConBulk::Send(TRequestStatus& aStatus, 
       
    72 		TUid aInterfaceUid, 
       
    73 		TUint aOperationId, 
       
    74 		const TDesC8& aData)
       
    75 	{
       
    76 	LOG_FUNC
       
    77 
       
    78 	TIpcArgs args;
       
    79 	args.Set(0, aInterfaceUid.iUid);
       
    80 	args.Set(1, aOperationId);
       
    81 	args.Set(2, &aData);
       
    82 
       
    83 	SendReceive(ERemConBulkSend,
       
    84 		args,
       
    85 		aStatus
       
    86 		);
       
    87 	}
       
    88 	
       
    89 EXPORT_C TInt RRemConBulk::SendCancel()
       
    90 	{
       
    91 	LOG_FUNC
       
    92 	
       
    93 	//Ignore Return code because
       
    94 	// a) It'll mostly be other than KErrNone because the server has terminated, in which
       
    95 	//    case the original async request will have completed with the error anyway!
       
    96 	// b) It's meaningless to the client whatever the return code is.
       
    97 	(void)SendReceive(ERemConBulkSendCancel);
       
    98 	
       
    99 	return KErrNone; 
       
   100 	}
       
   101 
       
   102 EXPORT_C void RRemConBulk::Receive(TRequestStatus& aStatus, 
       
   103 							   TUid& aInterfaceUid,
       
   104 							   TUint& aOperationId,
       
   105 							   TDes8& aData)
       
   106 	{
       
   107 	LOG_FUNC
       
   108 
       
   109 	TIpcArgs args;
       
   110 	iUidPckg.Set((TUint8*)&aInterfaceUid.iUid, sizeof(TUint), sizeof(TUint));
       
   111 	args.Set(0, &iUidPckg);
       
   112 	iOpIdPckg.Set((TUint8*)&aOperationId, sizeof(TUint), sizeof(TUint));
       
   113 	args.Set(1, &iOpIdPckg);
       
   114 	args.Set(2, &aData);
       
   115 
       
   116 	SendReceive(ERemConBulkReceive, 
       
   117 		args,
       
   118 		aStatus);
       
   119 	}
       
   120 
       
   121 EXPORT_C TInt RRemConBulk::ReceiveCancel()
       
   122 	{
       
   123 	LOG_FUNC
       
   124 
       
   125 	// See RRemConBulk::SendCancel() for comment
       
   126 	(void)SendReceive(ERemConBulkReceiveCancel);
       
   127 	
       
   128 	return KErrNone;
       
   129 	}
       
   130 
       
   131 EXPORT_C TInt RRemConBulk::__DbgMarkHeap()
       
   132 	{
       
   133 	LOG_FUNC
       
   134 #ifdef _DEBUG
       
   135 	return SendReceive(ERemConBulkDbgMarkHeap);
       
   136 #else
       
   137 	return KErrNone;
       
   138 #endif
       
   139 	}
       
   140 
       
   141 EXPORT_C TInt RRemConBulk::__DbgCheckHeap(TInt aCount)
       
   142 	{
       
   143 	LOG_FUNC
       
   144 #ifdef _DEBUG
       
   145 	return SendReceive(ERemConBulkDbgCheckHeap, TIpcArgs(aCount));
       
   146 #else
       
   147 	(void)aCount;
       
   148 	return KErrNone;
       
   149 #endif
       
   150 	}
       
   151 
       
   152 EXPORT_C TInt RRemConBulk::__DbgMarkEnd(TInt aCount)
       
   153 	{
       
   154 	LOG_FUNC
       
   155 #ifdef _DEBUG
       
   156 	return SendReceive(ERemConBulkDbgMarkEnd, TIpcArgs(aCount));
       
   157 #else
       
   158 	(void)aCount;
       
   159 	return KErrNone;
       
   160 #endif
       
   161 	}
       
   162 
       
   163 EXPORT_C TInt RRemConBulk::__DbgFailNext(TInt aCount)
       
   164 	{
       
   165 	LOG_FUNC
       
   166 #ifdef _DEBUG
       
   167 	return SendReceive(ERemConBulkDbgFailNext, TIpcArgs(aCount));
       
   168 #else
       
   169 	(void)aCount;
       
   170 	return KErrNone;
       
   171 #endif
       
   172 	}
       
   173