playersd.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00058 #ifndef _PLAYER_SD_H
00059 #define _PLAYER_SD_H
00060
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064
00065 #include <libplayercore/player.h>
00066
00067 #define PLAYER_SD_SERVICENAME "_player21._tcp"
00068 #define PLAYER_SD_DEVICE_TXTNAME "device"
00069 #define PLAYER_SD_NAME_MAXLEN 256
00070 #define PLAYER_SD_TXT_MAXLEN 256
00071
00073 typedef struct player_sd_dev
00074 {
00075
00076 uint8_t valid;
00077
00078 char name[PLAYER_SD_NAME_MAXLEN];
00079
00080 uint8_t addr_valid;
00081
00082 uint8_t addr_fail;
00083
00084 char hostname[PLAYER_SD_NAME_MAXLEN];
00085 uint32_t robot;
00086 uint16_t interf;
00087 uint16_t index;
00088 } player_sd_dev_t;
00089
00091 typedef struct player_sd
00092 {
00095 void* sdRef;
00097 player_sd_dev_t* devs;
00099 size_t devs_len;
00100 } player_sd_t;
00101
00104 player_sd_t* player_sd_init(void);
00105
00107 void player_sd_fini(player_sd_t* sd);
00108
00110 void player_sd_lock(player_sd_t* sd);
00111
00113 void player_sd_unlock(player_sd_t* sd);
00114
00117 int player_sd_register(player_sd_t* sd,
00118 const char* name,
00119 player_devaddr_t addr);
00120
00123 int player_sd_unregister(player_sd_t* sd,
00124 const char* name);
00125
00128 typedef void (*player_sd_browse_callback_fn_t)(player_sd_t* sd,
00129 player_sd_dev_t* dev);
00130
00143 int player_sd_browse(player_sd_t* sd,
00144 double timeout,
00145 int keepalive,
00146 player_sd_browse_callback_fn_t cb);
00147
00157 int player_sd_update(player_sd_t* sd, double timeout);
00158
00160 int player_sd_browse_stop(player_sd_t* sd);
00161
00163
00164
00167 player_sd_dev_t* player_sd_get_device(player_sd_t* sd, const char* name);
00168
00184 int player_sd_find_devices(player_sd_t* sd,
00185 player_sd_dev_t* result,
00186 size_t result_len,
00187 const char* name,
00188 const char* hostname,
00189 int robot,
00190 int interf,
00191 int index);
00192
00195 player_sd_dev_t* _player_sd_add_device(player_sd_t* sd, const char* name);
00196
00198 void player_sd_printcache(player_sd_t* sd);
00199
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203
00206 #endif
Last updated 12 September 2005 21:38:45
|