Skip to content
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

Rename feature config tokens #258

Merged
merged 8 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"-<system/unix/>",
"-<system/windows/>",
"-<system/zephyr/>"]
CPPDEFINES = ["ZENOH_ARDUINO_OPENCR", "ZENOH_C_STANDARD=99", "Z_MULTI_THREAD=0"]
CPPDEFINES = ["ZENOH_ARDUINO_OPENCR", "ZENOH_C_STANDARD=99", "Z_FEATURE_MULTI_THREAD=0"]

elif FRAMEWORK == 'espidf':
SRC_FILTER = ["+<*>",
Expand Down
162 changes: 82 additions & 80 deletions include/zenoh-pico/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,117 +102,148 @@
#define Z_CONFIG_ADD_TIMESTAMP_KEY 0x4A
#define Z_CONFIG_ADD_TIMESTAMP_DEFAULT "false"

/*------------------ Compile-time configuration properties ------------------*/
/*------------------ Compile-time feature configuration ------------------*/

/**
* Default length for Zenoh ID. Maximum size is 16 bytes.
* This configuration will only be applied to Zenoh IDs generated by Zenoh-Pico.
* Enable multi-thread support.
*/
#ifndef Z_ZID_LENGTH
#define Z_ZID_LENGTH 16
#ifndef Z_FEATURE_MULTI_THREAD
#define Z_FEATURE_MULTI_THREAD 1
#endif

#ifndef Z_TSID_LENGTH
#define Z_TSID_LENGTH 16
/**
* Enable dynamic memory allocation.
*/
#ifndef Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION
#define Z_FEATURE_DYNAMIC_MEMORY_ALLOCATION 0
#endif

/**
* Protocol version identifier.
* Do not change this value.
* Enable TCP links.
*/
#ifndef Z_PROTO_VERSION
#define Z_PROTO_VERSION 0x08
#ifndef Z_FEATURE_LINK_TCP
#define Z_FEATURE_LINK_TCP 1
#endif

/**
* Default session lease in milliseconds.
* Enable Bluetooth links.
*/
#ifndef Z_TRANSPORT_LEASE
#define Z_TRANSPORT_LEASE 10000
#ifndef Z_FEATURE_LINK_BLUETOOTH
#define Z_FEATURE_LINK_BLUETOOTH 0
#endif

/**
* Default session lease expire factor.
* Enable WebSocket links.
*/
#ifndef Z_TRANSPORT_LEASE_EXPIRE_FACTOR
#define Z_TRANSPORT_LEASE_EXPIRE_FACTOR 3.5
#ifndef Z_FEATURE_LINK_WS
#define Z_FEATURE_LINK_WS 0
#endif

/**
* Default multicast session join interval in milliseconds.
* Enable Serial links.
*/
#ifndef Z_JOIN_INTERVAL
#define Z_JOIN_INTERVAL 2500
#ifndef Z_FEATURE_LINK_SERIAL
#define Z_FEATURE_LINK_SERIAL 0
#endif

/**
* Default socket timeout in milliseconds.
* Enable UDP Scouting.
*/
#ifndef Z_CONFIG_SOCKET_TIMEOUT
#define Z_CONFIG_SOCKET_TIMEOUT 100
#ifndef Z_FEATURE_SCOUTING_UDP
#define Z_FEATURE_SCOUTING_UDP 1
#endif

#ifndef Z_SN_RESOLUTION
#define Z_SN_RESOLUTION 0x02
/**
* Enable UDP Multicast links.
*/
#ifndef Z_FEATURE_LINK_UDP_MULTICAST
#define Z_FEATURE_LINK_UDP_MULTICAST 1
#endif

#ifndef Z_REQ_RESOLUTION
#define Z_REQ_RESOLUTION 0x02
/**
* Enable UDP Unicast links.
*/
#ifndef Z_FEATURE_LINK_UDP_UNICAST
#define Z_FEATURE_LINK_UDP_UNICAST 1
#endif

/**
* Enable multi-thread support.
* Enable Multicast Transport.
*/
#ifndef Z_MULTI_THREAD
#define Z_MULTI_THREAD 1
#ifndef Z_FEATURE_MULTICAST_TRANSPORT
#if Z_FEATURE_SCOUTING_UDP == 0 && Z_FEATURE_LINK_BLUETOOTH == 0 && Z_FEATURE_LINK_UDP_MULTICAST == 0
#define Z_FEATURE_MULTICAST_TRANSPORT 0
#else
#define Z_FEATURE_MULTICAST_TRANSPORT 1
#endif
#endif

/**
* Enable TCP links.
* Enable Unicast Transport.
*/
#ifndef Z_LINK_TCP
#define Z_LINK_TCP 1
#ifndef Z_FEATURE_UNICAST_TRANSPORT
#if Z_FEATURE_LINK_TCP == 0 && Z_FEATURE_LINK_UDP_UNICAST == 0 && Z_FEATURE_LINK_SERIAL == 0 && Z_FEATURE_LINK_WS == 0
#define Z_FEATURE_UNICAST_TRANSPORT 0
#else
#define Z_FEATURE_UNICAST_TRANSPORT 1
#endif
#endif

/*------------------ Compile-time configuration properties ------------------*/
/**
* Enable UDP Multicast links.
* Default length for Zenoh ID. Maximum size is 16 bytes.
* This configuration will only be applied to Zenoh IDs generated by Zenoh-Pico.
*/
#ifndef Z_LINK_UDP_MULTICAST
#define Z_LINK_UDP_MULTICAST 1
#ifndef Z_ZID_LENGTH
#define Z_ZID_LENGTH 16
#endif

#ifndef Z_TSID_LENGTH
#define Z_TSID_LENGTH 16
#endif

/**
* Enable UDP Unicast links.
* Protocol version identifier.
* Do not change this value.
*/
#ifndef Z_LINK_UDP_UNICAST
#define Z_LINK_UDP_UNICAST 1
#ifndef Z_PROTO_VERSION
#define Z_PROTO_VERSION 0x08
#endif

/**
* Enable Bluetooth links.
* Default session lease in milliseconds.
*/
#ifndef Z_LINK_BLUETOOTH
#define Z_LINK_BLUETOOTH 0
#ifndef Z_TRANSPORT_LEASE
#define Z_TRANSPORT_LEASE 10000
#endif

/**
* Enable Serial links.
* Default session lease expire factor.
*/
#ifndef Z_LINK_SERIAL
#define Z_LINK_SERIAL 0
#ifndef Z_TRANSPORT_LEASE_EXPIRE_FACTOR
#define Z_TRANSPORT_LEASE_EXPIRE_FACTOR 3.5
#endif

/**
* Enable WebSocket links.
* Default multicast session join interval in milliseconds.
*/
#ifndef Z_LINK_WS
#define Z_LINK_WS 0
#ifndef Z_JOIN_INTERVAL
#define Z_JOIN_INTERVAL 2500
#endif

/**
* Enable UDP Scouting.
* Default socket timeout in milliseconds.
*/
#ifndef Z_SCOUTING_UDP
#define Z_SCOUTING_UDP 1
#ifndef Z_CONFIG_SOCKET_TIMEOUT
#define Z_CONFIG_SOCKET_TIMEOUT 100
#endif

#ifndef Z_SN_RESOLUTION
#define Z_SN_RESOLUTION 0x02
#endif

#ifndef Z_REQ_RESOLUTION
#define Z_REQ_RESOLUTION 0x02
#endif

/**
Expand Down Expand Up @@ -242,33 +273,4 @@
#define Z_FRAG_MAX_SIZE 300000
#endif

/**
* Enable dynamic memory allocation.
*/
#ifndef Z_DYNAMIC_MEMORY_ALLOCATION
#define Z_DYNAMIC_MEMORY_ALLOCATION 0
#endif

/**
* Enable Multicast Transport.
*/
#ifndef Z_MULTICAST_TRANSPORT
#if Z_SCOUTING_UDP == 0 && Z_LINK_BLUETOOTH == 0 && Z_LINK_UDP_MULTICAST == 0
#define Z_MULTICAST_TRANSPORT 0
#else
#define Z_MULTICAST_TRANSPORT 1
#endif
#endif

/**
* Enable Unicast Transport.
*/
#ifndef Z_UNICAST_TRANSPORT
#if Z_LINK_TCP == 0 && Z_LINK_UDP_UNICAST == 0 && Z_LINK_SERIAL == 0 && Z_LINK_WS == 0
#define Z_UNICAST_TRANSPORT 0
#else
#define Z_UNICAST_TRANSPORT 1
#endif
#endif

#endif /* INCLUDE_ZENOH_PICO_CONFIG_H */
2 changes: 1 addition & 1 deletion include/zenoh-pico/link/config/bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"

#if Z_LINK_BLUETOOTH == 1
#if Z_FEATURE_LINK_BLUETOOTH == 1

#define BT_CONFIG_ARGC 3

Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/link/config/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"

#if Z_LINK_SERIAL == 1
#if Z_FEATURE_LINK_SERIAL == 1

#define SERIAL_CONFIG_ARGC 1

Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/link/config/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"

#if Z_LINK_TCP == 1
#if Z_FEATURE_LINK_TCP == 1

#define TCP_CONFIG_ARGC 1

Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/link/config/udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "zenoh-pico/collections/intmap.h"
#include "zenoh-pico/collections/string.h"

#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1

#define UDP_CONFIG_ARGC 3

Expand Down
2 changes: 1 addition & 1 deletion include/zenoh-pico/link/config/ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"

#if Z_LINK_WS == 1
#if Z_FEATURE_LINK_WS == 1

#define WS_CONFIG_TOUT_KEY 0x01
#define WS_CONFIG_TOUT_STR "tout"
Expand Down
10 changes: 5 additions & 5 deletions include/zenoh-pico/link/endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
#include "zenoh-pico/utils/result.h"

/*------------------ Locator ------------------*/
#if Z_LINK_TCP == 1
#if Z_FEATURE_LINK_TCP == 1
#define TCP_SCHEMA "tcp"
#endif
#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#define UDP_SCHEMA "udp"
#endif
#if Z_LINK_BLUETOOTH == 1
#if Z_FEATURE_LINK_BLUETOOTH == 1
#define BT_SCHEMA "bt"
#endif
#if Z_LINK_SERIAL == 1
#if Z_FEATURE_LINK_SERIAL == 1
#define SERIAL_SCHEMA "serial"
#endif
#if Z_LINK_WS == 1
#if Z_FEATURE_LINK_WS == 1
#define WS_SCHEMA "ws"
#endif

Expand Down
20 changes: 10 additions & 10 deletions include/zenoh-pico/link/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
#include "zenoh-pico/protocol/iobuf.h"
#include "zenoh-pico/system/platform.h"

#if Z_LINK_TCP == 1
#if Z_FEATURE_LINK_TCP == 1
#include "zenoh-pico/system/link/tcp.h"
#endif

#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
#include "zenoh-pico/system/link/udp.h"
#endif

#if Z_LINK_BLUETOOTH == 1
#if Z_FEATURE_LINK_BLUETOOTH == 1
#include "zenoh-pico/system/link/bt.h"
#endif

#if Z_LINK_SERIAL == 1
#if Z_FEATURE_LINK_SERIAL == 1
#include "zenoh-pico/system/link/serial.h"
#endif

#if Z_LINK_WS == 1
#if Z_FEATURE_LINK_WS == 1
#include "zenoh-pico/system/link/ws.h"
#endif

Expand Down Expand Up @@ -77,19 +77,19 @@ typedef struct _z_link_t {
_z_endpoint_t _endpoint;

union {
#if Z_LINK_TCP == 1
#if Z_FEATURE_LINK_TCP == 1
_z_tcp_socket_t _tcp;
#endif
#if Z_LINK_UDP_UNICAST == 1 || Z_LINK_UDP_MULTICAST == 1
#if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1
_z_udp_socket_t _udp;
#endif
#if Z_LINK_BLUETOOTH == 1
#if Z_FEATURE_LINK_BLUETOOTH == 1
_z_bt_socket_t _bt;
#endif
#if Z_LINK_SERIAL == 1
#if Z_FEATURE_LINK_SERIAL == 1
_z_serial_socket_t _serial;
#endif
#if Z_LINK_WS == 1
#if Z_FEATURE_LINK_WS == 1
_z_ws_socket_t _ws;
#endif
} _socket;
Expand Down
Loading
Loading