| /** |
| * \file dtmf_test.c |
| * \brief A Documented file. |
| * |
| * Detailed description |
| * \Author: js.wang <js.wang@mobiletek.cn> |
| * \Version: 1.0.0 |
| * \Date: 2022-03-31 |
| */ |
| |
| /******************************************************************************\ |
| * Include files |
| \******************************************************************************/ |
| #include <pthread.h> |
| #include <time.h> |
| #include <sys/ioctl.h> |
| #include <fcntl.h> |
| #include <unistd.h> |
| #include <sys/types.h> |
| #include <sys/stat.h> |
| #include <fcntl.h> |
| #include <string.h> |
| #include <stdio.h> |
| #include <signal.h> |
| #include <unistd.h> |
| #include <fcntl.h> |
| #include <errno.h> |
| #include <string.h> |
| #include <stdlib.h> |
| #include <poll.h> |
| #include <stdlib.h> |
| |
| #include <sys/ioctl.h> |
| #include <sys/types.h> |
| #include <sys/stat.h> |
| #include "mbtk_audio.h" |
| |
| void dtmf_cb(char dtmf) |
| { |
| printf("%s:%c\n", __FUNCTION__, dtmf); |
| } |
| |
| void audio_volume_cb(int volume) |
| { |
| printf("%s:%d\n", __FUNCTION__, volume); |
| } |
| |
| int main(int argc, char *argv[]) |
| { |
| char operator[10]; |
| int opt; |
| mbtk_audio_client_handle_type dtmf_handle; |
| |
| |
| while(1) |
| { |
| printf("=========audio main=========\n" |
| "\t0 exit\n" |
| "\t1 audio init\n" |
| "\t2 audio get volume\n" |
| "\t3 audio set volume\n" |
| "\t4 audio deinit\n" |
| "operator: >> "); |
| fgets(operator, sizeof(operator), stdin); |
| fflush(stdin); |
| opt = atoi(operator); |
| switch (opt) |
| { |
| case 0: |
| printf("main exit\n"); |
| return 0; |
| case 1: |
| mbtk_audio_ubus_client_init(&dtmf_handle, dtmf_cb); |
| break; |
| case 2: |
| mbtk_audio_ubus_volume_get(audio_volume_cb); |
| break; |
| case 3: |
| printf("please input volume (0~100): \n"); |
| fgets(operator, sizeof(operator), stdin); |
| fflush(stdin); |
| opt = atoi(operator); |
| mbtk_audio_ubus_volume_set(opt); |
| break; |
| case 4: |
| mbtk_audio_ubus_client_deinit(dtmf_handle); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| return 0; |
| } |