Skip to content

Commit

Permalink
Merge branch 'dev/1.0.0' into unstable_feature
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Aug 22, 2024
2 parents 521163a + cf62926 commit b56306a
Show file tree
Hide file tree
Showing 18 changed files with 422 additions and 425 deletions.
2 changes: 1 addition & 1 deletion include/zenoh-pico/api/handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ extern "C" {
/* elem_clone_f */ z_##item_name##_clone, \
/* elem_move_f */ z_##item_name##_move, \
/* elem_drop_f */ z_##item_name##_drop, \
/* elem_null */ _z_owned_##item_name##_null)
/* elem_null */ z_internal_##item_name##_null)

#define _Z_CHANNEL_DEFINE_DUMMY(item_name, kind_name) \
typedef struct { \
Expand Down
244 changes: 122 additions & 122 deletions include/zenoh-pico/api/macros.h

Large diffs are not rendered by default.

176 changes: 88 additions & 88 deletions include/zenoh-pico/api/olv_macros.h

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions include/zenoh-pico/api/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ int8_t z_bytes_serialize_from_slice(z_owned_bytes_t *bytes, const z_loaned_slice
* Return:
* ``0`` if encode successful, ``negative value`` otherwise.
*/
int8_t z_bytes_from_slice(z_owned_bytes_t *bytes, z_moved_slice_t slice);
int8_t z_bytes_from_slice(z_owned_bytes_t *bytes, z_moved_slice_t *slice);

/**
* Encodes data into a :c:type:`z_owned_bytes_t`.
Expand Down Expand Up @@ -872,7 +872,7 @@ int8_t z_bytes_serialize_from_string(z_owned_bytes_t *bytes, const z_loaned_stri
* Return:
* ``0`` if encode successful, ``negative value`` otherwise.
*/
int8_t z_bytes_from_string(z_owned_bytes_t *bytes, z_moved_string_t s);
int8_t z_bytes_from_string(z_owned_bytes_t *bytes, z_moved_string_t *s);

/**
* Encodes a null-terminated string into a :c:type:`z_owned_bytes_t`.
Expand Down Expand Up @@ -936,7 +936,7 @@ int8_t z_bytes_from_iter(z_owned_bytes_t *bytes, _Bool (*iterator_body)(z_owned_
* Return:
* ``0`` if encode successful, ``negative value`` otherwise.
*/
int8_t z_bytes_from_pair(z_owned_bytes_t *bytes, z_moved_bytes_t first, z_moved_bytes_t second);
int8_t z_bytes_from_pair(z_owned_bytes_t *bytes, z_moved_bytes_t *first, z_moved_bytes_t *second);

/**
* Parameters:
Expand Down Expand Up @@ -1087,7 +1087,7 @@ int8_t z_bytes_writer_write_all(z_bytes_writer_t *writer, const uint8_t *src, si
* Return:
* 0 in case of success, negative error code otherwise
*/
int8_t z_bytes_writer_append(z_bytes_writer_t *writer, z_moved_bytes_t bytes);
int8_t z_bytes_writer_append(z_bytes_writer_t *writer, z_moved_bytes_t *bytes);

/**
* Appends bytes, with boundaries information. It would allow to read the same piece of data using
Expand All @@ -1100,7 +1100,7 @@ int8_t z_bytes_writer_append(z_bytes_writer_t *writer, z_moved_bytes_t bytes);
* Return:
* 0 in case of success, negative error code otherwise
*/
int8_t z_bytes_writer_append_bounded(z_bytes_writer_t *writer, z_moved_bytes_t bytes);
int8_t z_bytes_writer_append_bounded(z_bytes_writer_t *writer, z_moved_bytes_t *bytes);

/**
* Create timestamp.
Expand Down Expand Up @@ -1495,7 +1495,7 @@ int8_t z_whatami_to_view_string(z_whatami_t whatami, z_view_string_t *str_out);
* Return:
* ``0`` if scouting successfully triggered, ``negative value`` otherwise.
*/
int8_t z_scout(z_moved_config_t config, z_moved_closure_hello_t callback, const z_scout_options_t *options);
int8_t z_scout(z_moved_config_t *config, z_moved_closure_hello_t *callback, const z_scout_options_t *options);

/**
* Opens a Zenoh session.
Expand All @@ -1507,7 +1507,7 @@ int8_t z_scout(z_moved_config_t config, z_moved_closure_hello_t callback, const
* Return:
* ``0`` if open successful, ``negative value`` otherwise.
*/
int8_t z_open(z_owned_session_t *zs, z_moved_config_t config);
int8_t z_open(z_owned_session_t *zs, z_moved_config_t *config);

/**
* Closes a Zenoh session.
Expand All @@ -1518,7 +1518,7 @@ int8_t z_open(z_owned_session_t *zs, z_moved_config_t config);
* Return:
* ``0`` if close successful, ``negative value`` otherwise.
*/
int8_t z_close(z_moved_session_t zs);
int8_t z_close(z_moved_session_t *zs);

/**
* Fetches Zenoh IDs of all connected peers.
Expand All @@ -1533,7 +1533,7 @@ int8_t z_close(z_moved_session_t zs);
* Return:
* ``0`` if operation successfully triggered, ``negative value`` otherwise.
*/
int8_t z_info_peers_zid(const z_loaned_session_t *zs, z_moved_closure_zid_t callback);
int8_t z_info_peers_zid(const z_loaned_session_t *zs, z_moved_closure_zid_t *callback);

/**
* Fetches Zenoh IDs of all connected routers.
Expand All @@ -1548,7 +1548,7 @@ int8_t z_info_peers_zid(const z_loaned_session_t *zs, z_moved_closure_zid_t call
* Return:
* ``0`` if operation successfully triggered, ``negative value`` otherwise.
*/
int8_t z_info_routers_zid(const z_loaned_session_t *zs, z_moved_closure_zid_t callback);
int8_t z_info_routers_zid(const z_loaned_session_t *zs, z_moved_closure_zid_t *callback);

/**
* Gets the local Zenoh ID associated to a given Zenoh session.
Expand Down Expand Up @@ -1692,7 +1692,7 @@ void z_delete_options_default(z_delete_options_t *options);
* Return:
* ``0`` if put operation successful, ``negative value`` otherwise.
*/
int8_t z_put(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, z_moved_bytes_t payload,
int8_t z_put(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, z_moved_bytes_t *payload,
const z_put_options_t *options);

/**
Expand Down Expand Up @@ -1742,7 +1742,7 @@ int8_t z_declare_publisher(z_owned_publisher_t *pub, const z_loaned_session_t *z
* Return:
* ``0`` if undeclare successful, ``negative value`` otherwise.
*/
int8_t z_undeclare_publisher(z_moved_publisher_t pub);
int8_t z_undeclare_publisher(z_moved_publisher_t *pub);

/**
* Builds a :c:type:`z_publisher_put_options_t` with default values.
Expand Down Expand Up @@ -1771,7 +1771,7 @@ void z_publisher_delete_options_default(z_publisher_delete_options_t *options);
* Return:
* ``0`` if put operation successful, ``negative value`` otherwise.
*/
int8_t z_publisher_put(const z_loaned_publisher_t *pub, z_moved_bytes_t payload,
int8_t z_publisher_put(const z_loaned_publisher_t *pub, z_moved_bytes_t *payload,
const z_publisher_put_options_t *options);

/**
Expand Down Expand Up @@ -1821,7 +1821,7 @@ void z_get_options_default(z_get_options_t *options);
* ``0`` if put operation successful, ``negative value`` otherwise.
*/
int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, const char *parameters,
z_moved_closure_reply_t callback, z_get_options_t *options);
z_moved_closure_reply_t *callback, z_get_options_t *options);
/**
* Checks if queryable answered with an OK, which allows this value to be treated as a sample.
*
Expand Down Expand Up @@ -1894,7 +1894,7 @@ void z_queryable_options_default(z_queryable_options_t *options);
* ``0`` if declare operation successful, ``negative value`` otherwise.
*/
int8_t z_declare_queryable(z_owned_queryable_t *queryable, const z_loaned_session_t *zs,
const z_loaned_keyexpr_t *keyexpr, z_moved_closure_query_t callback,
const z_loaned_keyexpr_t *keyexpr, z_moved_closure_query_t *callback,
const z_queryable_options_t *options);

/**
Expand All @@ -1906,7 +1906,7 @@ int8_t z_declare_queryable(z_owned_queryable_t *queryable, const z_loaned_sessio
* Return:
* ``0`` if undeclare operation successful, ``negative value`` otherwise.
*/
int8_t z_undeclare_queryable(z_moved_queryable_t queryable);
int8_t z_undeclare_queryable(z_moved_queryable_t *queryable);

/**
* Builds a :c:type:`z_query_reply_options_t` with default values.
Expand All @@ -1933,7 +1933,7 @@ void z_query_reply_options_default(z_query_reply_options_t *options);
* Return:
* ``0`` if reply operation successful, ``negative value`` otherwise.
*/
int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_moved_bytes_t payload,
int8_t z_query_reply(const z_loaned_query_t *query, const z_loaned_keyexpr_t *keyexpr, z_moved_bytes_t *payload,
const z_query_reply_options_t *options);

/**
Expand Down Expand Up @@ -1987,7 +1987,7 @@ void z_query_reply_err_options_default(z_query_reply_err_options_t *options);
* Return:
* ``0`` if reply operation successful, ``negative value`` otherwise.
*/
int8_t z_query_reply_err(const z_loaned_query_t *query, z_moved_bytes_t payload,
int8_t z_query_reply_err(const z_loaned_query_t *query, z_moved_bytes_t *payload,
const z_query_reply_err_options_t *options);

#endif
Expand Down Expand Up @@ -2070,7 +2070,7 @@ int8_t z_declare_keyexpr(z_owned_keyexpr_t *declared_keyexpr, const z_loaned_ses
* Return:
* ``0`` if undeclare successful, ``negative value`` otherwise.
*/
int8_t z_undeclare_keyexpr(z_moved_keyexpr_t keyexpr, const z_loaned_session_t *zs);
int8_t z_undeclare_keyexpr(z_moved_keyexpr_t *keyexpr, const z_loaned_session_t *zs);

#if Z_FEATURE_SUBSCRIPTION == 1
/**
Expand All @@ -2095,7 +2095,7 @@ void z_subscriber_options_default(z_subscriber_options_t *options);
* ``0`` if declare successful, ``negative value`` otherwise.
*/
int8_t z_declare_subscriber(z_owned_subscriber_t *sub, const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr,
z_moved_closure_sample_t callback, const z_subscriber_options_t *options);
z_moved_closure_sample_t *callback, const z_subscriber_options_t *options);

/**
* Undeclares the subscriber.
Expand All @@ -2106,7 +2106,7 @@ int8_t z_declare_subscriber(z_owned_subscriber_t *sub, const z_loaned_session_t
* Return:
* ``0`` if undeclare successful, ``negative value`` otherwise.
*/
int8_t z_undeclare_subscriber(z_moved_subscriber_t sub);
int8_t z_undeclare_subscriber(z_moved_subscriber_t *sub);

/**
* Gets the keyexpr from a subscriber.
Expand Down
47 changes: 23 additions & 24 deletions include/zenoh-pico/api/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ typedef struct {
* _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth.
*/
typedef struct {
z_moved_encoding_t encoding;
z_moved_encoding_t *encoding;
z_congestion_control_t congestion_control;
z_priority_t priority;
_Bool is_express;
Expand All @@ -234,20 +234,20 @@ typedef struct {
* Represents the configuration used to configure a query reply sent via :c:func:`z_query_reply.
*
* Members:
* z_moved_encoding_t encoding: The encoding of the payload.
* z_moved_encoding_t* encoding: The encoding of the payload.
* z_congestion_control_t congestion_control: The congestion control to apply when routing this message.
* z_priority_t priority: The priority of this message when routed.
* z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created).
* _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth.
* z_moved_bytes_t attachment: An optional attachment to the response.
* z_moved_bytes_t* attachment: An optional attachment to the response.
*/
typedef struct {
z_moved_encoding_t encoding;
z_moved_encoding_t *encoding;
z_congestion_control_t congestion_control;
z_priority_t priority;
z_timestamp_t *timestamp;
_Bool is_express;
z_moved_bytes_t attachment;
z_moved_bytes_t *attachment;
} z_query_reply_options_t;

/**
Expand All @@ -258,45 +258,44 @@ typedef struct {
* z_priority_t priority: The priority of this message when routed.
* z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created).
* _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth.
* z_moved_bytes_t attachment: An optional attachment to the response.
* z_moved_bytes_t* attachment: An optional attachment to the response.
*/
typedef struct {
z_congestion_control_t congestion_control;
z_priority_t priority;
z_timestamp_t *timestamp;
_Bool is_express;
z_moved_bytes_t attachment;
z_moved_bytes_t *attachment;
} z_query_reply_del_options_t;

/**
* Represents the configuration used to configure a query reply error sent via :c:func:`z_query_reply_err.
*
* Members:
* z_moved_encoding_t encoding: The encoding of the payload.
* z_moved_encoding_t* encoding: The encoding of the payload.
*/
typedef struct {
z_moved_encoding_t encoding;
z_moved_encoding_t *encoding;
} z_query_reply_err_options_t;

/**
* Represents the configuration used to configure a put operation sent via via :c:func:`z_put`.
*
* Members:
* z_moved_encoding_t encoding: The encoding of the payload.
* z_moved_encoding_t* encoding: The encoding of the payload.
* z_congestion_control_t congestion_control: The congestion control to apply when routing this message.
* z_priority_t priority: The priority of this message when routed.
* z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created).
* _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth.
* z_moved_bytes_t attachment: An optional attachment to the publication.
* z_moved_bytes_t* attachment: An optional attachment to the publication.
*/
typedef struct {
z_moved_encoding_t encoding;
z_moved_encoding_t *encoding;
z_congestion_control_t congestion_control;
z_priority_t priority;
z_timestamp_t *timestamp;
_Bool is_express;
z_moved_bytes_t attachment;

z_moved_bytes_t *attachment;
} z_put_options_t;

/**
Expand All @@ -320,14 +319,14 @@ typedef struct {
* sent via :c:func:`z_publisher_put`.
*
* Members:
* z_moved_encoding_t encoding: The encoding of the payload.
* z_moved_encoding_t* encoding: The encoding of the payload.
* z_timestamp_t *timestamp: The API level timestamp (e.g. of the data when it was created).
* z_moved_bytes_t attachment: An optional attachment to the publication.
* z_moved_bytes_t* attachment: An optional attachment to the publication.
*/
typedef struct {
z_moved_encoding_t encoding;
z_moved_encoding_t *encoding;
z_timestamp_t *timestamp;
z_moved_bytes_t attachment;
z_moved_bytes_t *attachment;
} z_publisher_put_options_t;

/**
Expand All @@ -345,25 +344,25 @@ typedef struct {
* Represents the configuration used to configure a get operation sent via :c:func:`z_get`.
*
* Members:
* z_moved_bytes_t payload: The payload to include in the query.
* z_moved_encoding_t encoding: Payload encoding.
* z_moved_bytes_t* payload: The payload to include in the query.
* z_moved_encoding_t* encoding: Payload encoding.
* z_query_consolidation_t consolidation: The replies consolidation strategy to apply on replies.
* z_congestion_control_t congestion_control: The congestion control to apply when routing the query.
* z_priority_t priority: The priority of the query.
* _Bool is_express: If true, Zenoh will not wait to batch this operation with others to reduce the bandwidth.
* z_query_target_t target: The queryables that should be targeted by this get.
* z_moved_bytes_t attachment: An optional attachment to the query.
* z_moved_bytes_t* attachment: An optional attachment to the query.
*/
typedef struct {
z_moved_bytes_t payload;
z_moved_encoding_t encoding;
z_moved_bytes_t *payload;
z_moved_encoding_t *encoding;
z_query_consolidation_t consolidation;
z_congestion_control_t congestion_control;
z_priority_t priority;
_Bool is_express;
z_query_target_t target;
uint32_t timeout_ms;
z_moved_bytes_t attachment;
z_moved_bytes_t *attachment;
} z_get_options_t;

/**
Expand Down
6 changes: 3 additions & 3 deletions include/zenoh-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#define INCLUDE_ZENOH_PICO_CONFIG_H

/*--- CMake generated config; pass values to CMake to change the following tokens ---*/
#define Z_FRAG_MAX_SIZE 300000
#define Z_BATCH_UNICAST_SIZE 65535
#define Z_BATCH_MULTICAST_SIZE 8096
#define Z_FRAG_MAX_SIZE 4096
#define Z_BATCH_UNICAST_SIZE 2048
#define Z_BATCH_MULTICAST_SIZE 2048
#define Z_CONFIG_SOCKET_TIMEOUT 100

#define Z_FEATURE_MULTI_THREAD 1
Expand Down
4 changes: 2 additions & 2 deletions include/zenoh-pico/system/platform-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ _Z_OWNED_TYPE_VALUE(_z_mutex_t, mutex)
_Z_OWNED_FUNCTIONS_SYSTEM_DEF(mutex)

int8_t z_mutex_init(z_owned_mutex_t *m);
int8_t z_mutex_drop(z_moved_mutex_t m);
int8_t z_mutex_drop(z_moved_mutex_t *m);

int8_t z_mutex_lock(z_loaned_mutex_t *m);
int8_t z_mutex_try_lock(z_loaned_mutex_t *m);
Expand All @@ -125,7 +125,7 @@ _Z_OWNED_TYPE_VALUE(_z_condvar_t, condvar)
_Z_OWNED_FUNCTIONS_SYSTEM_DEF(condvar)

int8_t z_condvar_init(z_owned_condvar_t *cv);
int8_t z_condvar_drop(z_moved_condvar_t cv);
int8_t z_condvar_drop(z_moved_condvar_t *cv);

int8_t z_condvar_signal(z_loaned_condvar_t *cv);
int8_t z_condvar_wait(z_loaned_condvar_t *cv, z_loaned_mutex_t *m);
Expand Down
Loading

0 comments on commit b56306a

Please sign in to comment.