Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

hearTest.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <satctl.h>
00003 #include <common.h>
00004 
00005 using namespace std;
00006 
00007 int main() {
00008   int fd;
00009   char *line, *ptr;
00010   char str[80];
00011   char out[80], c;
00012 
00013   line = (char *)malloc(sizeof(char)*80);
00014   ptr = line;
00015   ptr++;
00016   printf("init returned: %d\n", init_serial("/dev/ttyS1", B9600, &fd));
00017   printf("Got fd: %d\n", fd);
00018   say(fd, "ECHO\n");
00019   printf("> ");
00020   while (fgets(line, 79, stdin)) {
00021     if (line[0] >= '0' && line[0] <= '9')
00022       sprintf(&out[0], "%c%s\r\n", line[0] - '0', ptr);
00023     else
00024       strcpy(&out[0], &line[0]);
00025     fflush(stdout);
00026     say(fd, out);
00027     for (int i = 0; out[i]; i++)
00028       printf("%d ", out[i]);
00029     while(!hear(fd, &str[0], 79, 0, 1000000, '\r')) {
00030       printf("\nheard:\n\t%s\n", str);
00031       for (int i = 0; str[i]; i++)
00032         printf("%d ", str[i]);
00033     }
00034     printf("> ");
00035   }
00036 }
00037 
00038 

Generated on Wed Sep 5 12:54:21 2007 for DSACSS Operational Code by  doxygen 1.3.9.1