1 /*
2  * Copyright (C) 2015-2019 Alibaba Group Holding Limited
3  *
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <math.h>
10 
11 #include "k_api.h"
12 #if AOS_COMP_CLI
13 #include "aos/cli.h"
14 #endif
15 
16 #include "uvoice_init.h"
17 #include "uvoice_test.h"
18 
cmd_play_handler(char * buf,int len,int argc,char ** argv)19 static void cmd_play_handler(char *buf, int len, int argc, char **argv)
20 {
21 	return uvoice_play_test(argc, argv);
22 }
23 
cmd_record_handler(char * buf,int len,int argc,char ** argv)24 static void cmd_record_handler(char *buf, int len, int argc, char **argv)
25 {
26 	return uvoice_record_test(argc, argv);
27 }
28 
cmd_tts_handler(char * buf,int len,int argc,char ** argv)29 static void cmd_tts_handler(char *buf, int len, int argc, char **argv)
30 {
31     extern void test_tts_handle(int argc, char **argv);
32     return test_tts_handle(argc, argv);
33 }
34 
35 #if AOS_COMP_CLI
36 struct cli_command uvoicedemo_commands[] = {
37 	{"play", "player test", cmd_play_handler},
38 	{"record", "record test", cmd_record_handler},
39     {"tts", "tts test", cmd_tts_handler}
40 };
41 
uvoice_example(int argc,char ** argv)42 void uvoice_example(int argc, char **argv)
43 {
44     static int uvoice_example_inited = 0;
45 
46     if (uvoice_example_inited == 1) {
47         printf("uvoice example already initialized !\n");
48         return;
49     }
50     uvoice_example_inited = 1;
51 
52 	uvoice_init();
53 
54 	aos_cli_register_commands(uvoicedemo_commands,
55 		sizeof(uvoicedemo_commands) / sizeof(struct cli_command));
56 
57     printf("uvoice example initialization succeeded !\n");
58     return;
59 }
60 
61 /* reg args: fun, cmd, description*/
62 ALIOS_CLI_CMD_REGISTER(uvoice_example, uvoice_example, uvoice test example)
63 #endif
64 
65