|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * This file defines the interface to the client side session of the |
|
16 * STS Server. |
|
17 */ |
|
18 |
|
19 #ifndef RSTSSESSION_H_ |
|
20 #define RSTSSESSION_H_ |
|
21 |
|
22 #include <e32msgqueue.h> |
|
23 #include <map> |
|
24 #include <systemtoneservice.h> |
|
25 |
|
26 #include "stsclientservercommon.h" |
|
27 |
|
28 class RStsSession : public RSessionBase |
|
29 { |
|
30 public: |
|
31 |
|
32 TInt Connect(); |
|
33 |
|
34 void Close(); |
|
35 |
|
36 void SendPlayTone(CSystemToneService::TToneType aTone); |
|
37 |
|
38 void SendPlayAlarm(CSystemToneService::TAlarmType aAlarm, |
|
39 unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver); |
|
40 |
|
41 void SendStopAlarm(unsigned int aAlarmContext); |
|
42 |
|
43 private: |
|
44 |
|
45 static TInt CallBackThreadMain(TAny* aSession); |
|
46 void RunThreadL(); |
|
47 |
|
48 TInt CreateServerSession(); |
|
49 void HandleMessage(TStsCallBack& aMessage); |
|
50 TInt StartServer(); |
|
51 TInt StartThread(); |
|
52 void CleanUpObservers(); |
|
53 void SignalObservers(); |
|
54 |
|
55 RThread iThread; |
|
56 RMsgQueue<TStsCallBack> iMsgQueue; |
|
57 TThreadId iServerThreadId; |
|
58 |
|
59 enum TState |
|
60 { |
|
61 EInitializing, ERunning, EStopping |
|
62 }; |
|
63 TState iState; |
|
64 typedef std::map<unsigned int, MStsPlayAlarmObserver*> TObserverMap; |
|
65 TObserverMap iObserverMap; |
|
66 RMutex iObserverMutex; |
|
67 }; |
|
68 |
|
69 #endif // RSTSSESSION_H_ |