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