summaryrefslogtreecommitdiff
path: root/include/svi.h
blob: bbef08a47b1a199ee9a1f578328f9c01085c9a02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
/*
 * libfeedback
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#ifndef __SVI_H__
#define __SVI_H__

/**
 * @addtogroup APPLICATION_FRAMEWORK
 * @{
 *
 * @defgroup    SVI SVI
 * @brief       A library for playing sound and vibration.
 *
 * @section Header To use Them:
 * @code
 * #include <svi.h>
 * @endcode
 *
 * @section Vib_IDs Vibration IDs
 * @code
	SVI_VIB_TOUCH_TOUCH
	SVI_VIB_TOUCH_SIP
	SVI_VIB_TOUCH_SIP_BACKSPACE
	SVI_VIB_TOUCH_HOLD
	SVI_VIB_TOUCH_MULTI_TAP
	SVI_VIB_TOUCH_HW_TAP
	SVI_VIB_TOUCH_HW_HOLD

	SVI_VIB_TOUCH_KEY00
	SVI_VIB_TOUCH_KEY01
	SVI_VIB_TOUCH_KEY02
	SVI_VIB_TOUCH_KEY03
	SVI_VIB_TOUCH_KEY04
	SVI_VIB_TOUCH_KEY05
	SVI_VIB_TOUCH_KEY06
	SVI_VIB_TOUCH_KEY07
	SVI_VIB_TOUCH_KEY08
	SVI_VIB_TOUCH_KEY09
	SVI_VIB_TOUCH_KEY_STAR
	SVI_VIB_TOUCH_KEY_SHARP

	SVI_VIB_NOTIFICATION_INCOMING_CALL01
	SVI_VIB_NOTIFICATION_INCOMING_CALL02
	SVI_VIB_NOTIFICATION_INCOMING_CALL03
	SVI_VIB_NOTIFICATION_MESSAGE
	SVI_VIB_NOTIFICATION_EMAIL
	SVI_VIB_NOTIFICATION_WAKEUP
	SVI_VIB_NOTIFICATION_SCHEDULE
	SVI_VIB_NOTIFICATION_TIMER
	SVI_VIB_NOTIFICATION_GENERAL

	SVI_VIB_OPERATION_POWER_ON
	SVI_VIB_OPERATION_POWER_OFF
	SVI_VIB_OPERATION_CHARGERCONN
	SVI_VIB_OPERATION_FULLCHARGED
	SVI_VIB_OPERATION_LOWBATT
	SVI_VIB_OPERATION_LOCK
	SVI_VIB_OPERATION_UNLOCK
	SVI_VIB_OPERATION_CALLCONNECT
	SVI_VIB_OPERATION_DISCALLCONNECT
	SVI_VIB_OPERATION_MINUTEMINDER
	SVI_VIB_OPERATION_VIBRATION
	SVI_VIB_OPERATION_NEWCHAT
	SVI_VIB_OPERATION_SENDCHAT
	SVI_VIB_OPERATION_ONOFFSLIDER
	SVI_VIB_OPERATION_SHUTTER
	SVI_VIB_OPERATION_LIST_REORDER
	SVI_VIB_OPERATION_SLIDER_SWEEP
 * @endcode
 *
 * @section Snd_IDs Sound IDs
 * @code
    SVI_SND_TOUCH_TOUCH1
    SVI_SND_TOUCH_TOUCH2
    SVI_SND_TOUCH_TOUCH3
    SVI_SND_TOUCH_SIP
    SVI_SND_TOUCH_SIP_BACKSPACE
    SVI_SND_TOUCH_HOLD
    SVI_SND_TOUCH_MULTI_TAP
    SVI_SND_TOUCH_HW_TAP
    SVI_SND_TOUCH_HW_HOLD

    SVI_SND_TOUCH_KEY00
    SVI_SND_TOUCH_KEY01
    SVI_SND_TOUCH_KEY02
    SVI_SND_TOUCH_KEY03
    SVI_SND_TOUCH_KEY04
    SVI_SND_TOUCH_KEY05
    SVI_SND_TOUCH_KEY06
    SVI_SND_TOUCH_KEY07
    SVI_SND_TOUCH_KEY08
    SVI_SND_TOUCH_KEY09
    SVI_SND_TOUCH_KEY_STAR
    SVI_SND_TOUCH_KEY_SHARP

    SVI_SND_OPERATION_POWERON
    SVI_SND_OPERATION_POWEROFF
    SVI_SND_OPERATION_CHARGERCONN
    SVI_SND_OPERATION_FULLCHARGED
    SVI_SND_OPERATION_LOWBATT
    SVI_SND_OPERATION_LOCK
    SVI_SND_OPERATION_UNLOCK
    SVI_SND_OPERATION_CALLCONN
    SVI_SND_OPERATION_CALLDISCONN
    SVI_SND_OPERATION_MINUTE_MINDER
    SVI_SND_OPERATION_VIBRATION
    SVI_SND_OPERATION_NEWCHAT
    SVI_SND_OPERATION_SENTCHAT
    SVI_SND_OPERATION_ONOFFSLIDER
    SVI_SND_OPERATION_SCRCAPTURE
    SVI_SND_OPERATION_LIST_REORDER
    SVI_SND_OPERATION_SLIDER_SWEEP
 * @endcode
 */

