Firmware
Classes | Macros | Typedefs | Enumerations | Functions | Variables
uORB.h File Reference

API for the uORB lightweight object broker. More...

#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  orb_metadata
 Object metadata. More...
 

Macros

#define ORB_MULTI_MAX_INSTANCES   4
 Maximum number of multi topic instances.
 
#define ORB_ID(_name)   &__orb_##_name
 Generates a pointer to the uORB metadata structure for a given topic. More...
 
#define ORB_DECLARE(_name)   extern const struct orb_metadata __orb_##_name __EXPORT
 Declare (prototype) the uORB metadata for a topic (used by code generators). More...
 
#define ORB_DEFINE(_name, _struct, _size_no_padding, _fields)
 Define (instantiate) the uORB metadata for a topic. More...
 
#define ORB_ID_VEHICLE_ATTITUDE_CONTROLS   ORB_ID(actuator_controls_0)
 

Typedefs

typedef const struct orb_metadataorb_id_t
 
typedef uint8_t arming_state_t
 
typedef uint8_t main_state_t
 
typedef uint8_t hil_state_t
 
typedef uint8_t navigation_state_t
 
typedef uint8_t switch_pos_t
 

Enumerations

enum  ORB_PRIO {
  ORB_PRIO_MIN = 1, ORB_PRIO_VERY_LOW = 25, ORB_PRIO_LOW = 50, ORB_PRIO_DEFAULT = 75,
  ORB_PRIO_HIGH = 100, ORB_PRIO_VERY_HIGH = 125, ORB_PRIO_MAX = 255
}
 Topic priority. More...
 

Functions

orb_advert_t orb_advertise (const struct orb_metadata *meta, const void *data) __EXPORT
 
orb_advert_t orb_advertise_queue (const struct orb_metadata *meta, const void *data, unsigned int queue_size) __EXPORT
 
orb_advert_t orb_advertise_multi (const struct orb_metadata *meta, const void *data, int *instance, int priority) __EXPORT
 
orb_advert_t orb_advertise_multi_queue (const struct orb_metadata *meta, const void *data, int *instance, int priority, unsigned int queue_size) __EXPORT
 
int orb_unadvertise (orb_advert_t handle) __EXPORT
 
int orb_publish (const struct orb_metadata *meta, orb_advert_t handle, const void *data) __EXPORT
 
int orb_subscribe (const struct orb_metadata *meta) __EXPORT
 
int orb_subscribe_multi (const struct orb_metadata *meta, unsigned instance) __EXPORT
 
int orb_unsubscribe (int handle) __EXPORT
 
int orb_copy (const struct orb_metadata *meta, int handle, void *buffer) __EXPORT
 
int orb_check (int handle, bool *updated) __EXPORT
 
int orb_stat (int handle, uint64_t *time) __EXPORT
 
int orb_exists (const struct orb_metadata *meta, int instance) __EXPORT
 
int orb_group_count (const struct orb_metadata *meta) __EXPORT
 Get the number of published instances of a topic group. More...
 
int orb_priority (int handle, int32_t *priority) __EXPORT
 
int orb_set_interval (int handle, unsigned interval) __EXPORT
 
int orb_get_interval (int handle, unsigned *interval) __EXPORT
 

Variables

__BEGIN_DECLS typedef void * orb_advert_t
 ORB topic advertiser handle. More...
 

Detailed Description

API for the uORB lightweight object broker.

Macro Definition Documentation

§ ORB_DECLARE

#define ORB_DECLARE (   _name)    extern const struct orb_metadata __orb_##_name __EXPORT

Declare (prototype) the uORB metadata for a topic (used by code generators).

Parameters
_nameThe name of the topic.

§ ORB_DEFINE

#define ORB_DEFINE (   _name,
  _struct,
  _size_no_padding,
  _fields 
)
Value:
const struct orb_metadata __orb_##_name = { \
#_name, \
sizeof(_struct), \
_size_no_padding, \
_fields \
}; struct hack
Object metadata.
Definition: uORB.h:50

Define (instantiate) the uORB metadata for a topic.

The uORB metadata is used to help ensure that updates and copies are accessing the right data.

Note that there must be no more than one instance of this macro for each topic.

Parameters
_nameThe name of the topic.
_structThe structure the topic provides.
_size_no_paddingStruct size w/o padding at the end
_fieldsAll fields in a semicolon separated list e.g: "float[3] position;bool armed"

§ ORB_ID

#define ORB_ID (   _name)    &__orb_##_name

Generates a pointer to the uORB metadata structure for a given topic.

The topic must have been declared previously in scope with ORB_DECLARE().

Parameters
_nameThe name of the topic.

Enumeration Type Documentation

§ ORB_PRIO

enum ORB_PRIO

Topic priority.

Relevant for multi-topics / topic groups

Function Documentation

§ orb_advertise()

orb_advert_t orb_advertise ( const struct orb_metadata meta,
const void *  data 
)

§ orb_advertise_multi()

orb_advert_t orb_advertise_multi ( const struct orb_metadata meta,
const void *  data,
int *  instance,
int  priority 
)

§ orb_advertise_multi_queue()

orb_advert_t orb_advertise_multi_queue ( const struct orb_metadata meta,
const void *  data,
int *  instance,
int  priority,
unsigned int  queue_size 
)

§ orb_advertise_queue()

orb_advert_t orb_advertise_queue ( const struct orb_metadata meta,
const void *  data,
unsigned int  queue_size 
)

§ orb_check()

int orb_check ( int  handle,
bool *  updated 
)

§ orb_copy()

int orb_copy ( const struct orb_metadata meta,
int  handle,
void *  buffer 
)

§ orb_exists()

int orb_exists ( const struct orb_metadata meta,
int  instance 
)

§ orb_get_interval()

int orb_get_interval ( int  handle,
unsigned *  interval 
)

§ orb_group_count()

int orb_group_count ( const struct orb_metadata meta)

Get the number of published instances of a topic group.

Parameters
metaORB topic metadata.
Returns
The number of published instances of this topic

§ orb_priority()

int orb_priority ( int  handle,
int32_t *  priority 
)

§ orb_publish()

int orb_publish ( const struct orb_metadata meta,
orb_advert_t  handle,
const void *  data 
)

§ orb_set_interval()

int orb_set_interval ( int  handle,
unsigned  interval 
)

§ orb_stat()

int orb_stat ( int  handle,
uint64_t *  time 
)

§ orb_subscribe()

int orb_subscribe ( const struct orb_metadata meta)

§ orb_subscribe_multi()

int orb_subscribe_multi ( const struct orb_metadata meta,
unsigned  instance 
)

§ orb_unadvertise()

int orb_unadvertise ( orb_advert_t  handle)

§ orb_unsubscribe()

int orb_unsubscribe ( int  handle)

Variable Documentation

§ orb_advert_t

__BEGIN_DECLS typedef void* orb_advert_t

ORB topic advertiser handle.

Advertiser handles are global; once obtained they can be shared freely and do not need to be closed or released.

This permits publication from interrupt context and other contexts where a file-descriptor-based handle would not otherwise be in scope for the publisher.