Skip to content

Commit

Permalink
fix fprintzid
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Jul 12, 2023
1 parent e89610c commit 7009d42
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
9 changes: 5 additions & 4 deletions examples/arduino/z_scout.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
#define SSID "SSID"
#define PASS "PASS"

void fprintzid(z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
Serial.print("None");
} else {
Serial.print("Some(");
for (unsigned int i = 0; i < zid.len; i++) {
Serial.print(zid.start[i], HEX);
for (unsigned int i = 0; i < zidlen; i++) {
Serial.print(zid.id[i], HEX);
}
Serial.print(")");
}
Expand Down
9 changes: 5 additions & 4 deletions examples/espidf/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ void wifi_init_sta(void) {
vEventGroupDelete(s_event_group_handler);
}

void fprintzid(FILE *stream, z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(FILE *stream, z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
fprintf(stream, "None");
} else {
fprintf(stream, "Some(");
for (unsigned int i = 0; i < zid.len; i++) {
fprintf(stream, "%02X", (int)zid.start[i]);
for (unsigned int i = 0; i < zidlen; i++) {
fprintf(stream, "%02X", (int)zid.id[i]);
}
fprintf(stream, ")");
}
Expand Down
9 changes: 5 additions & 4 deletions examples/mbed/z_scout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
#include <randLIB.h>
#include <zenoh-pico.h>

void fprintzid(FILE *stream, z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(FILE *stream, z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
fprintf(stream, "None");
} else {
fprintf(stream, "Some(");
for (unsigned int i = 0; i < zid.len; i++) {
fprintf(stream, "%02X", (int)zid.start[i]);
for (unsigned int i = 0; i < zidlen; i++) {
fprintf(stream, "%02X", (int)zid.id[i]);
}
fprintf(stream, ")");
}
Expand Down
9 changes: 5 additions & 4 deletions examples/unix/c99/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
#include <unistd.h>
#include <zenoh-pico.h>

void fprintzid(FILE *stream, z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(FILE *stream, z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
fprintf(stream, "None");
} else {
fprintf(stream, "Some(");
for (unsigned int i = 0; i < zid.len; i++) {
fprintf(stream, "%02X", (int)zid.start[i]);
for (unsigned int i = 0; i < zidlen; i++) {
fprintf(stream, "%02X", (int)zid.id[i]);
}
fprintf(stream, ")");
}
Expand Down
9 changes: 5 additions & 4 deletions examples/windows/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
#include <stdlib.h>
#include <zenoh-pico.h>

void fprintzid(FILE *stream, z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(FILE *stream, z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
fprintf(stream, "None");
} else {
fprintf(stream, "Some(");
for (unsigned int i = 0; i < zid.len; i++) {
fprintf(stream, "%02X", (int)zid.start[i]);
for (unsigned int i = 0; i < zidlen; i++) {
fprintf(stream, "%02X", (int)zid.id[i]);
}
fprintf(stream, ")");
}
Expand Down
9 changes: 5 additions & 4 deletions examples/zephyr/z_scout.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
#include <stdio.h>
#include <zenoh-pico.h>

void fprintzid(FILE *stream, z_bytes_t zid) {
if (zid.start == NULL) {
void fprintzid(FILE *stream, z_id_t zid) {
unsigned int zidlen = _z_id_len(zid);
if (zidlen == 0) {
fprintf(stream, "None");
} else {
fprintf(stream, "Some(");
for (unsigned int i = 0; i < zid.len; i++) {
fprintf(stream, "%02X", (int)zid.start[i]);
for (unsigned int i = 0; i < zidlen; i++) {
fprintf(stream, "%02X", (int)zid.id[i]);
}
fprintf(stream, ")");
}
Expand Down

0 comments on commit 7009d42

Please sign in to comment.