Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-os-example-mros2 example-mbed-mros2-sub-pose example-mbed-mros2-pub-twist example-mbed-mros2-mturtle-teleop
Diff: include/mros2.h
- Revision:
- 0:580aba13d1a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/mros2.h Thu Dec 30 21:06:29 2021 +0900
@@ -0,0 +1,94 @@
+#ifndef MROS2_MROS2_H
+#define MROS2_MROS2_H
+
+#include <string>
+#include "rtps/rtps.h"
+#ifndef __MBED__
+#include "lwip.h"
+#endif /* __MBED__ */
+#include "mros2/logging.h"
+
+/* Statement to avoid link error */
+#ifdef __cplusplus
+extern void* __dso_handle;
+#endif
+
+namespace mros2
+{
+
+void init(int argc, char * argv[]);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void mros2_init(void *arg);
+#ifdef __cplusplus
+}
+#endif
+
+class Node;
+class Publisher;
+class Subscriber;
+
+/* TODO: move to node.h/cpp? */
+class Node
+{
+public:
+ static Node create_node(
+ std::string node_name
+ );
+
+ template <class T>
+ Publisher create_publisher(
+ std::string topic_name,
+ int qos
+ );
+
+ template <class T>
+ Subscriber create_subscription(
+ std::string topic_name,
+ int qos,
+ void (*fp)(T*)
+ );
+
+ std::string node_name;
+ rtps::Participant* part;
+
+private:
+
+};
+
+class Publisher
+{
+public:
+ std::string topic_name;
+ template <class T>
+ void publish(T& msg);
+};
+
+class Subscriber
+{
+public:
+ std::string topic_name;
+ template <class T>
+ static void callback_handler(
+ void* callee,
+ const rtps::ReaderCacheChange& cacheChange
+ );
+ void (*cb_fp)(intptr_t);
+private:
+};
+
+void spin();
+
+} /* namespace mros2 */
+
+namespace message_traits
+{
+template <class T>
+struct TypeName {
+static const char* value();
+};
+} /* namespace message_traits */
+
+#endif /* MROS2_MROS2_H */