51
|
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 |
#include "avrcpincomingcommandhandler.h"
|
|
17 |
#include "avrcpoutgoingcommandhandler.h"
|
|
18 |
#include "avrcpremotedevice.h"
|
|
19 |
|
|
20 |
#include "avrcplog.h"
|
|
21 |
|
|
22 |
/** Factory function.
|
|
23 |
|
|
24 |
@param aAddr The remote device this manages transactions with.
|
|
25 |
@param aRouter A CRcpRouter to use for communication with remote devices.
|
|
26 |
@param aBearer The CRemConBearerAvrcp this is to handle commands for.
|
|
27 |
@param aObserver The observer of the bearer. Used to acquire converters.
|
|
28 |
@param aTimer CDeltaTimer to use for queuing timed events.
|
|
29 |
@return A fully constructed CRcpRemoteDevice.
|
|
30 |
@leave System wide error codes.
|
|
31 |
*/
|
|
32 |
CRcpRemoteDevice* CRcpRemoteDevice::NewL(const TBTDevAddr& aAddr,
|
|
33 |
CRcpRouter& aRouter,
|
|
34 |
MRemConControlCommandInterface& aCommandInterface,
|
|
35 |
MRemConBearerObserver& aObserver,
|
|
36 |
CDeltaTimer& aTimer,
|
|
37 |
CAvrcpPlayerInfoManager& aPlayerInfoManager)
|
|
38 |
{
|
|
39 |
LOG_STATIC_FUNC
|
|
40 |
CRcpRemoteDevice* engine = new(ELeave) CRcpRemoteDevice(aAddr, aRouter, aCommandInterface, aTimer);
|
|
41 |
CleanupStack::PushL(engine);
|
|
42 |
engine->ConstructL(aObserver, aPlayerInfoManager);
|
|
43 |
CleanupStack::Pop(engine);
|
|
44 |
return engine;
|
|
45 |
}
|
|
46 |
|
|
47 |
/** Constructor.
|
|
48 |
|
|
49 |
@param aAddr The remote device this manages transactions with.
|
|
50 |
@param aRouter A CRcpRouter to use for communication with remote devices.
|
|
51 |
@param aBearer The CRemConBearerAvrcp this is to handle commands for.
|
|
52 |
@param aObserver The observer of the bearer. Used to acquire converters.
|
|
53 |
@param aTimer CDeltaTimer to use for queuing timed events.
|
|
54 |
@return A partially constructed CRcpRemoteDevice.
|
|
55 |
@leave System wide error codes.
|
|
56 |
*/
|
|
57 |
CRcpRemoteDevice::CRcpRemoteDevice(const TBTDevAddr& aAddr,
|
|
58 |
CRcpRouter& aRouter,
|
|
59 |
MRemConControlCommandInterface& aCommandInterface,
|
|
60 |
CDeltaTimer& aTimer) :
|
|
61 |
iDevice(aAddr), iRouter(aRouter), iCommandInterface(aCommandInterface), iTimer(aTimer)
|
|
62 |
{
|
|
63 |
LOG_FUNC
|
|
64 |
}
|
|
65 |
|
|
66 |
/** Second phase construction.
|
|
67 |
|
|
68 |
@param aObserver An observer to pass the handlers to allow them to
|
|
69 |
acquire converters.
|
|
70 |
*/
|
|
71 |
void CRcpRemoteDevice::ConstructL(MRemConBearerObserver& aObserver,
|
|
72 |
CAvrcpPlayerInfoManager& aPlayerInfoManager)
|
|
73 |
{
|
|
74 |
LOG_FUNC
|
|
75 |
iIncoming = CRcpIncomingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer, aPlayerInfoManager, iDevice);
|
|
76 |
iOutgoing = CRcpOutgoingCommandHandler::NewL(iCommandInterface, aObserver, iRouter, iTimer);
|
|
77 |
}
|
|
78 |
|
|
79 |
/** Destructor.
|
|
80 |
*/
|
|
81 |
CRcpRemoteDevice::~CRcpRemoteDevice()
|
|
82 |
{
|
|
83 |
LOG_FUNC
|
|
84 |
delete iIncoming;
|
|
85 |
delete iOutgoing;
|
|
86 |
}
|
|
87 |
|
|
88 |
/** Stop handling for this remote device.
|
|
89 |
|
|
90 |
@param aClearQueue Whether the outgoing queue should be cleared.
|
|
91 |
*/
|
|
92 |
void CRcpRemoteDevice::Disconnect(TBool aClearQueue)
|
|
93 |
{
|
|
94 |
LOG_FUNC
|
|
95 |
iIncoming->Disconnect();
|
|
96 |
iOutgoing->Disconnect(aClearQueue);
|
|
97 |
}
|
|
98 |
|
|
99 |
/** Get the remote address of this device.
|
|
100 |
|
|
101 |
@return the remote address of this device.
|
|
102 |
*/
|
|
103 |
const TBTDevAddr& CRcpRemoteDevice::RemoteAddress() const
|
|
104 |
{
|
|
105 |
LOG_FUNC
|
|
106 |
return iDevice;
|
|
107 |
}
|
|
108 |
|
|
109 |
/** Get the incoming handler for this device.
|
|
110 |
|
|
111 |
@return The incoming handler for this device.
|
|
112 |
*/
|
|
113 |
MIncomingCommandHandler& CRcpRemoteDevice::IncomingHandler() const
|
|
114 |
{
|
|
115 |
LOG_FUNC
|
|
116 |
return *iIncoming;
|
|
117 |
}
|
|
118 |
|
|
119 |
/** Get the outgoing handler for this device.
|
|
120 |
|
|
121 |
@return The outgoing handler for this device.
|
|
122 |
*/
|
|
123 |
MOutgoingCommandHandler& CRcpRemoteDevice::OutgoingHandler() const
|
|
124 |
{
|
|
125 |
LOG_FUNC
|
|
126 |
return *iOutgoing;
|
|
127 |
}
|
|
128 |
|
|
129 |
|