21 Commits

Author SHA1 Message Date
Daniel Agar
e63da5860e uORB cleanup Subscription/Publication c++ 2017-08-20 20:42:42 +02:00
Daniel Agar
61fd6f4c8a uorb failure print topic name 2017-07-09 14:40:11 +02:00
Daniel Agar
070cd55636 clang-tidy readability 2017-02-01 22:15:50 -05:00
Daniel Agar
6631e72d6f clang-tidy modernize-redundant-void-arg 2017-02-01 22:15:50 -05:00
Mark Charlebois
f529069368 Fixed code format issues
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2017-01-09 15:41:54 -08:00
Mark Charlebois
830eb8528e fixed merge conflict
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2017-01-09 15:41:54 -08:00
Mark Charlebois
9834155d09 Removed extra debug
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2017-01-09 15:41:54 -08:00
Mark Charlebois
b556528984 Fixed wait_for_topic and orb_exists
orb_exists was not updating the DSP topics on apps proc side

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2017-01-09 15:41:54 -08:00
Mark Charlebois
62a3e07423 orb_exists support for muorb
Also added builtin command wait_for_topic

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2017-01-09 15:41:54 -08:00
Beat Küng
0f2b31b41e uorb: inline orb_advertise (directly calls orb_advertise_multi)
reduces the stack depth
2016-11-06 14:48:20 +01:00
Beat Küng
7280f71cef orb: rm static from DeviceMaster::_node_map & use the non-static getDeviceNode in uORB::Manager
Reasons:
- DeviceMaster::_node_map does not need to be shared among instances,
  because there is at most 1 instance per Flavor and different Flavors
  have non-intersecting device paths.
- Keeping it static would also require a static lock
- DeviceMaster::_node_map was not locked at all when used from
  uORB::Manager

So this fixes two synchronization issues:
- Different DeviceMaster objects could access the same static data in
  parallel
- getDeviceNode() called from uORB::Manager did not use any locking at all
2016-08-06 20:44:23 +02:00
Beat Küng
45a0a7c5ab refactor orb: uORB::Manager is responsible for the DeviceMaster objects
This has the following benefits:
- Manager can ensure that there is at most one instance of DeviceMaster
  per Flavor
- The Manager needs access to (static) data of DeviceMaster already.
  This will make it easier to access this data in a non-static way, and
  does not introduce new dependencies.
2016-08-06 20:44:23 +02:00
Beat Küng
ffcefd9047 orb: read & apply publisher rules from file (currently disabled via #ifdef)
If enabled, orb reads a rules file (./rootfs/orb_publisher.rules) on
startup. This can contain rules about which module is allowed to publish
which topic. It is completely transparent, so a publisher does not know
if he's not allowed to publish, and publications will look as if they
succeeded.

To test, add
#define ORB_USE_PUBLISHER_RULES
to uORBManager.hpp
2016-07-07 12:51:42 +02:00
Julian Oes
6b1bcef644 uORBManager: removed printfs 2016-06-07 22:10:56 +02:00
Beat Küng
e709048fb8 orb: add orb_get_interval to API 2016-06-06 23:27:16 +02:00
Beat Küng
43d734ef43 orb: consistently use unsigned int for queue_size 2016-06-02 07:24:44 +02:00
Beat Küng
5b1273e334 orb: add optional queuing of messages
This adds two uORB API calls:
- orb_advertise_queue
- orb_advertise_multi_queue

Both add a queue_size parameter to define a maximum number of buffered
item. The existing orb calls use all a queue size of one and thus their
behavior is unchanged. If a writer publishes too fast, the oldest elements
from the queue are silently dropped.
The returned timestamp is always the one from the latest message in the
queue.

Queue size can be set via ioctl during advertisement phase. After that it
cannot be changed anymore.
2016-06-02 07:24:44 +02:00
Beat Küng
1a57488ac6 orb: add a separate uORB::Manager::initialize() method
This fixes a race condition: uORB::Manager::get_instance() is used in a
multi-thread context, but the singleton initialization was not thread-safe.
Further, this avoids having to check for nullptr every time the singleton
is accessed.

uORB::Manager::initialize() is called when uorb is started. No one else
accesses the singleton before that point, because it is only used in the
orb_* methods, and in muorb. Both require uorb to be started already when
they are used.
2016-04-29 11:15:15 +02:00
Beat Küng
9da537c092 uorb: add uorb_unadvertise method
This is necessary when using multiple instances of a topic. However it does
not free the underlying resources, as it is assumed they will be used again
at a later point.
2016-04-29 09:31:08 +02:00
Beat Küng
fdc10d212b orb: fix when orb_subscribe_multi is called before orb_advertise_multi
This fixes the previously introduced unit test. It fixes the case where
orb_subscribe_multi is called multiple times with different instances,
and no publisher advertised the topic yet. In this case all subscribers
got the same instance 0.
2016-04-19 11:12:36 +02:00
Beat Küng
934207b518 uORB: merge the files uORBManager_{nuttx,posix}.cpp, largely the same code 2016-04-19 11:12:35 +02:00