77
|
1 |
/*
|
|
2 |
* Copyright (c) 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: The stub for testing tsp events
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "ut_atsptspeventsstub.h"
|
|
19 |
#include "tsptriggerevents.h"
|
|
20 |
|
|
21 |
#include <e32property.h>
|
|
22 |
#include <W32STD.H>
|
|
23 |
|
|
24 |
CUt_AtspTspEventsStub* CUt_AtspTspEventsStub::NewL()
|
|
25 |
{
|
|
26 |
CUt_AtspTspEventsStub* self = new( ELeave ) CUt_AtspTspEventsStub();
|
|
27 |
CleanupStack::PushL( self );
|
|
28 |
self->ConstructL();
|
|
29 |
CleanupStack::Pop();
|
|
30 |
return self;
|
|
31 |
}
|
|
32 |
|
|
33 |
CUt_AtspTspEventsStub::~CUt_AtspTspEventsStub()
|
|
34 |
{
|
|
35 |
Cancel();
|
|
36 |
}
|
|
37 |
|
|
38 |
CUt_AtspTspEventsStub::CUt_AtspTspEventsStub()
|
|
39 |
: CTimer(CActive::EPriorityStandard), iIsRunLCalled(EFalse), iIsTimerElapsed(EFalse)
|
|
40 |
{
|
|
41 |
}
|
|
42 |
|
|
43 |
void CUt_AtspTspEventsStub::ConstructL()
|
|
44 |
{
|
|
45 |
CTimer::ConstructL();
|
|
46 |
CActiveScheduler::Add(this);
|
|
47 |
}
|
|
48 |
|
|
49 |
void CUt_AtspTspEventsStub::IssueAudioPropertyL()
|
|
50 |
{
|
|
51 |
_LIT(KAppName, "ut_atspaudioproperty.exe");
|
|
52 |
RProcess process;
|
|
53 |
TInt error = process.Create(KAppName, KNullDesC);
|
|
54 |
User::LeaveIfError(error);
|
|
55 |
CleanupClosePushL(process);
|
|
56 |
TRequestStatus status;
|
|
57 |
process.Rendezvous(status);
|
|
58 |
process.Resume();
|
|
59 |
User::WaitForRequest(status);
|
|
60 |
User::LeaveIfError(status.Int());
|
|
61 |
|
|
62 |
CleanupStack::PopAndDestroy();
|
|
63 |
}
|
|
64 |
|
|
65 |
void CUt_AtspTspEventsStub::IssueTspPropertyL()
|
|
66 |
{
|
|
67 |
const TUid KTspClientMapperProperty = { 0x10200C70 };
|
|
68 |
const TUint32 KTspClientMapperKeyPlaying = 0x00000001;
|
|
69 |
|
|
70 |
RProperty myProperty;
|
|
71 |
CleanupClosePushL(myProperty);
|
|
72 |
// The value of the property
|
|
73 |
TUint16 array[4] = {10,20,30,40};
|
|
74 |
TBuf16<10> buf;
|
|
75 |
buf.Copy(&array[0],sizeof(array));
|
|
76 |
|
|
77 |
// Attach and set the property
|
|
78 |
User::LeaveIfError(myProperty.Attach(KTspClientMapperProperty, KTspClientMapperKeyPlaying, EOwnerThread));
|
|
79 |
User::LeaveIfError(myProperty.Set(buf));
|
|
80 |
|
|
81 |
// CLose the property
|
|
82 |
CleanupStack::PopAndDestroy();
|
|
83 |
}
|
|
84 |
|
|
85 |
void CUt_AtspTspEventsStub::IssueWsEventL(const TInt aType)
|
|
86 |
{
|
|
87 |
RWsSession ws;
|
|
88 |
User::LeaveIfError(ws.Connect());
|
|
89 |
CleanupClosePushL(ws);
|
|
90 |
|
|
91 |
TWsEvent event;
|
|
92 |
event.SetType(aType);
|
|
93 |
ws.SendEventToAllWindowGroups(event);
|
|
94 |
|
|
95 |
ws.Finish();
|
|
96 |
CleanupStack::PopAndDestroy(&ws);
|
|
97 |
}
|
|
98 |
|
|
99 |
void CUt_AtspTspEventsStub::MtrtoEvaluateRoutingRules()
|
|
100 |
{
|
|
101 |
iIsRunLCalled = ETrue;
|
|
102 |
CActiveScheduler::Stop();
|
|
103 |
}
|
|
104 |
|
|
105 |
void CUt_AtspTspEventsStub::RunL()
|
|
106 |
{
|
|
107 |
iIsTimerElapsed = ETrue;
|
|
108 |
CActiveScheduler::Stop();
|
|
109 |
}
|
|
110 |
|
|
111 |
void CUt_AtspTspEventsStub::DoCancel()
|
|
112 |
{
|
|
113 |
CTimer::DoCancel();
|
|
114 |
}
|