Skip to content

Commit

Permalink
fix: update freertos examples with modular features
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Oct 31, 2023
1 parent d0828e9 commit 9e86cbb
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/freertos_plus_tcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ target_link_libraries(zenohpico
target_compile_definitions(zenohpico
PUBLIC
Z_FEATURE_MULTI_THREAD=1
Z_FEATURE_PUBLICATION=1
Z_FEATURE_SUBSCRIPTION=1
Z_FEATURE_QUERY=1
Z_FEATURE_QUERYABLE=1
Z_FEATURE_LINK_TCP=1
Z_FEATURE_SCOUTING_UDP=1
Z_FEATURE_LINK_UDP_UNICAST=1
Expand Down
9 changes: 8 additions & 1 deletion examples/freertos_plus_tcp/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "FreeRTOS.h"

#if Z_FEATURE_QUERY == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -92,4 +93,10 @@ void app_main() {
zp_stop_lease_task(z_loan(s));

z_close(z_move(s));
}
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -2;
}
#endif
7 changes: 7 additions & 0 deletions examples/freertos_plus_tcp/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "FreeRTOS.h"

#if Z_FEATURE_PUBLICATION == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -104,3 +105,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -2;
}
#endif
7 changes: 7 additions & 0 deletions examples/freertos_plus_tcp/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "FreeRTOS.h"

#if Z_FEATURE_PUBLICATION == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -72,3 +73,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -2;
}
#endif
7 changes: 7 additions & 0 deletions examples/freertos_plus_tcp/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <zenoh-pico.h>

#if Z_FEATURE_PUBLICATION == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -77,3 +78,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -2;
}
#endif
7 changes: 7 additions & 0 deletions examples/freertos_plus_tcp/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -89,3 +90,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -2;
}
#endif
6 changes: 6 additions & 0 deletions examples/freertos_plus_tcp/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -2;
}
#endif
6 changes: 6 additions & 0 deletions examples/freertos_plus_tcp/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,9 @@ void app_main() {

z_close(z_move(s));
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -2;
}
#endif

0 comments on commit 9e86cbb

Please sign in to comment.