]> rtime.felk.cvut.cz Git - mirosot.git/blob - testapp/cmd_bth.c
An unsucesfull attempt to clean bluetooth library and make it working.
[mirosot.git] / testapp / cmd_bth.c
1 #include <cmd_proc.h>
2 #include <cmd_bth.h>
3 #include <string.h>
4
5 cmd_io_t cmd_io_bth;
6
7
8 int cmd_bth_processor_run(void)
9 {
10   int val;
11   cmd_io_t* cmd_io;
12
13   cmd_io=&cmd_io_bth;
14   if(cmd_bth_line_out(cmd_io))
15     return 1;
16
17   if(cmd_bth_line_in(cmd_io)<=0)
18     return 0;
19
20   if(cmd_bth){
21     val=proc_cmd_line(cmd_io, cmd_bth, cmd_io->priv.ed_line.in->buf);
22   }else{
23     val=-CMDERR_BADCMD;
24   }
25
26   if(cmd_io->priv.ed_line.out->inbuf){
27     cmd_io_putc(cmd_io,'\r');
28     cmd_io_putc(cmd_io,'\n');
29
30   }else if(val<0){
31     char s[20];
32     cmd_io_write(&cmd_io_bth,"ERROR ",6);
33     i2str(s,-val,0,0);
34     cmd_io_write(cmd_io,s,strlen(s));
35     cmd_io_putc(cmd_io,'\r');
36     cmd_io_putc(cmd_io,'\n');
37   }
38   return 1;
39 }
40
41