Skip to content

Commit

Permalink
Update main_pub.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
MelamudMichael authored Feb 29, 2024
1 parent e540ee5 commit ab295c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pubsub/src/main_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,23 @@ UCode sendMessage(ZenohUTransport *transport,
return UCode::OK;
}

/* The sample pub applications demonstrates how to send data using uTransport -
* There are three topics that are published - random number, current time and a counter */
int main(int argc, char **argv) {

signal(SIGINT, signalHandler);

UStatus status;
ZenohUTransport *transport = &ZenohUTransport::instance();


/* Initialize zenoh utransport */
status = transport->init();
if (UCode::OK != status.code()) {
spdlog::error("ZenohUTransport init failed");
return -1;
}

/* create URI objects from string URI*/
/* Create URI objects from string URI*/
auto timeUri = LongUriSerializer::deserialize(TIME_URI_STRING);
auto randomUri = LongUriSerializer::deserialize(RANDOM_URI_STRING);
auto counterUri = LongUriSerializer::deserialize(COUNTER_URI_STRING);
Expand All @@ -141,6 +144,7 @@ int main(int argc, char **argv) {
sleep(1);
}

/* Terminate zenoh utransport */
status = transport->term();
if (UCode::OK != status.code()) {
spdlog::error("ZenohUTransport term failed");
Expand Down

0 comments on commit ab295c3

Please sign in to comment.