diff --git a/examples/arduino/z_pull.ino b/examples/arduino/z_pull.ino index 5e2952d6c..c1ffd7865 100644 --- a/examples/arduino/z_pull.ino +++ b/examples/arduino/z_pull.ino @@ -16,6 +16,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 // WiFi-specific parameters #define SSID "SSID" #define PASS "PASS" @@ -108,3 +109,9 @@ void loop() { delay(5000); z_subscriber_pull(z_pull_subscriber_loan(&sub)); } +#else +void setup() { + Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it."); +} +void loop() {} +#endif diff --git a/examples/arduino/z_sub.ino b/examples/arduino/z_sub.ino index e9b829245..b07ca70c0 100644 --- a/examples/arduino/z_sub.ino +++ b/examples/arduino/z_sub.ino @@ -16,6 +16,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 // WiFi-specific parameters #define SSID "SSID" #define PASS "PASS" @@ -104,3 +105,10 @@ void setup() { } void loop() { delay(5000); } + +#else +void setup() { + Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it."); +} +void loop() {} +#endif \ No newline at end of file diff --git a/examples/espidf/z_pull.c b/examples/espidf/z_pull.c index 976880a79..03175c898 100644 --- a/examples/espidf/z_pull.c +++ b/examples/espidf/z_pull.c @@ -25,6 +25,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define ESP_WIFI_SSID "SSID" #define ESP_WIFI_PASS "PASS" #define ESP_MAXIMUM_RETRY 5 @@ -168,3 +169,8 @@ void app_main() { z_close(z_move(s)); printf("OK!\n"); } +#else +void app_main() { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); +} +#endif \ No newline at end of file diff --git a/examples/espidf/z_sub.c b/examples/espidf/z_sub.c index e09bad00d..01272c46e 100644 --- a/examples/espidf/z_sub.c +++ b/examples/espidf/z_sub.c @@ -25,6 +25,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define ESP_WIFI_SSID "SSID" #define ESP_WIFI_PASS "PASS" #define ESP_MAXIMUM_RETRY 5 @@ -166,3 +167,8 @@ void app_main() { z_close(z_move(s)); printf("OK!\n"); } +#else +void app_main() { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); +} +#endif \ No newline at end of file diff --git a/examples/mbed/z_pull.cpp b/examples/mbed/z_pull.cpp index 3ca962ed7..8a5e0522c 100644 --- a/examples/mbed/z_pull.cpp +++ b/examples/mbed/z_pull.cpp @@ -16,6 +16,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -91,3 +92,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/mbed/z_sub.cpp b/examples/mbed/z_sub.cpp index d8f9329ee..27297b1c8 100644 --- a/examples/mbed/z_sub.cpp +++ b/examples/mbed/z_sub.cpp @@ -16,6 +16,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -89,3 +90,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c11/z_ping.c b/examples/unix/c11/z_ping.c index dc9cbf4f7..775420bd7 100644 --- a/examples/unix/c11/z_ping.c +++ b/examples/unix/c11/z_ping.c @@ -21,6 +21,7 @@ #include "zenoh-pico.h" #include "zenoh-pico/system/platform.h" +#if Z_FEATURE_SUBSCRIPTION == 1 // WARNING: for the sake of this example we are using "internal" structs and functions (starting with "_"). // Synchronisation primitives are planned to be added to the API in the future. _z_condvar_t cond; @@ -165,3 +166,9 @@ struct args_t parse_args(int argc, char** argv) { .warmup_ms = warmup_ms, }; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c11/z_pong.c b/examples/unix/c11/z_pong.c index 8acf09564..a79fb7285 100644 --- a/examples/unix/c11/z_pong.c +++ b/examples/unix/c11/z_pong.c @@ -15,6 +15,7 @@ #include "stdio.h" #include "zenoh-pico.h" +#if Z_FEATURE_SUBSCRIPTION == 1 void callback(const z_sample_t* sample, void* context) { z_publisher_t pub = z_loan(*(z_owned_publisher_t*)context); z_publisher_put(pub, sample->payload.start, sample->payload.len, NULL); @@ -68,3 +69,9 @@ int main(int argc, char** argv) { z_close(z_move(session)); } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c11/z_pull.c b/examples/unix/c11/z_pull.c index 678641aed..cc8297a29 100644 --- a/examples/unix/c11/z_pull.c +++ b/examples/unix/c11/z_pull.c @@ -18,6 +18,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -98,3 +99,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c11/z_sub.c b/examples/unix/c11/z_sub.c index 7b097fe72..77fdb29a8 100644 --- a/examples/unix/c11/z_sub.c +++ b/examples/unix/c11/z_sub.c @@ -19,6 +19,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -107,3 +108,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c11/z_sub_st.c b/examples/unix/c11/z_sub_st.c index 567290484..d6ee0966f 100644 --- a/examples/unix/c11/z_sub_st.c +++ b/examples/unix/c11/z_sub_st.c @@ -19,6 +19,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -96,3 +97,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c99/z_ping.c b/examples/unix/c99/z_ping.c index cbae19ccb..18c296a7d 100644 --- a/examples/unix/c99/z_ping.c +++ b/examples/unix/c99/z_ping.c @@ -22,6 +22,7 @@ #include "zenoh-pico/api/primitives.h" #include "zenoh-pico/system/platform.h" +#if Z_FEATURE_SUBSCRIPTION == 1 _z_condvar_t cond; _z_mutex_t mutex; @@ -164,4 +165,10 @@ struct args_t parse_args(int argc, char** argv) { .number_of_pings = number_of_pings, .warmup_ms = warmup_ms, }; -} \ No newline at end of file +} +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c99/z_pong.c b/examples/unix/c99/z_pong.c index 53f6d14ee..d7671b38d 100644 --- a/examples/unix/c99/z_pong.c +++ b/examples/unix/c99/z_pong.c @@ -16,6 +16,7 @@ #include "zenoh-pico.h" #include "zenoh-pico/api/primitives.h" +#if Z_FEATURE_SUBSCRIPTION == 1 void callback(const z_sample_t* sample, void* context) { z_publisher_t pub = z_publisher_loan((z_owned_publisher_t*)context); z_publisher_put(pub, sample->payload.start, sample->payload.len, NULL); @@ -70,4 +71,10 @@ int main(int argc, char** argv) { zp_stop_lease_task(z_session_loan(&session)); z_close(z_session_move(&session)); -} \ No newline at end of file +} +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c99/z_pull.c b/examples/unix/c99/z_pull.c index e01f43155..88361ff27 100644 --- a/examples/unix/c99/z_pull.c +++ b/examples/unix/c99/z_pull.c @@ -18,6 +18,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -99,3 +100,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c99/z_sub.c b/examples/unix/c99/z_sub.c index 0f616525f..7cb1d2354 100644 --- a/examples/unix/c99/z_sub.c +++ b/examples/unix/c99/z_sub.c @@ -19,6 +19,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *arg) { (void)(arg); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -108,3 +109,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/unix/c99/z_sub_st.c b/examples/unix/c99/z_sub_st.c index fac31bd46..37c7d48cc 100644 --- a/examples/unix/c99/z_sub_st.c +++ b/examples/unix/c99/z_sub_st.c @@ -19,6 +19,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *arg) { (void)(arg); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -97,3 +98,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/windows/z_ping.c b/examples/windows/z_ping.c index dcfb1fc8e..247b18eb7 100644 --- a/examples/windows/z_ping.c +++ b/examples/windows/z_ping.c @@ -21,6 +21,7 @@ #include "zenoh-pico.h" #include "zenoh-pico/system/platform.h" +#if Z_FEATURE_SUBSCRIPTION == 1 _z_condvar_t cond; _z_mutex_t mutex; @@ -161,4 +162,10 @@ struct args_t parse_args(int argc, char** argv) { .number_of_pings = number_of_pings, .warmup_ms = warmup_ms, }; -} \ No newline at end of file +} +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/windows/z_pong.c b/examples/windows/z_pong.c index 698c086f7..a79fb7285 100644 --- a/examples/windows/z_pong.c +++ b/examples/windows/z_pong.c @@ -15,6 +15,7 @@ #include "stdio.h" #include "zenoh-pico.h" +#if Z_FEATURE_SUBSCRIPTION == 1 void callback(const z_sample_t* sample, void* context) { z_publisher_t pub = z_loan(*(z_owned_publisher_t*)context); z_publisher_put(pub, sample->payload.start, sample->payload.len, NULL); @@ -67,4 +68,10 @@ int main(int argc, char** argv) { zp_stop_lease_task(z_loan(session)); z_close(z_move(session)); -} \ No newline at end of file +} +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/windows/z_pull.c b/examples/windows/z_pull.c index 52941550e..efaa7676e 100644 --- a/examples/windows/z_pull.c +++ b/examples/windows/z_pull.c @@ -17,6 +17,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -78,3 +79,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/windows/z_sub.c b/examples/windows/z_sub.c index d48328500..e46e1fbcb 100644 --- a/examples/windows/z_sub.c +++ b/examples/windows/z_sub.c @@ -18,6 +18,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -77,3 +78,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/windows/z_sub_st.c b/examples/windows/z_sub_st.c index d9b66fa80..d34a2d17f 100644 --- a/examples/windows/z_sub_st.c +++ b/examples/windows/z_sub_st.c @@ -18,6 +18,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 void data_handler(const z_sample_t *sample, void *ctx) { (void)(ctx); z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); @@ -66,3 +67,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/zephyr/z_pull.c b/examples/zephyr/z_pull.c index 2d4d7c856..7b3522529 100644 --- a/examples/zephyr/z_pull.c +++ b/examples/zephyr/z_pull.c @@ -15,6 +15,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -85,3 +86,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file diff --git a/examples/zephyr/z_sub.c b/examples/zephyr/z_sub.c index 3860f9e8a..4f1831154 100644 --- a/examples/zephyr/z_sub.c +++ b/examples/zephyr/z_sub.c @@ -15,6 +15,7 @@ #include #include +#if Z_FEATURE_SUBSCRIPTION == 1 #define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode #if CLIENT_OR_PEER == 0 #define MODE "client" @@ -83,3 +84,9 @@ int main(int argc, char **argv) { return 0; } +#else +int main(void) { + printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n"); + return -1; +} +#endif \ No newline at end of file