Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/lcm_to_zcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ allows LCM users to gradually migrate to ZCM.

### Known incompatibilities:
- `zcm_get_fileno()` is not supported
- `zcm_handle_timeout()` is not supported
- `zcm_subscription_set_queue_capacity` is not supported
- LCMType-style enums are not supported
- Language bindings not currently supported:
Expand Down
8 changes: 4 additions & 4 deletions docs/transports.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ By default, this number is 512.

- `int update(zcm_trans_t *zt)`

This method is called from the `zcm_handle_nonblock()` function.
This method is called from the `zcm_handle()` function.
This method provides a periodically-running routine that can perform
updates to the underlying hardware or other general maintenance to
this transport. A transport implementing this function will typically use
this time to flush out any bytes left in its internal buffer. This method
should **never block**. Again, this method is called from
`zcm_handle_nonblock()` and thus runs at the same frequency as
`zcm_handle_nonblock()`. Failure to call `zcm_handle_nonblock()`
`zcm_handle()` and thus runs at the same frequency as
`zcm_handle()`. Failure to call `zcm_handle()`
while using an nonblock transport may cause the transport to work
incorrectly on both message send and recv.

Expand Down Expand Up @@ -354,7 +354,7 @@ For the blocking case, there are the following approaches:

For the non-blocking case, there is a single approach:

- `zcm_handle_nonblock() /* returns non-zero if a message was available and dispatched */`
- `zcm_handle() /* returns non-zero if a message was available and dispatched */`

To prevent errors, the internal library checks that the API method matches the transport type.

Expand Down
2 changes: 1 addition & 1 deletion examples/c/nblock_inproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int main(int argc, char *argv[])
my_data.timestamp = i;
example_t_publish(&zcm, "EXAMPLE", &my_data);
usleep(100000);
zcm_handle_nonblock(&zcm);
zcm_handle(&zcm, 0);
}

free(my_data.ranges);
Expand Down
3 changes: 2 additions & 1 deletion examples/c/pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ int main(int argc, char *argv[])
my_data.name = EXAMPLE_T_test_const_string;
my_data.enabled = 1;

uint64_t sleepUs = 1000000/HZ;
while (1) {
if (example_t_publish(zcm, "EXAMPLE", &my_data) == 0)
++my_data.timestamp;
usleep(1000000/HZ);
if (sleepUs > 0) usleep(sleepUs);
}

zcm_destroy(zcm);
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/Unsub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void dispatchOneMessage(zcm::ZCM& zcm, uint64_t sleepTimeUs)
} else {
uint64_t end = utime() + sleepTimeUs;
while (utime() < end) {
if (zcm.handleNonblock() == ZCM_EOK) break;
if (zcm.handle(0) == ZCM_EOK) break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/transport/SerialTransportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int main(int argc, const char *argv[])
nextPublish = now + PUBLISH_DT;
}

zcmLocal.handleNonblock();
zcmLocal.handle(0);
}

zcmLocal.unsubscribe(sub);
Expand Down
6 changes: 3 additions & 3 deletions examples/julia/nonblock_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ msg = example_t()

msg.timestamp = 0;
publish(zcm, "EXAMPLE", msg)
handle_nonblock(zcm)
handle(zcm, 0)
msg.timestamp = 1;
publish(zcm, "EXAMPLE", msg)
handle_nonblock(zcm)
handle(zcm, 0)
msg.timestamp = 2;
publish(zcm, "EXAMPLE", msg)
handle_nonblock(zcm)
handle(zcm, 0)

unsubscribe(zcm, sub)

Expand Down
4 changes: 2 additions & 2 deletions examples/node-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zcm-example",
"version": "1.2.0",
"version": "2.0.0",
"description": "",
"scripts": {
"//": [
Expand All @@ -14,6 +14,6 @@
"big-integer": "^1.6.27",
"express": "^4.14.0",
"ref-napi": "^3.0.0",
"zerocm": "file:../../build/zcm/js/zerocm-1.2.0.tgz"
"zerocm": "file:../../build/zcm/js/zerocm-2.0.0.tgz"
}
}
4 changes: 2 additions & 2 deletions examples/python/handle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def handler(channel, msg):
msg = example_t()
msg.timestamp = 10

ret = zcm.handleNonblock()
ret = zcm.handle(0)
if ret != zerocm.ZCM_EAGAIN:
print("Failed to return successfully when no message is ready")
sys.exit(1)
Expand All @@ -44,7 +44,7 @@ def handler(channel, msg):
time.sleep(0.5)

# handle incoming message
ret = zcm.handleNonblock()
ret = zcm.handle(0)
if ret != zerocm.ZCM_EOK:
print("Failed to return successfully when a message is ready")
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions gen/version.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _VERSION_H
#define _VERSION_H

#define ZCM_MAJOR_VERSION 1
#define ZCM_MINOR_VERSION 2
#define ZCM_MAJOR_VERSION 2
#define ZCM_MINOR_VERSION 0
#define ZCM_MICRO_VERSION 0

#endif
2 changes: 1 addition & 1 deletion test/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "The Zcm Team",
"license": "LGPL",
"dependencies": {
"zerocm": "file:../../build/zcm/js/zerocm-1.2.0.tgz",
"zerocm": "file:../../build/zcm/js/zerocm-2.0.0.tgz",
"ref-napi": "^3.0.0"
}
}
23 changes: 0 additions & 23 deletions test/zcm/ApiRetcodesTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,29 +172,6 @@ class ApiRetcodesTest : public CxxTest::TestSuite
zcm_cleanup(&zcm);
}

void testPublishMsgdrop(void)
{
zcm_t zcm;
zcm_init(&zcm, "test-pub-blockforever", NULL);
zcm_start(&zcm);

// NOTE: We assume that 100000 publish calls are enought to overflow the send buffer
const int MAX_PUBS = 100000;
for (int i = 0; i < MAX_PUBS; i++) {
uint8_t data = 'a';
int ret = zcm_publish(&zcm, "CHANNEL", &data, 1);
if (ret == ZCM_EAGAIN) {
goto done;
}
}

TS_FAIL("Failed to get an error return code from zcm_publish()");

done:
zcm_stop(&zcm);
zcm_cleanup(&zcm);
}

void testSub(void)
{
zcm_t zcm;
Expand Down
2 changes: 1 addition & 1 deletion test/zcm/DispatchLoopTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class DispatchLoopTest : public CxxTest::TestSuite
std::thread kill {killThread};
std::thread ctrl {controlThread, zcm};

zcm_handle(zcm);
zcm_handle(zcm, 0);

running = false;
ctrl.join();
Expand Down
6 changes: 0 additions & 6 deletions test/zcm/Forking2Test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ static void handler(const zcm_recv_buf_t *rbuf, const char *channel, void *usr)
numrecv++;
}

static void handle(zcm_t *zcm)
{
int rc = zcm_handle(zcm);
TS_ASSERT_EQUALS(rc, -1)
}

class Forking2Test : public CxxTest::TestSuite
{
public:
Expand Down
9 changes: 0 additions & 9 deletions test/zcm/ForkingTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ static void handler(const zcm_recv_buf_t *rbuf, const char *channel, void *usr)
numrecv++;
}

static void handle(zcm_t *zcm)
{
int rc = zcm_handle(zcm);
if (rc == -1) {
printf("handle() failed!\n");
exit(1);
}
}

bool sub(zcm_t *zcm)
{
zcm_subscribe(zcm, CHANNEL, handler, NULL);
Expand Down
Loading
Loading