Loading...
Searching...
No Matches
lcm.h
#ifndef __lightweight_communications_h__
#define __lightweight_communications_h__
#include <stdint.h>
#include "lcm_version.h"
#ifdef LCM_PYTHON
#define LCM_EXPORT
#else
#include "lcm_export.h"
#endif
#include "eventlog.h"
#define LCM_MAX_MESSAGE_SIZE (1 << 28)
#define LCM_MAX_CHANNEL_NAME_LENGTH 63
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _lcm_t lcm_t;
typedef struct _lcm_subscription_t lcm_subscription_t;
typedef struct _lcm_recv_buf_t lcm_recv_buf_t;
struct _lcm_recv_buf_t {
void *data;
uint32_t data_size;
int64_t recv_utime;
lcm_t *lcm;
};
typedef void (*lcm_msg_handler_t)(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data);
LCM_EXPORT
lcm_t *lcm_create(const char *provider);
LCM_EXPORT
void lcm_destroy(lcm_t *lcm);
LCM_EXPORT
int lcm_get_fileno(lcm_t *lcm);
LCM_EXPORT
lcm_subscription_t *lcm_subscribe(lcm_t *lcm, const char *channel, lcm_msg_handler_t handler,
void *userdata);
LCM_EXPORT
int lcm_unsubscribe(lcm_t *lcm, lcm_subscription_t *handler);
LCM_EXPORT
int lcm_publish(lcm_t *lcm, const char *channel, const void *data, unsigned int datalen);
LCM_EXPORT
int lcm_handle(lcm_t *lcm);
LCM_EXPORT
int lcm_handle_timeout(lcm_t *lcm, int timeout_millis);
LCM_EXPORT
int lcm_subscription_set_queue_capacity(lcm_subscription_t *handler, int num_messages);
LCM_EXPORT
int lcm_subscription_get_queue_size(lcm_subscription_t *handler);
#ifdef __cplusplus
}
#endif
#endif
lcm_create
lcm_t * lcm_create(const char *provider)
Constructor.
lcm_subscription_get_queue_size
int lcm_subscription_get_queue_size(lcm_subscription_t *handler)
Query the current number of unhandled messages queued up for a subscription.
lcm_msg_handler_t
void(* lcm_msg_handler_t)(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data)
Callback function prototype.
Definition lcm.h:91
lcm_subscription_t
struct _lcm_subscription_t lcm_subscription_t
Definition lcm.h:55
lcm_subscribe
lcm_subscription_t * lcm_subscribe(lcm_t *lcm, const char *channel, lcm_msg_handler_t handler, void *userdata)
Subscribe a callback function to a channel, without automatic message decoding.
lcm_handle_timeout
int lcm_handle_timeout(lcm_t *lcm, int timeout_millis)
Wait for and dispatch the next incoming message, up to a time limit.
lcm_destroy
void lcm_destroy(lcm_t *lcm)
Destructor.
lcm_get_fileno
int lcm_get_fileno(lcm_t *lcm)
Returns a file descriptor or socket that can be used with select(), poll(), or other event loops for ...
lcm_subscription_set_queue_capacity
int lcm_subscription_set_queue_capacity(lcm_subscription_t *handler, int num_messages)
Adjusts the maximum number of received messages that can be queued up for a subscription.
lcm_unsubscribe
int lcm_unsubscribe(lcm_t *lcm, lcm_subscription_t *handler)
Unsubscribe a message handler.
lcm_handle
int lcm_handle(lcm_t *lcm)
Wait for and dispatch the next incoming message.
lcm_t
struct _lcm_t lcm_t
Definition lcm.h:50
lcm_publish
int lcm_publish(lcm_t *lcm, const char *channel, const void *data, unsigned int datalen)
Publish a message, specified as a raw byte buffer.
_lcm_recv_buf_t
Definition lcm.h:62
_lcm_recv_buf_t::recv_utime
int64_t recv_utime
Definition lcm.h:75
_lcm_recv_buf_t::lcm
lcm_t * lcm
Definition lcm.h:79
_lcm_recv_buf_t::data_size
uint32_t data_size
Definition lcm.h:70
_lcm_recv_buf_t::data
void * data
Definition lcm.h:66