Firmware
uORBCommunicator.hpp
1 /****************************************************************************
2  *
3  * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 #ifndef _uORBCommunicator_hpp_
35 #define _uORBCommunicator_hpp_
36 
37 #include <stdint.h>
38 
39 
40 namespace uORBCommunicator
41 {
42 class IChannel;
43 class IChannelRxHandler;
44 }
45 
52 {
53 public:
54 
55  //=========================================================================
56  // INTERFACES FOR Control messages over a channel.
57  //=========================================================================
58 
70  virtual int16_t topic_advertised(const char *messageName) = 0;
71 
84  //virtual int16_t topic_unadvertised(const char *messageName) = 0;
85 
101  virtual int16_t add_subscription(const char *messageName, int32_t msgRateInHz) = 0;
102 
103 
104 
117  virtual int16_t remove_subscription(const char *messageName) = 0;
118 
119 
123  virtual int16_t register_handler(uORBCommunicator::IChannelRxHandler *handler) = 0;
124 
125 
126  //=========================================================================
127  // INTERFACES FOR Data messages
128  //=========================================================================
129 
145  virtual int16_t send_message(const char *messageName, int32_t length, uint8_t *data) = 0;
146 
147 };
148 
154 {
155 public:
156 
170  virtual int16_t process_remote_topic(const char *topic_name, bool isAdvertisement) = 0;
171 
185  virtual int16_t process_add_subscription(const char *messageName, int32_t msgRateInHz) = 0;
186 
187 
199  virtual int16_t process_remove_subscription(const char *messageName) = 0;
200 
201 
217  virtual int16_t process_received_message(const char *messageName, int32_t length, uint8_t *data) = 0;
218 
219 };
220 
221 #endif /* _uORBCommunicator_hpp_ */
virtual int16_t topic_advertised(const char *messageName)=0
Interface to notify the remote entity of a topic being advertised.
virtual int16_t send_message(const char *messageName, int32_t length, uint8_t *data)=0
Sends the data message over the communication link.
Interface to enable remote subscriptions.
Definition: uORBCommunicator.hpp:51
virtual int16_t add_subscription(const char *messageName, int32_t msgRateInHz)=0
Interface to notify the remote entity of a topic being unadvertised and is no longer publishing messa...
Class passed to the communication link implement to provide callback for received messages over a cha...
Definition: uORBCommunicator.hpp:153
virtual int16_t register_handler(uORBCommunicator::IChannelRxHandler *handler)=0
Register Message Handler.
Definition: uORBCommunicator.hpp:40
virtual int16_t remove_subscription(const char *messageName)=0
Interface to notify the remote entity of removal of a subscription.