/**
 * @addtogroup SVI
 * @{
 */

#include <svi-ids.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define SVI_SUCCESS	0
#define SVI_ERROR	-1

/**
 * \par Description:
 * Initialize audio ui library.\n
 * Load sound profile and status, and open haptic device.\n
 *
 * \par Purpose:
 * This API is used for initializing sound and haptic device.
 *
 * \par Typical use case:
 * If user want to initialize sound or vibration, he(or she) can use this API.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library and device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param handle	[out]	svi handle.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- initialize sound status and haptic device successfully. \n
 * - SVI_ERROR	- fail to initialize sound status or haptic device. \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * svi_fini()
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * int handle = 0;
 *
 * r = svi_init(&handle); //Initialize SVI
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Cannot initialize SVI.\n");
 *	svi_fini(handle); //If initialization is failed, finalize SVI directly
 * } else {
 *
 *	r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1); //Play sound and vibration
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot play sound or vibration.\n");
 *	}
 *
 *	r = svi_fini(handle); //Finalize SVI
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot close SVI.\n");
 *	}
 * }
 *
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_init(int *handle);

/**
 * \par Description:
 * Finalize audio ui library.\n
 * Unload sound profile and status, and close haptic device.\n
 *
 * \par Purpose:
 * This API is used for finalize sound and close haptic device.
 *
 * \par Typical use case:
 * If user want to finalize sound or close haptic device, he(or she) can use this API.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library and device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param handle	[in]	svi handle.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- finalize sound status and close haptic device successfully. \n
 * - SVI_ERROR	- fail to finalize sound status or close haptic device. \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * svi_init()
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * int handle = 0;
 *
 * r = svi_init(&handle); //Initialize SVI
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Cannot initialize SVI.\n");
 *	svi_fini(handle); //If initialization is failed, finalize SVI directly
 * } else {
 *
 *	r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1); //Play sound and vibration
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot play sound or vibration.\n");
 *	}
 *
 *	r = svi_fini(handle); //Finalize SVI
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot close SVI.\n");
 *	}
 * }
 *
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_fini(int handle);


/**
 * \par Description:
 * Play simple sound.\n
 *
 * \par Purpose:
 * This API is used for playing predefined simple sound.
 *
 * \par Typical use case:
 * If user want to play sound for predefined simple pattern, he(or she) can use this API.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library.
 *
 * \par Important notes:
 * None
 *
 * \param handle	[in]	svi handle.
 * \param sound_key	[in]	predefined sound key.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- play sound successfully. \n
 * - SVI_ERROR	- fail to play sound . \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * None
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * int handle = 0;
 *
 * r = svi_init(&handle); //Initialize SVI
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Cannot initialize SVI.\n");
 *	svi_fini(handle); //If initialization is failed, finalize SVI directly
 * } else {
 *
 *	r = svi_play_sound (handle, SVI_SND_TOUCH_TOUCH1); //Play sound
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot play sound or vibration.\n");
 *	}
 *
 *	r = svi_fini(handle); //Finalize SVI
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot close SVI.\n");
 *	}
 * }
 *
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_play_sound(int handle, sound_type sound_key);

/**
 * \par Description:
 * Play simple vibration.\n
 *
 * \par Purpose:
 * This API is used for playing predefined simple vibration.
 *
 * \par Typical use case:
 * If user want to play vibration for predefined simple pattern, he(or she) can use this API.
 *
 * \par Method of function operation:
 * SVI uses device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param handle	[in]	svi handle.
 * \param vibration_key	[in]	predefined vibration key.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- play sound and vibration successfully. \n
 * - SVI_ERROR	- fail to play sound or vibration. \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * None
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * int handle = 0;
 *
 * r = svi_init(&handle); //Initialize SVI
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Cannot initialize SVI.\n");
 *	svi_fini(handle); //If initialization is failed, finalize SVI directly
 * } else {
 *
 *	r = svi_play_vib (handle, SVI_VIB_TOUCH_TOUCH); //Play vibration
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot play sound or vibration.\n");
 *	}
 *
 *	r = svi_fini(handle); //Finalize SVI
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot close SVI.\n");
 *	}
 * }
 *
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_play_vib(int handle, vibration_type vibration_key);

/**
 * \par Description:
 * Play simple sound and vibration.\n
 *
 * \par Purpose:
 * This API is used for playing predefined simple sound and vibration.
 *
 * \par Typical use case:
 * If user want to play sound or vibration for predefined simple pattern, he(or she) can use this API.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library and device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param handle	[in]	svi handle.
 * \param vibration_key	[in]	predefined vibration key.
 * \param sound_key	[in]	predefined sound key.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- play sound and vibration successfully. \n
 * - SVI_ERROR	- fail to play sound or vibration. \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * None
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * int handle = 0;
 *
 * r = svi_init(&handle); //Initialize SVI
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Cannot initialize SVI.\n");
 *	svi_fini(handle); //If initialization is failed, finalize SVI directly.
 * } else {
 *
 *	r = svi_play (handle, SVI_VIB_TOUCH_TOUCH, SVI_SND_TOUCH_TOUCH1); //Play sound and vibration
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot play sound or vibration.\n");
 *	}
 *
 *	r = svi_fini(handle); //Finalize SVI
 *	if (r != SVI_SUCCESS) {
 *		printf("Cannot close SVI.\n");
 *	}
 * }
 *
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_play(int handle, vibration_type vibration_key, sound_type sound_key);

/**
 * \par Description:
 * Set filepath for sound & vibration pattern.\n
 *
 * \par Purpose:
 * This API is used for setting filepath of sound & vibration pattern.
 *
 * \par Typical use case:
 * In case that user want to set filepath of sound or vibration pattern.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library and device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param svi_type 	[in]	svi_type(sound, vibration).
 * \param svi_enum	[in]	predefined enum_type.
 * \param path		[in]    file path.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- \n
 * - SVI_ERROR	- \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * None
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * char *path[512] = "/mnt/ums/sound/sound.wav";
 *
 * r = svi_set_path(SVI_SND_TYPE, SVI_SND_TOUCH_TOUCH1, path);
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Fail.\n");
 * }
 * ...
 * \endcode
 */
