PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <uORBFastRpcChannel.hpp>
Classes | |
struct | BulkTransferHeader |
struct | FastRpcControlMsg |
struct | FastRpcDataMsg |
class | Mutex |
class | Semaphore |
Public Member Functions | |
virtual int16_t | topic_advertised (const char *messageName) |
Interface to notify the remote entity of a topic being advertised. More... | |
virtual int16_t | topic_unadvertised (const char *messageName) |
Interface to notify the remote entity of a topic being unadvertised and is no longer publishing messages. More... | |
virtual int16_t | add_subscription (const char *messageName, int32_t msgRateInHz) |
Interface to notify the remote entity of interest of a subscription for a message. More... | |
virtual int16_t | remove_subscription (const char *messageName) |
Interface to notify the remote entity of removal of a subscription. More... | |
virtual int16_t | register_handler (uORBCommunicator::IChannelRxHandler *handler) |
Register Message Handler. More... | |
virtual int16_t | send_message (const char *messageName, int32_t length, uint8_t *data) |
Sends the data message over the communication link. More... | |
int16_t | get_data (int32_t *msg_type, char *topic_name, int32_t topic_name_len, uint8_t *data, int32_t data_len_in_bytes, int32_t *bytes_returned) |
int16_t | get_bulk_data (uint8_t *buffer, int32_t max_size_in_bytes, int32_t *returned_bytes, int32_t *topic_count) |
int16_t | is_subscriber_present (const char *messageName, int32_t *status) |
int16_t | unblock_get_data_method () |
uORBCommunicator::IChannelRxHandler * | GetRxHandler () |
void | AddRemoteSubscriber (const std::string &messageName) |
void | RemoveRemoteSubscriber (const std::string &messageName) |
Static Public Member Functions | |
static uORB::FastRpcChannel * | GetInstance () |
static method to get the IChannel Implementor. More... | |
Private Member Functions | |
FastRpcChannel () | |
constructor. More... | |
void | check_and_expand_data_buffer (int32_t index, int32_t length) |
bool | IsControlQFull () |
bool | IsControlQEmpty () |
bool | IsDataQFull () |
bool | IsDataQEmpty () |
int32_t | DataQSize () |
int32_t | ControlQSize () |
int32_t | get_msg_size_at (bool isData, int32_t index) |
int32_t | copy_msg_to_buffer (bool isData, int32_t src_index, uint8_t *dst_buffer, int32_t offset, int32_t dst_buffer_len) |
int16_t | control_msg_queue_add (int32_t msgtype, const char *messageName) |
Private Attributes | |
uORBCommunicator::IChannelRxHandler * | _RxHandler |
struct FastRpcDataMsg | _DataMsgQueue [_MAX_MSG_QUEUE_SIZE] |
int32_t | _DataQInIndex |
int32_t | _DataQOutIndex |
struct FastRpcControlMsg | _ControlMsgQueue [_MAX_MSG_QUEUE_SIZE] |
int32_t | _ControlQInIndex |
int32_t | _ControlQOutIndex |
std::list< std::string > | _Subscribers |
Mutex | _QueueMutex |
Semaphore | _DataAvailableSemaphore |
std::set< std::string > | _RemoteSubscribers |
Static Private Attributes | |
static uORB::FastRpcChannel | _Instance |
static const int32_t | _MAX_MSG_QUEUE_SIZE = 100 |
data structure to store the messages to be retrived by Krait. More... | |
static const int32_t | _CONTROL_MSG_TYPE_ADD_SUBSCRIBER = 1 |
static const int32_t | _CONTROL_MSG_TYPE_REMOVE_SUBSCRIBER = 2 |
static const int32_t | _DATA_MSG_TYPE = 3 |
static const int32_t | _CONTROL_MSG_TYPE_ADVERTISE = 4 |
static const int32_t | _CONTROL_MSG_TYPE_UNADVERTISE = 5 |
static const int32_t | _PACKET_FIELD_TOPIC_NAME_LEN_SIZE_IN_BYTES = 2 |
static const int32_t | _PACKET_FIELD_DATA_LEN_IN_BYTES = 2 |
static const int32_t | _PACKET_HEADER_SIZE |
Definition at line 49 of file uORBFastRpcChannel.hpp.
|
private |
constructor.
Definition at line 56 of file uORBFastRpcChannel.cpp.
References uORB::FastRpcChannel::FastRpcDataMsg::_Buffer, _DataMsgQueue, uORB::FastRpcChannel::FastRpcDataMsg::_Length, _MAX_MSG_QUEUE_SIZE, uORB::FastRpcChannel::FastRpcDataMsg::_MaxBufferSize, _RemoteSubscribers, and param_value_u::i.
|
virtual |
Interface to notify the remote entity of interest of a subscription for a message.
messageName | This represents the uORB message name; This message name should be globally unique. |
msgRate | The max rate at which the subscriber can accept the messages. |
Implements uORBCommunicator::IChannel.
Definition at line 149 of file uORBFastRpcChannel.cpp.
References _Subscribers.
Referenced by GetInstance().
|
inline |
Definition at line 167 of file uORBFastRpcChannel.hpp.
References _RemoteSubscribers.
Referenced by px4muorb_add_subscriber().
|
private |
Definition at line 284 of file uORBFastRpcChannel.cpp.
References uORB::FastRpcChannel::FastRpcDataMsg::_Buffer, _DataMsgQueue, and uORB::FastRpcChannel::FastRpcDataMsg::_MaxBufferSize.
Referenced by send_message().
|
private |
Definition at line 88 of file uORBFastRpcChannel.cpp.
References _avg_q, _ControlMsgQueue, _ControlQInIndex, _ControlQOutIndex, _count, _DataAvailableSemaphore, _dropped_pkts, _MAX_MSG_QUEUE_SIZE, _max_q, _min_q, uORB::FastRpcChannel::FastRpcControlMsg::_MsgName, _QueueMutex, uORB::FastRpcChannel::FastRpcControlMsg::_Type, ControlQSize(), DataQSize(), hrt_absolute_time(), hrt_abstime, IsControlQFull(), uORB::FastRpcChannel::Mutex::lock(), uORB::FastRpcChannel::Semaphore::post(), t1, t2, and uORB::FastRpcChannel::Mutex::unlock().
Referenced by topic_advertised(), and topic_unadvertised().
|
private |
Definition at line 312 of file uORBFastRpcChannel.cpp.
References _ControlQInIndex, _ControlQOutIndex, and _MAX_MSG_QUEUE_SIZE.
Referenced by control_msg_queue_add(), get_bulk_data(), get_data(), IsControlQEmpty(), IsControlQFull(), and send_message().
|
private |
Definition at line 636 of file uORBFastRpcChannel.cpp.
References _ControlMsgQueue, _DATA_MSG_TYPE, _DataMsgQueue, uORB::FastRpcChannel::FastRpcDataMsg::_Length, uORB::FastRpcChannel::FastRpcDataMsg::_MsgName, uORB::FastRpcChannel::FastRpcControlMsg::_MsgName, and uORB::FastRpcChannel::FastRpcControlMsg::_Type.
Referenced by get_bulk_data().
|
private |
Definition at line 304 of file uORBFastRpcChannel.cpp.
References _DataQInIndex, _DataQOutIndex, and _MAX_MSG_QUEUE_SIZE.
Referenced by control_msg_queue_add(), get_bulk_data(), get_data(), IsDataQEmpty(), IsDataQFull(), and send_message().
int16_t uORB::FastRpcChannel::get_bulk_data | ( | uint8_t * | buffer, |
int32_t | max_size_in_bytes, | ||
int32_t * | returned_bytes, | ||
int32_t * | topic_count | ||
) |
Definition at line 460 of file uORBFastRpcChannel.cpp.
References _bulk_topic_count_max, _bulk_topic_count_min, _ControlQOutIndex, _DataAvailableSemaphore, _DataQOutIndex, _get_bulk_max, _get_bulk_min, _MAX_MSG_QUEUE_SIZE, _QueueMutex, ControlQSize(), copy_msg_to_buffer(), DataQSize(), get_msg_size_at(), hrt_absolute_time(), hrt_abstime, uORB::FastRpcChannel::Mutex::lock(), t1, t3, uORB::FastRpcChannel::Mutex::unlock(), and uORB::FastRpcChannel::Semaphore::wait().
Referenced by get_data(), GetInstance(), and px4muorb_receive_bulk_data().
int16_t uORB::FastRpcChannel::get_data | ( | int32_t * | msg_type, |
char * | topic_name, | ||
int32_t | topic_name_len, | ||
uint8_t * | data, | ||
int32_t | data_len_in_bytes, | ||
int32_t * | bytes_returned | ||
) |
Definition at line 341 of file uORBFastRpcChannel.cpp.
References _ControlMsgQueue, _ControlQOutIndex, _DATA_MSG_TYPE, _DataAvailableSemaphore, _DataMsgQueue, _DataQOutIndex, _get_max, _get_min, _MAX_MSG_QUEUE_SIZE, uORB::FastRpcChannel::FastRpcDataMsg::_MsgName, uORB::FastRpcChannel::FastRpcControlMsg::_MsgName, _QueueMutex, uORB::FastRpcChannel::FastRpcControlMsg::_Type, ControlQSize(), DataQSize(), get_bulk_data(), hrt_absolute_time(), hrt_abstime, uORB::FastRpcChannel::Mutex::lock(), t1, t3, uORB::FastRpcChannel::Mutex::unlock(), and uORB::FastRpcChannel::Semaphore::wait().
Referenced by GetInstance(), IsDataQEmpty(), and px4muorb_receive_msg().
|
private |
Definition at line 618 of file uORBFastRpcChannel.cpp.
References _ControlMsgQueue, _DataMsgQueue, uORB::FastRpcChannel::FastRpcDataMsg::_Length, uORB::FastRpcChannel::FastRpcDataMsg::_MsgName, uORB::FastRpcChannel::FastRpcControlMsg::_MsgName, and _PACKET_HEADER_SIZE.
Referenced by get_bulk_data().
|
inlinestatic |
static method to get the IChannel Implementor.
Definition at line 55 of file uORBFastRpcChannel.hpp.
References _Instance, add_subscription(), data, get_bulk_data(), get_data(), is_subscriber_present(), register_handler(), remove_subscription(), send_message(), status, topic_advertised(), topic_unadvertised(), and unblock_get_data_method().
Referenced by px4muorb_add_subscriber(), px4muorb_is_subscriber_present(), px4muorb_orb_initialize(), px4muorb_receive_bulk_data(), px4muorb_receive_msg(), px4muorb_remove_subscriber(), px4muorb_send_topic_data(), px4muorb_topic_advertised(), px4muorb_topic_unadvertised(), and px4muorb_unblock_recieve_msg().
|
inline |
Definition at line 162 of file uORBFastRpcChannel.hpp.
References _RxHandler.
Referenced by px4muorb_add_subscriber(), px4muorb_remove_subscriber(), px4muorb_send_topic_data(), px4muorb_topic_advertised(), and px4muorb_topic_unadvertised().
int16_t uORB::FastRpcChannel::is_subscriber_present | ( | const char * | messageName, |
int32_t * | status | ||
) |
Definition at line 167 of file uORBFastRpcChannel.cpp.
References _Subscribers, and param_value_u::i.
Referenced by GetInstance(), and px4muorb_is_subscriber_present().
|
private |
Definition at line 325 of file uORBFastRpcChannel.cpp.
References ControlQSize().
|
private |
Definition at line 320 of file uORBFastRpcChannel.cpp.
References _MAX_MSG_QUEUE_SIZE, and ControlQSize().
Referenced by control_msg_queue_add().
|
private |
Definition at line 335 of file uORBFastRpcChannel.cpp.
References DataQSize(), and get_data().
|
private |
Definition at line 330 of file uORBFastRpcChannel.cpp.
References _MAX_MSG_QUEUE_SIZE, and DataQSize().
Referenced by send_message().
|
virtual |
Register Message Handler.
This is internal for the IChannel implementer*
Implements uORBCommunicator::IChannel.
Definition at line 200 of file uORBFastRpcChannel.cpp.
References _RxHandler.
Referenced by GetInstance().
|
virtual |
Interface to notify the remote entity of removal of a subscription.
messageName | This represents the uORB message name; This message name should be globally unique. |
Implements uORBCommunicator::IChannel.
Definition at line 159 of file uORBFastRpcChannel.cpp.
References _Subscribers.
Referenced by GetInstance().
|
inline |
Definition at line 171 of file uORBFastRpcChannel.hpp.
References _RemoteSubscribers.
Referenced by px4muorb_add_subscriber(), and px4muorb_remove_subscriber().
|
virtual |
Sends the data message over the communication link.
messageName | This represents the uORB message name; This message name should be globally unique. |
length | The length of the data buffer to be sent. |
data | The actual data to be sent. |
Implements uORBCommunicator::IChannel.
Definition at line 209 of file uORBFastRpcChannel.cpp.
References _avg_q, _count, _DataAvailableSemaphore, _DataMsgQueue, _DataQInIndex, _DataQOutIndex, _dropped_pkts, uORB::FastRpcChannel::FastRpcDataMsg::_Length, _MAX_MSG_QUEUE_SIZE, _max_q, _min_q, uORB::FastRpcChannel::FastRpcDataMsg::_MsgName, _QueueMutex, _RemoteSubscribers, check_and_expand_data_buffer(), ControlQSize(), DataQSize(), hrt_absolute_time(), hrt_abstime, IsDataQFull(), uORB::FastRpcChannel::Mutex::lock(), uORB::FastRpcChannel::Semaphore::post(), t1, t2, and uORB::FastRpcChannel::Mutex::unlock().
Referenced by GetInstance().
|
virtual |
Interface to notify the remote entity of a topic being advertised.
messageName | This represents the uORB message name(aka topic); This message name should be globally unique. |
Implements uORBCommunicator::IChannel.
Definition at line 74 of file uORBFastRpcChannel.cpp.
References _CONTROL_MSG_TYPE_ADVERTISE, and control_msg_queue_add().
Referenced by GetInstance().
|
virtual |
Interface to notify the remote entity of a topic being unadvertised and is no longer publishing messages.
messageName | This represents the uORB message name(aka topic); This message name should be globally unique. |
Definition at line 81 of file uORBFastRpcChannel.cpp.
References _CONTROL_MSG_TYPE_UNADVERTISE, and control_msg_queue_add().
Referenced by GetInstance().
int16_t uORB::FastRpcChannel::unblock_get_data_method | ( | ) |
Definition at line 192 of file uORBFastRpcChannel.cpp.
References _DataAvailableSemaphore, and uORB::FastRpcChannel::Semaphore::post().
Referenced by GetInstance(), and px4muorb_unblock_recieve_msg().
|
staticprivate |
Definition at line 182 of file uORBFastRpcChannel.hpp.
|
staticprivate |
Definition at line 185 of file uORBFastRpcChannel.hpp.
Referenced by topic_advertised().
|
staticprivate |
Definition at line 183 of file uORBFastRpcChannel.hpp.
|
staticprivate |
Definition at line 186 of file uORBFastRpcChannel.hpp.
Referenced by topic_unadvertised().
|
private |
Definition at line 216 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), copy_msg_to_buffer(), get_data(), and get_msg_size_at().
|
private |
Definition at line 217 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), and ControlQSize().
|
private |
Definition at line 218 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), ControlQSize(), get_bulk_data(), and get_data().
|
staticprivate |
Definition at line 184 of file uORBFastRpcChannel.hpp.
Referenced by copy_msg_to_buffer(), and get_data().
|
private |
Definition at line 279 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), get_bulk_data(), get_data(), send_message(), and unblock_get_data_method().
|
private |
Definition at line 212 of file uORBFastRpcChannel.hpp.
Referenced by check_and_expand_data_buffer(), copy_msg_to_buffer(), FastRpcChannel(), get_data(), get_msg_size_at(), and send_message().
|
private |
Definition at line 213 of file uORBFastRpcChannel.hpp.
Referenced by DataQSize(), and send_message().
|
private |
Definition at line 214 of file uORBFastRpcChannel.hpp.
Referenced by DataQSize(), get_bulk_data(), get_data(), and send_message().
|
staticprivate |
Definition at line 177 of file uORBFastRpcChannel.hpp.
Referenced by GetInstance().
|
staticprivate |
data structure to store the messages to be retrived by Krait.
Definition at line 181 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), ControlQSize(), DataQSize(), FastRpcChannel(), get_bulk_data(), get_data(), IsControlQFull(), IsDataQFull(), and send_message().
|
staticprivate |
Definition at line 189 of file uORBFastRpcChannel.hpp.
|
staticprivate |
Definition at line 188 of file uORBFastRpcChannel.hpp.
|
staticprivate |
Definition at line 190 of file uORBFastRpcChannel.hpp.
Referenced by get_msg_size_at().
|
private |
Definition at line 278 of file uORBFastRpcChannel.hpp.
Referenced by control_msg_queue_add(), get_bulk_data(), get_data(), and send_message().
|
private |
Definition at line 298 of file uORBFastRpcChannel.hpp.
Referenced by AddRemoteSubscriber(), FastRpcChannel(), RemoveRemoteSubscriber(), and send_message().
|
private |
Definition at line 178 of file uORBFastRpcChannel.hpp.
Referenced by GetRxHandler(), and register_handler().
|
private |
Definition at line 220 of file uORBFastRpcChannel.hpp.
Referenced by add_subscription(), is_subscriber_present(), and remove_subscription().