Gazebo Transport

API Reference

13.4.0
CIface.h File Reference
#include "gz/transport/Export.hh"

Go to the source code of this file.

Classes

struct  SubscribeOpts
 

Typedefs

typedef struct GzTransportNode GzTransportNode
 A transport node. More...
 
typedef struct SubscribeOpts SubscribeOpts
 

Functions

const auto GZ_DEPRECATED (12) ignTransportNodeCreate = gzTransportNodeDestroy
 
int GZ_TRANSPORT_VISIBLE gzTransportAdvertise (GzTransportNode *_node, const char *_topic, const char *_msgType)
 Advertise a topic. More...
 
GzTransportNode GZ_TRANSPORT_VISIBLE * gzTransportNodeCreate (const char *_partition)
 Create a transport node. More...
 
void GZ_TRANSPORT_VISIBLE gzTransportNodeDestroy (GzTransportNode **_node)
 Destroy a transport node. More...
 
int GZ_TRANSPORT_VISIBLE gzTransportPublish (GzTransportNode *_node, const char *_topic, const void *_data, const char *_msgType)
 Publishes a message on a topic. More...
 
int GZ_TRANSPORT_VISIBLE gzTransportSubscribe (GzTransportNode *_node, const char *_topic, void(*_callback)(const char *, size_t, const char *, void *), void *_userData)
 Subscribe to a topic, and register a callback. More...
 
int GZ_TRANSPORT_VISIBLE gzTransportSubscribeNonConst (GzTransportNode *_node, char *_topic, void(*_callback)(char *, size_t, char *, void *), void *_userData)
 Subscribe to a topic, and register a callback. More...
 
int GZ_TRANSPORT_VISIBLE gzTransportSubscribeOptions (GzTransportNode *_node, const char *_topic, SubscribeOpts _opts, void(*_callback)(const char *, size_t, const char *, void *), void *_userData)
 Subscribe to a topic, and register a callback. More...
 
int GZ_TRANSPORT_VISIBLE gzTransportUnsubscribe (GzTransportNode *_node, const char *_topic)
 Unsubscribe from a topic. More...
 
void GZ_TRANSPORT_VISIBLE gzTransportWaitForShutdown ()
 Block the current thread until a SIGINT or SIGTERM is received. Note that this function registers a signal handler. Do not use this function if you want to manage yourself SIGINT/SIGTERM. More...
 

Typedef Documentation

◆ GzTransportNode

A transport node.

◆ SubscribeOpts

typedef struct SubscribeOpts SubscribeOpts

Function Documentation

◆ GZ_DEPRECATED()

const auto GZ_DEPRECATED ( 12  ) = gzTransportNodeDestroy

◆ gzTransportAdvertise()

int GZ_TRANSPORT_VISIBLE gzTransportAdvertise ( GzTransportNode _node,
const char *  _topic,
const char *  _msgType 
)

Advertise a topic.

Parameters
[in]_nodePointer to a node.
[in]_topicTopic on which to publish the message.
[in]_msgTypeName of the message type.
Returns
0 on success.

◆ gzTransportNodeCreate()

GzTransportNode GZ_TRANSPORT_VISIBLE* gzTransportNodeCreate ( const char *  _partition)

Create a transport node.

Parameters
[in]_partitionOptional name of the partition to use. Use nullptr to use the default value, which is specified via the GZ_PARTITION environment variable.
Returns
A pointer to a new transport node. Do not manually delete this pointer, instead use gzTransportNodeDestroy.

◆ gzTransportNodeDestroy()

void GZ_TRANSPORT_VISIBLE gzTransportNodeDestroy ( GzTransportNode **  _node)

Destroy a transport node.

Parameters
[in,out]_nodeThe transport node to destroy.

◆ gzTransportPublish()

int GZ_TRANSPORT_VISIBLE gzTransportPublish ( GzTransportNode _node,
const char *  _topic,
const void *  _data,
const char *  _msgType 
)

Publishes a message on a topic.

Parameters
[in]_nodePointer to a node.
[in]_topicTopic on which to publish the message.
[in]_dataByte array of serialized data to publish.
[in]_msgTypeName of the message type.
Returns
0 on success.

◆ gzTransportSubscribe()

int GZ_TRANSPORT_VISIBLE gzTransportSubscribe ( GzTransportNode _node,
const char *  _topic,
void(*)(const char *, size_t, const char *, void *)  _callback,
void *  _userData 
)

Subscribe to a topic, and register a callback.

Parameters
[in]_nodePointer to a node.
[in]_topicName of the topic.
[in]_callbackThe function to call when a message is received.
[in]_userDataArbitrary user data pointer.
Returns
0 on success.

◆ gzTransportSubscribeNonConst()

int GZ_TRANSPORT_VISIBLE gzTransportSubscribeNonConst ( GzTransportNode _node,
char *  _topic,
void(*)(char *, size_t, char *, void *)  _callback,
void *  _userData 
)

Subscribe to a topic, and register a callback.

Parameters
[in]_nodePointer to a node.
[in]_topicName of the topic.
[in]_callbackThe function to call when a message is received.
[in]_userDataArbitrary user data pointer.
Returns
0 on success.

◆ gzTransportSubscribeOptions()

int GZ_TRANSPORT_VISIBLE gzTransportSubscribeOptions ( GzTransportNode _node,
const char *  _topic,
SubscribeOpts  _opts,
void(*)(const char *, size_t, const char *, void *)  _callback,
void *  _userData 
)

Subscribe to a topic, and register a callback.

Parameters
[in]_nodePointer to a node.
[in]_topicName of the topic.
[in]_optsSubscriber options.
[in]_callbackThe function to call when a message is received.
[in]_userDataArbitrary user data pointer.
Returns
0 on success.

◆ gzTransportUnsubscribe()

int GZ_TRANSPORT_VISIBLE gzTransportUnsubscribe ( GzTransportNode _node,
const char *  _topic 
)

Unsubscribe from a topic.

Parameters
[in]_nodePointer to a node.
[in]_topicName of the topic.
Returns
0 on success.

◆ gzTransportWaitForShutdown()

void GZ_TRANSPORT_VISIBLE gzTransportWaitForShutdown ( )

Block the current thread until a SIGINT or SIGTERM is received. Note that this function registers a signal handler. Do not use this function if you want to manage yourself SIGINT/SIGTERM.