diff --git a/examples/arduino/z_get.ino b/examples/arduino/z_get.ino index 918b7ca46..cae647628 100644 --- a/examples/arduino/z_get.ino +++ b/examples/arduino/z_get.ino @@ -23,10 +23,10 @@ // Client mode values (comment/uncomment as needed) #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout // Peer mode values (comment/uncomment as needed) // #define MODE "peer" -// #define CONNECT "udp/224.0.0.225:7447#iface=en0" +// #define LOCATOR "udp/224.0.0.225:7447#iface=en0" #define KEYEXPR "demo/example/**" #define VALUE "" @@ -79,8 +79,12 @@ void setup() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/arduino/z_pub.ino b/examples/arduino/z_pub.ino index 2fd942a8f..bc842761f 100644 --- a/examples/arduino/z_pub.ino +++ b/examples/arduino/z_pub.ino @@ -23,10 +23,10 @@ // Client mode values (comment/uncomment as needed) #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout // Peer mode values (comment/uncomment as needed) // #define MODE "peer" -// #define CONNECT "udp/224.0.0.225:7447#iface=en0" +// #define LOCATOR "udp/224.0.0.225:7447#iface=en0" #define KEYEXPR "demo/example/zenoh-pico-pub" #define VALUE "[ARDUINO]{ESP32} Publication from Zenoh-Pico!" @@ -55,8 +55,12 @@ void setup() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/arduino/z_pull.ino b/examples/arduino/z_pull.ino index 9f123cb2c..958179ad0 100644 --- a/examples/arduino/z_pull.ino +++ b/examples/arduino/z_pull.ino @@ -23,10 +23,10 @@ // Client mode values (comment/uncomment as needed) #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout // Peer mode values (comment/uncomment as needed) // #define MODE "peer" -// #define CONNECT "udp/224.0.0.225:7447#iface=en0" +// #define LOCATOR "udp/224.0.0.225:7447#iface=en0" #define KEYEXPR "demo/example/**" @@ -56,8 +56,12 @@ void setup() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/arduino/z_queryable.ino b/examples/arduino/z_queryable.ino index 27e4c4af3..00c4f8427 100644 --- a/examples/arduino/z_queryable.ino +++ b/examples/arduino/z_queryable.ino @@ -23,10 +23,10 @@ // Client mode values (comment/uncomment as needed) #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout // Peer mode values (comment/uncomment as needed) // #define MODE "peer" -// #define CONNECT "udp/224.0.0.225:7447#iface=en0" +// #define LOCATOR "udp/224.0.0.225:7447#iface=en0" #define KEYEXPR "demo/example/zenoh-pico-queryable" #define VALUE "[ARDUINO]{ESP32} Queryable from Zenoh-Pico!" @@ -81,8 +81,12 @@ void setup() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/arduino/z_sub.ino b/examples/arduino/z_sub.ino index 70e14c77f..2083fd207 100644 --- a/examples/arduino/z_sub.ino +++ b/examples/arduino/z_sub.ino @@ -23,10 +23,10 @@ // Client mode values (comment/uncomment as needed) #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout // Peer mode values (comment/uncomment as needed) // #define MODE "peer" -// #define CONNECT "udp/224.0.0.225:7447#iface=en0" +// #define LOCATOR "udp/224.0.0.225:7447#iface=en0" #define KEYEXPR "demo/example/**" @@ -68,8 +68,12 @@ void setup() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/espidf/z_get.c b/examples/espidf/z_get.c index fcfb5f975..3d07376c6 100644 --- a/examples/espidf/z_get.c +++ b/examples/espidf/z_get.c @@ -38,10 +38,10 @@ static int s_retry_count = 0; #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -140,8 +140,12 @@ void app_main() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/espidf/z_pub.c b/examples/espidf/z_pub.c index 2ff253015..57ed1b1c0 100644 --- a/examples/espidf/z_pub.c +++ b/examples/espidf/z_pub.c @@ -38,10 +38,10 @@ static int s_retry_count = 0; #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -122,8 +122,12 @@ void app_main() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/espidf/z_pull.c b/examples/espidf/z_pull.c index 7797de157..8087e6c4f 100644 --- a/examples/espidf/z_pull.c +++ b/examples/espidf/z_pull.c @@ -38,10 +38,10 @@ static int s_retry_count = 0; #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -124,8 +124,12 @@ void app_main() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/espidf/z_queryable.c b/examples/espidf/z_queryable.c index 0939bfac8..20177cf07 100644 --- a/examples/espidf/z_queryable.c +++ b/examples/espidf/z_queryable.c @@ -38,10 +38,10 @@ static int s_retry_count = 0; #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -149,8 +149,12 @@ void app_main() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/espidf/z_sub.c b/examples/espidf/z_sub.c index d7ac968ae..398bb8f3a 100644 --- a/examples/espidf/z_sub.c +++ b/examples/espidf/z_sub.c @@ -38,10 +38,10 @@ static int s_retry_count = 0; #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -132,8 +132,12 @@ void app_main() { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/freertos_plus_tcp/z_get.c b/examples/freertos_plus_tcp/z_get.c index 7d76d8de3..340d8e900 100644 --- a/examples/freertos_plus_tcp/z_get.c +++ b/examples/freertos_plus_tcp/z_get.c @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -57,8 +57,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_pub.c b/examples/freertos_plus_tcp/z_pub.c index ed4dfb4be..ee08f997a 100644 --- a/examples/freertos_plus_tcp/z_pub.c +++ b/examples/freertos_plus_tcp/z_pub.c @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447" +#define LOCATOR "udp/224.0.0.225:7447" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -35,8 +35,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_pub_st.c b/examples/freertos_plus_tcp/z_pub_st.c index 52ee45e20..1682c0cd0 100644 --- a/examples/freertos_plus_tcp/z_pub_st.c +++ b/examples/freertos_plus_tcp/z_pub_st.c @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447" +#define LOCATOR "udp/224.0.0.225:7447" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -36,8 +36,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_pull.c b/examples/freertos_plus_tcp/z_pull.c index 9d2312f78..0d92f33cd 100644 --- a/examples/freertos_plus_tcp/z_pull.c +++ b/examples/freertos_plus_tcp/z_pull.c @@ -18,10 +18,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -35,8 +35,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_put.c b/examples/freertos_plus_tcp/z_put.c index cd46c1b06..93f5711fa 100644 --- a/examples/freertos_plus_tcp/z_put.c +++ b/examples/freertos_plus_tcp/z_put.c @@ -18,10 +18,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447" +#define LOCATOR "udp/224.0.0.225:7447" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -33,8 +33,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_queryable.c b/examples/freertos_plus_tcp/z_queryable.c index a1f8634f8..15d70052b 100644 --- a/examples/freertos_plus_tcp/z_queryable.c +++ b/examples/freertos_plus_tcp/z_queryable.c @@ -18,10 +18,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447" +#define LOCATOR "udp/224.0.0.225:7447" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -59,8 +59,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_sub.c b/examples/freertos_plus_tcp/z_sub.c index 4febeecf7..b52ed7e6e 100644 --- a/examples/freertos_plus_tcp/z_sub.c +++ b/examples/freertos_plus_tcp/z_sub.c @@ -18,10 +18,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -43,8 +43,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/freertos_plus_tcp/z_sub_st.c b/examples/freertos_plus_tcp/z_sub_st.c index 34ae7b6f4..2af0991a7 100644 --- a/examples/freertos_plus_tcp/z_sub_st.c +++ b/examples/freertos_plus_tcp/z_sub_st.c @@ -18,10 +18,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -47,8 +47,12 @@ void app_main(void) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } printf("Opening session...\n"); diff --git a/examples/mbed/z_get.cpp b/examples/mbed/z_get.cpp index c7969b3b1..a9dcce783 100644 --- a/examples/mbed/z_get.cpp +++ b/examples/mbed/z_get.cpp @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -61,10 +61,13 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } - // Open Zenoh session printf("Opening Zenoh Session..."); z_owned_session_t s; diff --git a/examples/mbed/z_pub.cpp b/examples/mbed/z_pub.cpp index 3a11f4fa6..d1a056750 100644 --- a/examples/mbed/z_pub.cpp +++ b/examples/mbed/z_pub.cpp @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -42,8 +42,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/mbed/z_pull.cpp b/examples/mbed/z_pull.cpp index 809a881ea..217c5df27 100644 --- a/examples/mbed/z_pull.cpp +++ b/examples/mbed/z_pull.cpp @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -44,8 +44,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/mbed/z_queryable.cpp b/examples/mbed/z_queryable.cpp index 2c1db9b2e..220224548 100644 --- a/examples/mbed/z_queryable.cpp +++ b/examples/mbed/z_queryable.cpp @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -67,8 +67,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/mbed/z_sub.cpp b/examples/mbed/z_sub.cpp index 8229a92fd..f38610db1 100644 --- a/examples/mbed/z_sub.cpp +++ b/examples/mbed/z_sub.cpp @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -52,8 +52,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_config_loan_mut(&config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/zephyr/z_get.c b/examples/zephyr/z_get.c index c56049899..2b52a4cde 100644 --- a/examples/zephyr/z_get.c +++ b/examples/zephyr/z_get.c @@ -21,10 +21,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -57,8 +57,13 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/zephyr/z_pub.c b/examples/zephyr/z_pub.c index 4f9f063b7..63c9a9756 100644 --- a/examples/zephyr/z_pub.c +++ b/examples/zephyr/z_pub.c @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -39,8 +39,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/zephyr/z_pull.c b/examples/zephyr/z_pull.c index e3be5f345..94b273ad2 100644 --- a/examples/zephyr/z_pull.c +++ b/examples/zephyr/z_pull.c @@ -19,10 +19,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -39,8 +39,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/zephyr/z_queryable.c b/examples/zephyr/z_queryable.c index 1eafda347..f8e156a07 100644 --- a/examples/zephyr/z_queryable.c +++ b/examples/zephyr/z_queryable.c @@ -20,10 +20,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -62,8 +62,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session diff --git a/examples/zephyr/z_sub.c b/examples/zephyr/z_sub.c index c49668b3c..63ee3ecd7 100644 --- a/examples/zephyr/z_sub.c +++ b/examples/zephyr/z_sub.c @@ -19,10 +19,10 @@ #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" -#define CONNECT "" // If empty, it will scout +#define LOCATOR "" // If empty, it will scout #elif CLIENT_OR_PEER == 1 #define MODE "peer" -#define CONNECT "udp/224.0.0.225:7447#iface=en0" +#define LOCATOR "udp/224.0.0.225:7447#iface=en0" #else #error "Unknown Zenoh operation mode. Check CLIENT_OR_PEER value." #endif @@ -46,8 +46,12 @@ int main(int argc, char **argv) { z_owned_config_t config; z_config_default(&config); zp_config_insert(z_loan_mut(config), Z_CONFIG_MODE_KEY, MODE); - if (strcmp(CONNECT, "") != 0) { - zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, CONNECT); + if (strcmp(LOCATOR, "") != 0) { + if (strcmp(MODE, "client") == 0) { + zp_config_insert(z_loan_mut(config), Z_CONFIG_CONNECT_KEY, LOCATOR); + } else { + zp_config_insert(z_loan_mut(config), Z_CONFIG_LISTEN_KEY, LOCATOR); + } } // Open Zenoh session