LCM
Loading...
Searching...
No Matches
lcm.h
1#ifndef __lightweight_communications_h__
2#define __lightweight_communications_h__
3
4#include <stdint.h>
5
6#include "lcm_c_namespace.h"
7#include "lcm_version.h"
8
9#ifdef LCM_PYTHON
10#define LCM_EXPORT
11#else
12#include "lcm_export.h"
13#endif
14
15#include "eventlog.h"
16
17#define LCM_MAX_MESSAGE_SIZE (1 << 28)
18
19#define LCM_MAX_CHANNEL_NAME_LENGTH 63
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define lcm_create LCM_C_NAMESPACED(create)
26#define lcm_destroy LCM_C_NAMESPACED(destroy)
27#define lcm_get_fileno LCM_C_NAMESPACED(get_fileno)
28#define lcm_subscribe LCM_C_NAMESPACED(subscribe)
29#define lcm_unsubscribe LCM_C_NAMESPACED(unsubscribe)
30#define lcm_publish LCM_C_NAMESPACED(publish)
31#define lcm_handle LCM_C_NAMESPACED(handle)
32#define lcm_handle_timeout LCM_C_NAMESPACED(handle_timeout)
33#define lcm_subscription_set_queue_capacity LCM_C_NAMESPACED(subscription_set_queue_capacity)
34#define lcm_subscription_get_queue_size LCM_C_NAMESPACED(subscription_get_queue_size)
35
62typedef struct _lcm_t lcm_t;
63
67typedef struct _lcm_subscription_t lcm_subscription_t;
68
73typedef struct _lcm_recv_buf_t lcm_recv_buf_t;
78 void *data;
82 uint32_t data_size;
87 int64_t recv_utime;
92};
93
103typedef void (*lcm_msg_handler_t)(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data);
104
202LCM_EXPORT
203lcm_t *lcm_create(const char *provider);
204
208LCM_EXPORT
209void lcm_destroy(lcm_t *lcm);
210
224LCM_EXPORT
225int lcm_get_fileno(lcm_t *lcm);
226
252LCM_EXPORT
253lcm_subscription_t *lcm_subscribe(lcm_t *lcm, const char *channel, lcm_msg_handler_t handler,
254 void *userdata);
255
271LCM_EXPORT
272int lcm_unsubscribe(lcm_t *lcm, lcm_subscription_t *handler);
273
289LCM_EXPORT
290int lcm_publish(lcm_t *lcm, const char *channel, const void *data, unsigned int datalen);
291
310LCM_EXPORT
311int lcm_handle(lcm_t *lcm);
312
334LCM_EXPORT
335int lcm_handle_timeout(lcm_t *lcm, int timeout_millis);
336
355LCM_EXPORT
356int lcm_subscription_set_queue_capacity(lcm_subscription_t *handler, int num_messages);
357
361LCM_EXPORT
362int lcm_subscription_get_queue_size(lcm_subscription_t *handler);
363
368#ifdef __cplusplus
369}
370#endif
371
372#endif
void(* lcm_msg_handler_t)(const lcm_recv_buf_t *rbuf, const char *channel, void *user_data)
Callback function prototype.
Definition lcm.h:103
struct _lcm_subscription_t lcm_subscription_t
Definition lcm.h:67
struct _lcm_t lcm_t
Definition lcm.h:62
Definition lcm.h:74
int64_t recv_utime
Definition lcm.h:87
lcm_t * lcm
Definition lcm.h:91
uint32_t data_size
Definition lcm.h:82
void * data
Definition lcm.h:78