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
mros2.h
00001 #ifndef MROS2_MROS2_H 00002 #define MROS2_MROS2_H 00003 00004 #include <string> 00005 #include "rtps/rtps.h" 00006 #ifndef __MBED__ 00007 #include "lwip.h" 00008 #endif /* __MBED__ */ 00009 #include "mros2/logging.h" 00010 00011 /* Statement to avoid link error */ 00012 #ifdef __cplusplus 00013 extern void* __dso_handle; 00014 #endif 00015 00016 namespace mros2 00017 { 00018 00019 void init(int argc, char * argv[]); 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 void mros2_init(void *arg); 00025 #ifdef __cplusplus 00026 } 00027 #endif 00028 00029 class Node; 00030 class Publisher; 00031 class Subscriber; 00032 00033 /* TODO: move to node.h/cpp? */ 00034 class Node 00035 { 00036 public: 00037 static Node create_node( 00038 std::string node_name 00039 ); 00040 00041 template <class T> 00042 Publisher create_publisher( 00043 std::string topic_name, 00044 int qos 00045 ); 00046 00047 template <class T> 00048 Subscriber create_subscription( 00049 std::string topic_name, 00050 int qos, 00051 void (*fp)(T*) 00052 ); 00053 00054 std::string node_name; 00055 rtps::Participant* part; 00056 00057 private: 00058 00059 }; 00060 00061 class Publisher 00062 { 00063 public: 00064 std::string topic_name; 00065 template <class T> 00066 void publish(T& msg); 00067 }; 00068 00069 class Subscriber 00070 { 00071 public: 00072 std::string topic_name; 00073 template <class T> 00074 static void callback_handler( 00075 void* callee, 00076 const rtps::ReaderCacheChange& cacheChange 00077 ); 00078 void (*cb_fp)(intptr_t); 00079 private: 00080 }; 00081 00082 void spin(); 00083 00084 } /* namespace mros2 */ 00085 00086 namespace message_traits 00087 { 00088 template <class T> 00089 struct TypeName { 00090 static const char* value(); 00091 }; 00092 } /* namespace message_traits */ 00093 00094 #endif /* MROS2_MROS2_H */
Generated on Sun Jul 31 2022 04:49:47 by
1.7.2