os/mm/devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServer.h
Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: TelephonyAudioRoutingServer implementation
20 #ifndef TELEPHONYAUDIOROUTINGSERVER_H
21 #define TELEPHONYAUDIOROUTINGSERVER_H
24 #include "TelephonyAudioRouting.h"
26 const TInt KMaxNumberOfSessions = 256;
28 enum TTelephonyAudioRoutingPanic
31 EPanicIllegalFunction,
35 void PanicClient(const RMessage2& aMessage,TTelephonyAudioRoutingPanic aPanic);
40 * TelephonyAudioRoutingServer class declaration
42 * @lib TelephonyAudioRoutingServer.lib
43 * @since Series 60 3.1
45 class CTelephonyAudioRoutingServer : public CServer2
48 public: // Constructors and destructor
51 * Two-phased constructor.
53 IMPORT_C static CTelephonyAudioRoutingServer* NewL();
58 ~CTelephonyAudioRoutingServer();
63 * Start the TelephonyAudioRoutingServer thread
64 * @since Series 60 3.1
65 * @param TAny* aParams
66 * @return KErrNone is successfull, else appropriate err code
68 IMPORT_C static TInt StartThreadL(TAny* aParams);
72 * @since Series 60 3.1
79 * Remove an existing session.
80 * @since Series 60 3.1
81 * @param TInt aSessionId Id of the session to remove
84 void RemoveSession(TInt aSessionId);
87 * Notify the policy session about a request to change output.
88 * @since Series 60 3.1
89 * @param TInt aSessionId Id of the session to utilize, aMessage contains output value
92 void DoSetOutputL (TInt aSessionId, const RMessage2& aMessage);
95 * Assign a unique session Id to a new session.
96 * @since Series 60 3.1
98 * @return TInt session Id
100 TInt IdentifyAndAllocateNextFreeSessionIdL();
103 * Free the session Id or a deleted session for re-use.
104 * @since Series 60 3.1
105 * @param TInt aSessionId Id of the session to free
108 void FreeSessionId(TInt aSessionId);
111 * Used by policy session to indicate the session that requested a SetOutput() that
112 * the request is complete, all the other session get OutputChanged() notification
113 * @since Series 60 3.1
114 * @param aOutput value of modified output, aError result of operation.
117 void SetOutputCompleteL(CTelephonyAudioRouting::TAudioOutput aOutput, TInt aError);
120 * Used by policy session to notify all sessions that the output has changed.
121 * (Policy initiated change in output)
122 * @since Series 60 3.1
123 * @param aOutput value of modified output
126 void OutputChanged(CTelephonyAudioRouting::TAudioOutput aOutput);
129 * Used by policy session to indicated to all other sessions that available outputs have changed.
130 * @since Series 60 3.1
131 * @param aOutputs contains array of available outputs
134 void AvailableOutputsChangedL( const TArray<CTelephonyAudioRouting::TAudioOutput>& aOutputs);
137 * Set the Id of the policy session.
138 * @since Series 60 3.1
139 * @param TInt aSessionId is Id to set
142 void SetPolicySessionId(TInt aSessionId);
145 * Provide caller with iCurrentAudioOutput
146 * @since Series 60 3.1
148 * @return iCurrentAudioOutput
150 CTelephonyAudioRouting::TAudioOutput& CurrentAudioOutput();
153 * Provide caller with iPreviousAudioOutput
154 * @since Series 60 3.1
156 * @return iPreviousAudioOutput
158 CTelephonyAudioRouting::TAudioOutput& PreviousAudioOutput();
161 * Provide caller with iShowNoteMode
162 * @since Series 60 3.1
164 * @return iShowNoteMode
166 TBool& ShowNoteMode();
169 * Allows caller to set iShowNoteMode
170 * @since Series 60 3.1
171 * @param TBool aShowNoteMode
174 void SetShowNoteMode(TBool aShowNoteMode);
177 * Provide caller with iAvailableOutputs array
178 * @since Series 60 3.1
180 * @return: Array of available outputs
182 RArray<CTelephonyAudioRouting::TAudioOutput>& AvailableOutputs();
188 * C++ default constructor.
190 CTelephonyAudioRoutingServer(/*TProcessId& aClientPID*/);
193 * By default Symbian 2nd phase constructor is private.
199 * Creates a server-side client session object.
201 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
204 * determines if audio output is in available outputs array.
205 * @since Series 60 3.1
206 * @param aOutput is current output value
207 * @return TBool ETrue if current output is available, EFalse if not
209 TBool IsAvailableOutput(CTelephonyAudioRouting::TAudioOutput aOutput);
214 TInt iPolicySessionId;
215 RArray<TInt> iSetOutputRequests;
216 RArray<TInt> iSessionIdsInUse;
217 CTelephonyAudioRouting::TAudioOutput iCurrentAudioOutput;
218 CTelephonyAudioRouting::TAudioOutput iPreviousAudioOutput;
219 RArray<CTelephonyAudioRouting::TAudioOutput> iAvailableOutputs;