-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add z_bytes example #673
Add z_bytes example #673
Conversation
992c0b4
to
72b9bf2
Compare
include/zenoh-pico/api/encoding.h
Outdated
// Constant alias for string: `"zenoh/bytes"`. | ||
// | ||
// Usually used for types: `uint8_t[]`. | ||
extern const z_owned_encoding_t ENCODING_ZENOH_BYTES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please see how encoding constants are implemented in zenoh-c: https://github.com/eclipse-zenoh/zenoh-c/blob/610a4b9057a703ecba5f098e084bdc40e4e786f3/include/zenoh_commons.h#L2254
4b00337
to
f53bc01
Compare
de7b72d
to
5a46325
Compare
We will also need to add the docs for encoding functions, and probably an example of using slice iterator similar to https://github.com/eclipse-zenoh/zenoh/blob/db755e3e75733b10cd9b9fa63acb624fd4e57a39/examples/examples/z_bytes.rs#L107C1-L112C6 |
examples/unix/c11/z_bytes.c
Outdated
z_view_slice_t curr_slice; | ||
while (z_bytes_slice_iterator_next(&slice_iter, &curr_slice)) { | ||
printf("slice len: %d, slice data: '%.*s'\n", (int)z_slice_len(z_view_slice_loan(&curr_slice)), | ||
(int)z_slice_len(z_view_slice_loan(&curr_slice)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not good since it will print garbage, could we rather print slice content as list of hexadecimal values ?
3d3b42e
to
6f3a235
Compare
6f3a235
to
bfecb48
Compare
Closes #662.
Adds missing encoding constants.