Player
Frontpage
Contents
User
Installation
Quick start
Supported devices
Tutorials
Utilities
Client libraries
FAQ
Help
Developer
Architecture
libplayercore
interfaces
libplayerdrivers
drivers
libplayercommon
libplayerutils
libplayersd
libplayertcp
libplayerxdr
TODO
Online
Homepage
Download
Project
Bugs
Help
libplayersd
playersd.h
1
/*
2
* Player - One Hell of a Robot Server
3
* Copyright (C) 2007
4
* Brian Gerkey
5
*
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*
21
*/
22
/*
23
* Player - One Hell of a Robot Server
24
* Copyright (C) 2007
25
* Brian Gerkey
26
*
27
*
28
* This library is free software; you can redistribute it and/or
29
* modify it under the terms of the GNU Lesser General Public
30
* License as published by the Free Software Foundation; either
31
* version 2.1 of the License, or (at your option) any later version.
32
*
33
* This library is distributed in the hope that it will be useful,
34
* but WITHOUT ANY WARRANTY; without even the implied warranty of
35
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36
* Lesser General Public License for more details.
37
*
38
* You should have received a copy of the GNU Lesser General Public
39
* License along with this library; if not, write to the Free Software
40
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41
*/
42
43
/*
44
* Interface to libplayersd
45
*
46
* $Id: playersd.h 8004 2009-07-13 14:03:44Z thjc $
47
*/
48
58
#ifndef _PLAYER_SD_H
59
#define _PLAYER_SD_H
60
61
#ifdef __cplusplus
62
extern
"C"
{
63
#endif
64
65
#include <libplayerinterface/player.h>
66
67
#define PLAYER_SD_SERVICENAME "_player21._tcp"
68
#define PLAYER_SD_DEVICE_TXTNAME "device"
69
#define PLAYER_SD_NAME_MAXLEN 256
70
#define PLAYER_SD_TXT_MAXLEN 256
71
73
typedef
struct
player_sd_dev
74
{
75
// Is this entry valid?
76
uint8_t valid;
77
// Name of the device
78
char
name[
PLAYER_SD_NAME_MAXLEN
];
79
// Is the address valid?
80
uint8_t addr_valid;
81
// Did address resolution fail?
82
uint8_t addr_fail;
83
// Player address components
84
char
hostname[
PLAYER_SD_NAME_MAXLEN
];
85
uint32_t robot;
86
uint16_t interf;
87
uint16_t index;
88
}
player_sd_dev_t
;
89
91
typedef
struct
player_sd
92
{
95
void
*
sdRef
;
97
player_sd_dev_t
*
devs
;
99
size_t
devs_len
;
100
}
player_sd_t
;
101
104
player_sd_t
*
player_sd_init
(
void
);
105
107
void
player_sd_fini
(
player_sd_t
* sd);
108
110
void
player_sd_lock
(
player_sd_t
* sd);
111
113
void
player_sd_unlock
(
player_sd_t
* sd);
114
117
int
player_sd_register
(
player_sd_t
* sd,
118
const
char
* name,
119
player_devaddr_t
addr);
120
123
int
player_sd_unregister
(
player_sd_t
* sd,
124
const
char
* name);
125
128
typedef
void (*
player_sd_browse_callback_fn_t
)(
player_sd_t
* sd,
129
player_sd_dev_t
* dev);
130
143
int
player_sd_browse
(
player_sd_t
* sd,
144
double
timeout,
145
int
keepalive,
146
player_sd_browse_callback_fn_t
cb);
147
157
int
player_sd_update
(
player_sd_t
* sd,
double
timeout);
158
160
int
player_sd_browse_stop
(
player_sd_t
* sd);
161
163
// Common functions, implemented in playersd.c
164
167
player_sd_dev_t
*
player_sd_get_device
(
player_sd_t
* sd,
const
char
* name);
168
184
int
player_sd_find_devices
(
player_sd_t
* sd,
185
player_sd_dev_t
* result,
186
size_t
result_len,
187
const
char
* name,
188
const
char
* hostname,
189
int
robot,
190
int
interf,
191
int
index);
192
195
player_sd_dev_t
*
_player_sd_add_device
(
player_sd_t
* sd,
const
char
* name);
196
198
void
player_sd_printcache
(
player_sd_t
* sd);
199
200
#ifdef __cplusplus
201
}
202
#endif
203
206
#endif
Last updated 12 September 2005 21:38:45