1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * QT wrapper API for for System Tone Service |
|
20 * |
|
21 */ |
|
22 |
|
23 #include <xqsystemtoneservice_p.h> |
|
24 |
|
25 XQSystemToneServicePrivate::XQSystemToneServicePrivate(XQSystemToneService *qptr) |
|
26 : |
|
27 q_ptr(qptr), |
|
28 sts(CSystemToneService::Create()) |
|
29 { |
|
30 } |
|
31 |
|
32 XQSystemToneServicePrivate::~XQSystemToneServicePrivate() |
|
33 { |
|
34 if (sts) { |
|
35 CSystemToneService::Delete(sts); |
|
36 } |
|
37 } |
|
38 |
|
39 void XQSystemToneServicePrivate::playTone(XQSystemToneService::ToneType toneType) |
|
40 { |
|
41 if (sts) { |
|
42 sts->PlayTone(mapToneType(toneType)); |
|
43 emit q_ptr->toneStarted(); |
|
44 } |
|
45 } |
|
46 |
|
47 unsigned int XQSystemToneServicePrivate::playAlarm(XQSystemToneService::AlarmType alarmType) |
|
48 { |
|
49 unsigned int ctx = 0; |
|
50 if (sts) { |
|
51 sts->PlayAlarm(mapAlarmType(alarmType), ctx, *this); |
|
52 emit q_ptr->alarmStarted(ctx); |
|
53 } |
|
54 return ctx; |
|
55 } |
|
56 |
|
57 void XQSystemToneServicePrivate::stopAlarm(unsigned int contextId) |
|
58 { |
|
59 if (sts) { |
|
60 sts->StopAlarm(contextId); |
|
61 } |
|
62 } |
|
63 |
|
64 unsigned int XQSystemToneServicePrivate::playAlarm(XQSystemToneService::ToneType toneType) |
|
65 { |
|
66 unsigned int ctx = 0; |
|
67 if (sts) { |
|
68 sts->PlayAlarm(mapToneType(toneType), ctx, *this); |
|
69 emit q_ptr->alarmStarted(ctx); |
|
70 } |
|
71 return ctx; |
|
72 } |
|
73 |
|
74 CSystemToneService::TToneType XQSystemToneServicePrivate::mapToneType(XQSystemToneService::ToneType toneType) |
|
75 { |
|
76 return static_cast<CSystemToneService::TToneType>(toneType); |
|
77 } |
|
78 |
|
79 CSystemToneService::TAlarmType XQSystemToneServicePrivate::mapAlarmType(XQSystemToneService::AlarmType alarmType) |
|
80 { |
|
81 return static_cast<CSystemToneService::TAlarmType>(alarmType); |
|
82 } |
|
83 |
|
84 void XQSystemToneServicePrivate::PlayAlarmComplete(unsigned int contextId) |
|
85 { |
|
86 emit q_ptr->alarmFinished(contextId); |
|
87 } |
|