pub.cpp
Go to the documentation of this file.
1 
23 #include <iostream>
24 #include <vector>
27 
28 #define MAX_PACKET_LEN 256
29 #define NUM_PACKET 1000000
30 
31 using namespace DDS;
32 
33 int main()
34 {
35  opensplice_dds_comm::MSFPPacket packet;
36  checkHandle(&packet, "new MSFPPacket");
37 
38  char buf[MAX_PACKET_LEN];
39 
40  std::string test=NULL;
41 
42  opensplice_dds_comm::Publisher publisher("micros_swarm_framework_topic");
43 
44  for (int i = 1; i <= NUM_PACKET; i++)
45  {
46  packet.packet_source = 1;
47  packet.packet_version = 0;
48  packet.packet_type = 0;
49  snprintf(buf, MAX_PACKET_LEN, "Packet no. %d", i);
50  packet.packet_data = string_dup(buf);
51  packet.package_check_sum=0;
52  std::cout << "Writing packet: \"" << packet.packet_data << "\"" << endl;
53  publisher.publish(packet);
54  sleep (1);
55  }
56 
57  return 0;
58 }
#define NUM_PACKET
Definition: pub.cpp:29
int main()
Definition: pub.cpp:33
int test(void)
void publish(const GSDFPacket &packet)
Definition: publisher.cpp:109
void checkHandle(void *handle, const char *info)
#define MAX_PACKET_LEN
Definition: pub.cpp:28


opensplice_dds_comm
Author(s):
autogenerated on Thu Jun 1 2017 02:43:49