blob: 7dd055fdaa48908e33221225856e36cb401bade3 [file] [log] [blame]
liubin281ac462023-07-19 14:22:54 +08001/**
2 * \file dtmf_test.c
3 * \brief A Documented file.
4 *
5 * Detailed description
6 * \Author: js.wang <js.wang@mobiletek.cn>
7 * \Version: 1.0.0
8 * \Date: 2022-03-31
9 */
10
11/******************************************************************************\
12 * Include files
13\******************************************************************************/
14#include <pthread.h>
15#include <time.h>
16#include <sys/ioctl.h>
17#include <fcntl.h>
18#include <unistd.h>
19#include <sys/types.h>
20#include <sys/stat.h>
21#include <fcntl.h>
22#include <string.h>
23#include <stdio.h>
24#include <signal.h>
25#include <unistd.h>
26#include <fcntl.h>
27#include <errno.h>
28#include <string.h>
29#include <stdlib.h>
30#include <poll.h>
31#include <stdlib.h>
32
33#include <sys/ioctl.h>
34#include <sys/types.h>
35#include <sys/stat.h>
b.liu5fa9e772023-11-23 18:00:55 +080036
liubin281ac462023-07-19 14:22:54 +080037#include "mbtk_audio.h"
38
39void dtmf_cb(char dtmf)
40{
41 printf("%s:%c\n", __FUNCTION__, dtmf);
42}
43
44void audio_volume_cb(int volume)
45{
46 printf("%s:%d\n", __FUNCTION__, volume);
47}
48
49int main(int argc, char *argv[])
50{
51 char operator[10];
52 int opt;
53 mbtk_audio_client_handle_type dtmf_handle;
54
55
56 while(1)
57 {
58 printf("=========audio main=========\n"
59 "\t0 exit\n"
60 "\t1 audio init\n"
61 "\t2 audio get volume\n"
62 "\t3 audio set volume\n"
63 "\t4 audio deinit\n"
64 "operator: >> ");
65 fgets(operator, sizeof(operator), stdin);
66 fflush(stdin);
67 opt = atoi(operator);
68 switch (opt)
69 {
70 case 0:
71 printf("main exit\n");
72 return 0;
73 case 1:
74 mbtk_audio_ubus_client_init(&dtmf_handle, dtmf_cb);
75 break;
76 case 2:
77 mbtk_audio_ubus_volume_get(audio_volume_cb);
78 break;
79 case 3:
80 printf("please input volume (0~100): \n");
81 fgets(operator, sizeof(operator), stdin);
82 fflush(stdin);
83 opt = atoi(operator);
84 mbtk_audio_ubus_volume_set(opt);
85 break;
86 case 4:
87 mbtk_audio_ubus_client_deinit(dtmf_handle);
88 break;
89 default:
90 break;
91 }
92 }
93
94 return 0;
95}
b.liu5fa9e772023-11-23 18:00:55 +080096