/*================================================================================================*/
int svi_set_path(int svi_type, int svi_enum, char* path);

/**
 * \par Description:
 * Get filepath for sound & vibration pattern.\n
 *
 * \par Purpose:
 * This API is used for getting filepath of sound & vibration pattern.
 *
 * \par Typical use case:
 * In case that user want to get filepath of sound or vibration pattern.
 *
 * \par Method of function operation:
 * SVI uses multimedia sound library and device manager library.
 *
 * \par Important notes:
 * None
 *
 * \param svi_type 	[in]	svi_type(sound, vibration).
 * \param svi_enum	[in]	predefined enum_type.
 * \param buf			[out] allocated buffer.
 * \param bufLen		[out] allocated buffer size.
 *
 * \return Return Type (int) \n
 * - SVI_SUCCESS	- \n
 * - SVI_ERROR	- \n
 *
 * \par Prospective clients:
 * External Apps.
 *
 * \par Related functions:
 * None
 *
 * \par Known issues/bugs:
 * None
 *
 * \pre
 * None
 *
 * \post
 * None
 *
 * \see
 * None
 *
 * \remarks
 * None
 *
 * \par Sample code:
 * \code
 * ...
 * #include <svi.h>
 * ...
 * int r = 0;
 * char buf[512] = {0,};
 *
 * r = svi_get_path(SVI_SND_TYPE, SVI_SND_TOUCH_TOUCH1, buf, sizeof(buf));
 *
 * if ( r != SVI_SUCCESS ) {
 *	printf("Fail.\n");
 * }
 * ...
 * \endcode
 */
/*================================================================================================*/

int svi_get_path(int svi_type, int svi_enum, char* buf, unsigned int bufLen);

#ifdef __cplusplus
}
#endif

/**
 * @} @}
 */

#endif //__SVI_H__