|
1 // Copyright (c) 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 #include "internalcommand.h" |
|
17 #include "avrcputils.h" |
|
18 #include <bluetooth/logger.h> |
|
19 |
|
20 #ifdef __FLOG_ACTIVE |
|
21 _LIT8(KLogComponent, LOG_COMPONENT_AVRCP_BEARER); |
|
22 #endif |
|
23 |
|
24 /** Factory function. |
|
25 |
|
26 @param aFrame The frame this command is to represent. |
|
27 @param aRemConId The RemCon transaction label. |
|
28 @param aTransLabel The AVCTP transaction label. |
|
29 @param aAddr The bluetooth address to send this command to. |
|
30 @return A fully constructed CBrowseCommand. |
|
31 @leave System wide error codes. |
|
32 */ |
|
33 CInternalCommand* CInternalCommand::NewL(TUid aInterfaceUid, |
|
34 TUint aId, |
|
35 TUint aOperationId, |
|
36 const TDesC8& aCommandData) |
|
37 { |
|
38 CInternalCommand* command = new(ELeave)CInternalCommand(aInterfaceUid, aId, aOperationId); |
|
39 CleanupStack::PushL(command); |
|
40 command->ConstructL(aCommandData); |
|
41 CleanupStack::Pop(command); |
|
42 return command; |
|
43 } |
|
44 |
|
45 /** Constructor. |
|
46 |
|
47 @param aFrame The AV/C frame this command is to represent. |
|
48 @param aRemConId The RemCon transaction label. |
|
49 @param aTransLabel The AVCTP transaction label. |
|
50 @param aAddr The bluetooth address to send this command to. |
|
51 @return A partially constructed CBrowseCommand. |
|
52 @leave System wide error codes. |
|
53 */ |
|
54 CInternalCommand::CInternalCommand(TUid aInterfaceUid, |
|
55 TUint aId, |
|
56 TUint aOperationId) |
|
57 : CAvrcpCommand(aId, KDummyTransactionLabel, NULL) |
|
58 { |
|
59 LOG_FUNC |
|
60 iInterfaceUid = aInterfaceUid; |
|
61 iOperationId = aOperationId; |
|
62 } |
|
63 |
|
64 /** Destructor. |
|
65 */ |
|
66 CInternalCommand::~CInternalCommand() |
|
67 { |
|
68 LOG_FUNC |
|
69 __ASSERT_DEBUG(iUsers == 0, AvrcpUtils::Panic(EAvrcpCommandStillInUse)); |
|
70 iCommandData.Close(); |
|
71 } |
|
72 |
|
73 void CInternalCommand::ConstructL(const TDesC8& aCommandData) |
|
74 { |
|
75 iCommandData.CreateL(aCommandData); |
|
76 } |
|
77 |
|
78 void CInternalCommand::ResetL(TUint& aId, const TDesC8& aCommandData) |
|
79 { |
|
80 iCommandData.Close(); |
|
81 iCommandData.CreateL(aCommandData); |
|
82 iRemConId = aId; |
|
83 } |
|
84 |
|
85 SymbianAvctp::TMessageType CInternalCommand::MessageType() const |
|
86 { |
|
87 // Should never be going out AVCTPwards |
|
88 __ASSERT_DEBUG(EFalse, AvrcpUtils::Panic(EAvctpMessageTypeRequestedForInternalCommand)); |
|
89 |
|
90 return SymbianAvctp::EUndefined; |
|
91 } |
|
92 |
|
93 const TDesC8& CInternalCommand::Data() const |
|
94 { |
|
95 return iCommandData; |
|
96 } |