Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

playercclient.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000-2003
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  *  Player - One Hell of a Robot Server
00025  *  Copyright (C) 2003
00026  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00027  *                      
00028  *
00029  *  This library is free software; you can redistribute it and/or
00030  *  modify it under the terms of the GNU Lesser General Public
00031  *  License as published by the Free Software Foundation; either
00032  *  version 2.1 of the License, or (at your option) any later version.
00033  *
00034  *  This library is distributed in the hope that it will be useful,
00035  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00036  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00037  *  Lesser General Public License for more details.
00038  *
00039  *  You should have received a copy of the GNU Lesser General Public
00040  *  License along with this library; if not, write to the Free Software
00041  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00042  */
00043 
00044 /*
00045  * $Id: playercclient.h,v 1.25 2005/01/26 18:48:28 gerkey Exp $
00046  *
00047  * a pure C client
00048  */
00049 
00069 #ifndef PLAYERCCLIENT_H
00070 #define PLAYERCCLIENT_H
00071 
00072 #ifdef __cplusplus
00073 extern "C" {
00074 #endif
00075 
00076 
00077 #include <player.h>
00078 #include <netinet/in.h> /* for struct in_addr */
00079 
00089 typedef struct player_connection
00090 {
00091   /* the socket we will talk on */
00092   int sock;
00093   /* transport that we'll use (either PLAYER_TRANSPORT_TCP or
00094    * PLAYER_TRANSPORT_UDP) */
00095   int protocol;
00096   /* our server-supplied unique id; it gets inserted into the first two
00097    * bytes of the reserved field on all messages sent in UDP mode */
00098   uint16_t id;
00099   /* the server's address */
00100   struct sockaddr_in server_addr;
00101   /* the banner given back by the server after connection */
00102   char banner[PLAYER_IDENT_STRLEN];
00103 } player_connection_t;
00104 
00105 #define PLAYER_CCLIENT_DEBUG_LEVEL_DEFAULT 5
00106 
00112 int player_debug_level(int level);
00113 
00123 int player_connect(player_connection_t* conn, 
00124                    const char* host, 
00125                    const int port);
00126 
00127 int player_connect_host(player_connection_t* conn, 
00128                         const char* host, 
00129                         const int port);
00130 
00141 int player_connect_ip(player_connection_t* conn, 
00142                       const struct in_addr* addr, 
00143                       const int port);
00154 int player_connect_sockaddr(player_connection_t* conn, 
00155                             const struct sockaddr_in* server);
00165 int player_disconnect(player_connection_t* conn);
00166 
00177 int player_request(player_connection_t* conn, 
00178                    uint16_t device, uint16_t device_index, 
00179                    const char* payload, size_t payloadlen, 
00180                    player_msghdr_t* replyhdr, char* reply, size_t replylen);
00181 
00191 int player_request_device_access(player_connection_t* conn,
00192                                  uint16_t device,
00193                                  uint16_t device_index,
00194                                  uint8_t req_access,
00195                                  uint8_t* grant_access,
00196                                  char* driver_name,
00197                                  int driver_name_len);
00198 
00209 int player_peek(player_connection_t *conn, int timeout);
00210 
00219 int player_read(player_connection_t* conn, player_msghdr_t* hdr,
00220                 char* payload, size_t payloadlen);
00221 
00222 int player_read_tcp(player_connection_t* conn, player_msghdr_t* hdr,
00223                     char* payload, size_t payloadlen);
00224 
00225 int player_read_udp(player_connection_t* conn, player_msghdr_t* hdr,
00226                     char* payload, size_t payloadlen);
00227 
00236 int player_write(player_connection_t* conn, 
00237                  uint16_t device, uint16_t device_index,
00238                  const char* command, size_t commandlen);
00242 #ifdef __cplusplus
00243 }
00244 #endif
00245 
00246 #endif
00247 

Generated on Tue May 3 14:15:35 2005 for Player by doxygen 1.3.6