|
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 #ifndef XQSYSTEMTONESERVICE_H |
|
24 #define XQSYSTEMTONESERVICE_H |
|
25 |
|
26 #include <QObject> |
|
27 |
|
28 #include <systemtoneservice.h> |
|
29 |
|
30 #ifdef __STS_QT_LIB_BUILD__ |
|
31 # define STS_EXPORT Q_DECL_EXPORT |
|
32 #else |
|
33 # define STS_EXPORT Q_DECL_IMPORT |
|
34 #endif |
|
35 |
|
36 class XQSystemToneServicePrivate; |
|
37 |
|
38 /** |
|
39 * The System Tone Service (STS) is a component of the Multimedia Services (mmserv) |
|
40 * collection of the Multimedia Middleware (mmmw) package. STS provides multimedia APIs |
|
41 * specific to playing system tones (calendar, message alerts, warnings, etc). |
|
42 * |
|
43 * Here you can find Qt wrapper for this component. |
|
44 * |
|
45 * Main concepts behind this API: |
|
46 * * tone - short sound used in the manner "fire and forget" therefore there are no signals when tone ends. |
|
47 * * alarm - these are kind of looped/longer sounds that may be interrupted by calling app; also there are notifications (signals) when alarm ends playing. |
|
48 * |
|
49 */ |
|
50 class XQSystemToneService : public QObject |
|
51 { |
|
52 Q_OBJECT |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Supported tone types. |
|
58 */ |
|
59 Q_DECL_IMPORT enum ToneType { |
|
60 // Capture Tones |
|
61 BurstModeTone = CSystemToneService::EBurstMode, |
|
62 CaptureTone = CSystemToneService::ECapture, |
|
63 CallRecordingTone = CSystemToneService::ECallRecording, |
|
64 RecordingStartTone = CSystemToneService::ERecordingStart, |
|
65 RecordingStopTone = CSystemToneService::ERecordingStop, |
|
66 SelfTimerTone = CSystemToneService::ESelfTimer, |
|
67 |
|
68 // General Tones |
|
69 ConfirmationBeepTone = CSystemToneService::EConfirmationBeep, |
|
70 DefaultBeepTone = CSystemToneService::EDefaultBeep, |
|
71 ErrorBeepTone = CSystemToneService::EErrorBeep, |
|
72 InformationBeepTone = CSystemToneService::EInformationBeep, |
|
73 WarningBeepTone = CSystemToneService::EWarningBeep, |
|
74 IntegratedHandsFreeActivatedTone = CSystemToneService::EIntegratedHandsFreeActivated, |
|
75 |
|
76 // Key Tones |
|
77 TouchScreenTone = CSystemToneService::ETouchScreen, |
|
78 |
|
79 // Location Tones |
|
80 LocationRequestTone = CSystemToneService::ELocationRequest, |
|
81 |
|
82 // Messaging Tones |
|
83 ChatAlertTone = CSystemToneService::EChatAlert, |
|
84 EmailAlertTone = CSystemToneService::EEmailAlert, |
|
85 MmsAlertTone = CSystemToneService::EMmsAlert, |
|
86 SmsAlertTone = CSystemToneService::ESmsAlert, |
|
87 DeliveryReportTone = CSystemToneService::EDeliveryReport, |
|
88 MessageSendFailureTone = CSystemToneService::EMessageSendFailure, |
|
89 |
|
90 // Power Tones |
|
91 BatteryLowTone = CSystemToneService::EBatteryLow, |
|
92 BatteryRechargedTone = CSystemToneService::EBatteryRecharged, |
|
93 PowerOnTone = CSystemToneService::EPowerOn, |
|
94 PowerOffTone = CSystemToneService::EPowerOff, |
|
95 WakeUpTone = CSystemToneService::EWakeUp, |
|
96 WrongChargerTone = CSystemToneService::EWrongCharger, |
|
97 |
|
98 // Telephony Tones |
|
99 AutomaticRedialCompleteTone = CSystemToneService::EAutomaticRedialComplete, |
|
100 |
|
101 // Voice Recognition Tones |
|
102 VoiceStartTone = CSystemToneService::EVoiceStart, |
|
103 VoiceErrorTone = CSystemToneService::EVoiceError, |
|
104 VoiceAbortTone = CSystemToneService::EVoiceAbort |
|
105 }; |
|
106 |
|
107 Q_DECL_IMPORT enum AlarmType { |
|
108 // Calendar Tones |
|
109 CalendarAlarmTone = CSystemToneService::ECalendarAlarm, |
|
110 ClockAlarmTone = CSystemToneService::EClockAlarm, |
|
111 ToDoAlarmTone = CSystemToneService::EToDoAlarm, |
|
112 |
|
113 // Telephony Alarms |
|
114 IncomingCallTone = CSystemToneService::EIncomingCall, |
|
115 IncomingCallLine2Tone = CSystemToneService::EIncomingCallLine2, |
|
116 IncomingDataCallTone = CSystemToneService::EIncomingDataCall, |
|
117 }; |
|
118 |
|
119 |
|
120 public: |
|
121 /** |
|
122 * XQSystemToneService object constructor. |
|
123 */ |
|
124 STS_EXPORT XQSystemToneService(QObject *parent = 0); |
|
125 |
|
126 /** |
|
127 * Simple destructor. |
|
128 */ |
|
129 STS_EXPORT ~XQSystemToneService(); |
|
130 |
|
131 /** |
|
132 * Play selected tone. |
|
133 * |
|
134 * @param toneType selected tone type. |
|
135 * @see XQSystemToneService::error() |
|
136 */ |
|
137 STS_EXPORT void playTone(ToneType toneType); |
|
138 |
|
139 /** |
|
140 * Play selected alarm. |
|
141 * |
|
142 * @param toneType selected tone type. |
|
143 * @param contextId unique playback id for current playback event. May be used for matching playback signals and/or to later stop playing. |
|
144 * @see XQSystemToneService::stopAlarm(unsigned int contextId) |
|
145 * @see XQSystemToneService::error() |
|
146 */ |
|
147 STS_EXPORT void playAlarm(AlarmType alarmType, unsigned int& contextId); |
|
148 |
|
149 |
|
150 /** |
|
151 * Cancel tone being played currently. |
|
152 * |
|
153 * @param contextId id, must be same as given by playTone method. |
|
154 * @see XQSystemToneService::playAlarm(ToneType toneType, unsigned int& contextId) |
|
155 */ |
|
156 STS_EXPORT void stopAlarm(unsigned int contextId); |
|
157 |
|
158 signals: |
|
159 |
|
160 /** |
|
161 * Playback of given tone has been started. |
|
162 * |
|
163 */ |
|
164 STS_EXPORT void toneStarted(); |
|
165 |
|
166 /** |
|
167 * Playback of given alarm has been started. |
|
168 * |
|
169 * @param contextId id, the same as given by playTone method. |
|
170 * |
|
171 */ |
|
172 STS_EXPORT void alarmStarted(unsigned int contextId); |
|
173 |
|
174 /** |
|
175 * Playback of given alarm has been finished. |
|
176 * |
|
177 * @param contextId id, the same as given by playTone method. |
|
178 * |
|
179 */ |
|
180 STS_EXPORT void alarmFinished(unsigned int contextId); |
|
181 |
|
182 private: |
|
183 |
|
184 XQSystemToneServicePrivate *d_p; |
|
185 |
|
186 friend class XQSystemToneServicePrivate; |
|
187 |
|
188 }; |
|
189 |
|
190 #endif /*SYSTEMTONESERVICE_QT_H*/ |