1 /* |
|
2 * Copyright (c) 2006 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: Bridge-like class that creates the actual worker and tunnels |
|
15 * all the client calls to it |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "rubydebug.h" |
|
21 #include <vcommandapi.h> |
|
22 #include "vcommandservices.h" |
|
23 |
|
24 /** |
|
25 * Factory function |
|
26 * @param aObserver Listener to be notified whenever the VCommand set is changed |
|
27 * by *another* instance of CVCommandHandler. I.e. lets the client know if |
|
28 * his understanding of the VCommand set is up to date |
|
29 */ |
|
30 EXPORT_C CVCommandHandler* CVCommandHandler::NewL( MVCommandHandlerObserver* aObserver ) |
|
31 { |
|
32 CVCommandHandler* self = new (ELeave) CVCommandHandler; |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL( aObserver ); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 void CVCommandHandler::ConstructL( MVCommandHandlerObserver* aObserver ) |
|
40 { |
|
41 iImpl = CVCommandService::NewL( aObserver ); |
|
42 } |
|
43 |
|
44 /** |
|
45 * Synchronous. Service doesn't take the ownership, but makes an own copy |
|
46 * Duplicates can be added |
|
47 * @todo should we check for duplicates and leave with KErrAlreadyExists? |
|
48 */ |
|
49 EXPORT_C void CVCommandHandler::AddCommandL( const CVCommand& aCommand ) |
|
50 { |
|
51 iImpl->AddCommandL( aCommand ); |
|
52 } |
|
53 |
|
54 /** |
|
55 * Synchronous. Service doesn't take the ownership, but makes an own copies |
|
56 * Duplicates can be added |
|
57 * @todo should we check for duplicates and leave with KErrAlreadyExists? |
|
58 */ |
|
59 EXPORT_C void CVCommandHandler::AddCommandsL( const RVCommandArray& aCommands, |
|
60 TBool aIgnoreErrors ) |
|
61 { |
|
62 iImpl->AddCommandsL( aCommands, aIgnoreErrors ); |
|
63 } |
|
64 |
|
65 /** |
|
66 * Synchronous. Removes the command from the system |
|
67 * @param aCommand Reference to the command to be removed. Existing commands are |
|
68 * compared against aCommand. All the matches are removed from VAS |
|
69 * @leave KErrNotFound No such command |
|
70 */ |
|
71 EXPORT_C void CVCommandHandler::RemoveCommandL( const CVCommand& aCommand ) |
|
72 { |
|
73 iImpl->RemoveCommandL( aCommand ); |
|
74 } |
|
75 |
|
76 /** |
|
77 * Synchronous. |
|
78 * @param aCommands Reference to the list of commands to be removed. Existing commands are |
|
79 * compared against aCommands items. All the matches are removed from VAS |
|
80 * @param aIgnoreErrors If ETrue, even if some commands fail to be removed, |
|
81 * handler will remove as many as possible |
|
82 */ |
|
83 EXPORT_C void CVCommandHandler::RemoveCommandsL( const RVCommandArray& aCommands, |
|
84 TBool aIgnoreErrors ) |
|
85 { |
|
86 iImpl->RemoveCommandsL( aCommands, aIgnoreErrors ); |
|
87 } |
|
88 |
|
89 /** |
|
90 * Synchronous |
|
91 * @return an array of the commands in the system |
|
92 * Ownership of the array is transfered to the client |
|
93 * The returned CVCommandArray contains copies of all the |
|
94 * commands currently stored in this handler |
|
95 */ |
|
96 EXPORT_C CVCommandArray* CVCommandHandler::ListCommandsL() |
|
97 { |
|
98 return iImpl->ListCommandsL(); |
|
99 } |
|
100 |
|
101 EXPORT_C CVCommandHandler::~CVCommandHandler() |
|
102 { |
|
103 delete iImpl; |
|
104 } |
|
105 |
|
106 void CVCommandHandler::PlaySpokenTextL( const CStoredVCommand& aCommand, |
|
107 MNssPlayEventHandler& aPlayEventHandler ) const |
|
108 { |
|
109 iImpl->PlaySpokenTextL( aCommand, aPlayEventHandler ); |
|
110 } |
|
111 |
|
112 void CVCommandHandler::PlayAlternativeSpokenTextL( const CStoredVCommand& aCommand, |
|
113 MNssPlayEventHandler& aPlayEventHandler ) const |
|
114 { |
|
115 iImpl->PlayAlternativeSpokenTextL( aCommand, aPlayEventHandler ); |
|
116 } |
|
117 |
|
118 /** |
|
119 * Not intented to be called directly. |
|
120 * @see CVCommand::CancelPlaybackL |
|
121 */ |
|
122 void CVCommandHandler::CancelPlaybackL( const CStoredVCommand& aCommand ) const |
|
123 { |
|
124 iImpl->CancelPlaybackL( aCommand ); |
|
125 } |
|
126 |
|
127 //End of file |
|