ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VP_SDK / Examples / linux / server.c
1 // ----------------------------------------------
2 //
3 //  Author : <sylvain.gaeremynck\@parrot.fr>
4 //  Date   : 03/01/2007
5 //
6 //  Parrot Video SDK : Examples/
7 //
8 // ----------------------------------------------
9
10 #include <VP_Os/vp_os_print.h>
11 #include <VP_Api/vp_api_error.h>
12 #include <Examples/common/com_server.h>
13
14 int main()
15 {
16   PRINT("Thread Server Start\n");
17
18   if(FAILED(init_com_server()))
19   {
20     PRINT("Failed to init\n");
21     return;
22   }
23
24   if(FAILED(run_com_server(COM_RFCOMM)))
25   {
26     PRINT("Failed to run\n");
27   }
28   else
29   {
30     uint32_t size = 10;
31     char msg[10];
32
33     memset(msg,0,10);
34
35     PRINT("Connection accepted\n");
36
37     if(SUCCEED(read_server(msg,&size)))
38       PRINT("msg: %s\n",msg);
39   }
40
41   if(FAILED(shutdown_com_server()))
42   {
43     PRINT("Failed to shutdown\n");
44   }
45
46   PRINT("Thread Server End\n");
47 }