|
1 /* |
|
2 * Copyright (c) 2008 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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation for asynchronous play commands sender object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "hapticstestappview.h" |
|
20 #include "hapticstestappui.h" |
|
21 #include "hapticstestasyncplaysender.h" |
|
22 #include "hapticstesteffectdatahandler.h" |
|
23 |
|
24 // --------------------------------------------------------------------------- |
|
25 // Simple constructor. |
|
26 // --------------------------------------------------------------------------- |
|
27 // |
|
28 CHapticsTestAsyncPlaySender::CHapticsTestAsyncPlaySender( |
|
29 CHapticsTestAppUi* aUi ) |
|
30 : CActive( EPriorityStandard ), iUi( aUi ) |
|
31 { |
|
32 CActiveScheduler::Add( this ); |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // Destructor. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CHapticsTestAsyncPlaySender::~CHapticsTestAsyncPlaySender() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Method for requesting the playing of an effect repeatedly. |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 void CHapticsTestAsyncPlaySender::PlayRepeat( CHWRMHaptics* aHaptics, |
|
49 TInt aFileHandle, |
|
50 TInt aEffectIndex, |
|
51 TUint8 aRepeat, |
|
52 TInt& aEffectHandle ) |
|
53 { |
|
54 iIndex = aEffectIndex; |
|
55 aHaptics->PlayEffectRepeat( aFileHandle, |
|
56 aEffectIndex, |
|
57 aRepeat, |
|
58 aEffectHandle, |
|
59 iStatus ); |
|
60 SetActive(); |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // Method for requesting the playing of an effect. |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CHapticsTestAsyncPlaySender::Play( CHWRMHaptics* aHaptics, |
|
68 TInt aFileHandle, |
|
69 TInt aEffectIndex, |
|
70 TInt& aEffectHandle ) |
|
71 { |
|
72 iIndex = aEffectIndex; |
|
73 aHaptics->PlayEffect( aFileHandle, |
|
74 aEffectIndex, |
|
75 aEffectHandle, |
|
76 iStatus ); |
|
77 SetActive(); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // This active object's RunL. |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CHapticsTestAsyncPlaySender::RunL() |
|
85 { |
|
86 TInt status = iStatus.Int(); |
|
87 iUi->PrintPlayEffectStatus( status ); |
|
88 iUi->GetCurrentEffectState(); |
|
89 if ( !status ) |
|
90 { |
|
91 iUi->iEffectData->AddEffectInfo( |
|
92 iUi->iEffectHandle, iUi->iIVTFileHandle, iIndex ); |
|
93 } |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // Dummy DoCancel(). Required due to inheritance from CActive. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CHapticsTestAsyncPlaySender::DoCancel() |
|
101 { |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // Dummy RunError(). Required due to inheritance from CActive. |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CHapticsTestAsyncPlaySender::RunError( TInt /* aError */ ) |
|
109 { |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 // end of file |