forked from eclipse-zenoh/zenoh-c
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft attachment support implementation
Based on eclipse-zenoh#190 with minor changes: - attachement(s) -> attachment renaming - conflicts resolving - formatting
- Loading branch information
Showing
9 changed files
with
527 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) | ||
#include <windows.h> | ||
|
@@ -26,6 +27,10 @@ void data_handler(const z_sample_t *sample, void *arg) { | |
z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); | ||
printf(">> [Subscriber] Received %s ('%s': '%.*s')\n", kind_to_str(sample->kind), z_loan(keystr), | ||
(int)sample->payload.len, sample->payload.start); | ||
if (z_check(sample->attachment)) { | ||
z_owned_bytes_map_t map = z_bytes_map_from_attachment(sample->attachment); | ||
z_bytes_t there = z_bytes_map_get(&map, z_bytes_new("hello")); | ||
} | ||
z_drop(z_move(keystr)); | ||
} | ||
|
||
|
@@ -91,4 +96,4 @@ const char *kind_to_str(z_sample_kind_t kind) { | |
default: | ||
return "UNKNOWN"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.