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 * The file provides the actual implementation of the STS API. |
|
16 * All of the STS API methods are implemented by passing the |
|
17 * calls to the STS Server through the client side STS |
|
18 * Session. |
|
19 */ |
|
20 |
|
21 // Include Files |
|
22 #include "stsimplementation.h" |
|
23 #include "rstssession.h" |
|
24 |
|
25 // Member Functions |
|
26 /*static*/CStsImplementation* CStsImplementation::Create() |
|
27 { |
|
28 CStsImplementation* self = new CStsImplementation(); |
|
29 if (self != 0) |
|
30 { |
|
31 bool successful = self->Init(); |
|
32 if (!successful) |
|
33 { |
|
34 delete self; |
|
35 self = 0; |
|
36 } |
|
37 } |
|
38 return self; |
|
39 } |
|
40 |
|
41 CStsImplementation::CStsImplementation() : |
|
42 iSession(NULL) |
|
43 { |
|
44 } |
|
45 |
|
46 CStsImplementation::~CStsImplementation() |
|
47 { |
|
48 iSession->Close(); |
|
49 delete iSession; |
|
50 } |
|
51 |
|
52 bool CStsImplementation::Init() |
|
53 { |
|
54 bool result = false; |
|
55 iSession = new RStsSession(); |
|
56 if (iSession) |
|
57 { |
|
58 TInt err = iSession->Connect(); |
|
59 result = err == KErrNone; |
|
60 } |
|
61 return result; |
|
62 } |
|
63 |
|
64 void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone) |
|
65 { |
|
66 iSession->SendPlayTone(aTone); |
|
67 } |
|
68 |
|
69 void CStsImplementation::PlayAlarm(CSystemToneService::TAlarmType aAlarm, |
|
70 unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver) |
|
71 { |
|
72 //TODO: Add logging and error checking |
|
73 iSession->SendPlayAlarm(aAlarm, aAlarmContext, aObserver); |
|
74 } |
|
75 |
|
76 void CStsImplementation::StopAlarm(unsigned int aAlarmContext) |
|
77 { |
|
78 //TODO: Add logging and error checking |
|
79 iSession->SendStopAlarm(aAlarmContext); |
|
80 } |
|