pub.cpp
Go to the documentation of this file.
00001 
00023 #include <iostream>
00024 #include <vector>
00025 #include "opensplice_dds_comm/check_status.h"
00026 #include "opensplice_dds_comm/publisher.h"
00027 
00028 #define MAX_PACKET_LEN 256
00029 #define NUM_PACKET 1000000
00030 
00031 using namespace DDS;
00032 
00033 int main()
00034 {
00035     opensplice_dds_comm::MSFPPacket packet;
00036     checkHandle(&packet, "new MSFPPacket");
00037     
00038     char buf[MAX_PACKET_LEN];
00039     
00040     std::string test=NULL;
00041 
00042     opensplice_dds_comm::Publisher publisher("micros_swarm_framework_topic");
00043     
00044     for (int i = 1; i <= NUM_PACKET; i++) 
00045     {
00046         packet.packet_source = 1;
00047         packet.packet_version = 0;
00048         packet.packet_type = 0;
00049         snprintf(buf, MAX_PACKET_LEN, "Packet no. %d", i);
00050         packet.packet_data = string_dup(buf);
00051         packet.package_check_sum=0;
00052         std::cout << "Writing packet: \"" << packet.packet_data << "\"" << endl;
00053         publisher.publish(packet);
00054         sleep (1); 
00055     }
00056 
00057     return 0;
00058 }


opensplice_dds_comm
Author(s):
autogenerated on Sat May 27 2017 02:42:59