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

Add query & queryable token config #260

Merged
merged 16 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions examples/arduino/z_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <WiFi.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERY == 1
// WiFi-specific parameters
#define SSID "SSID"
#define PASS "PASS"
Expand Down Expand Up @@ -118,3 +119,9 @@ void loop() {
Serial.println("Unable to send query.");
}
}
#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.");
}
void loop() {}
#endif
8 changes: 8 additions & 0 deletions examples/arduino/z_queryable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <WiFi.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
// WiFi-specific parameters
#define SSID "SSID"
#define PASS "PASS"
Expand Down Expand Up @@ -106,3 +107,10 @@ void setup() {
}

void loop() { delay(5000); }

#else
void setup() {
Serial.println("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.");
}
void loop() {}
#endif
4 changes: 4 additions & 0 deletions examples/espidf/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERY == 1
#define ESP_WIFI_SSID "SSID"
#define ESP_WIFI_PASS "PASS"
#define ESP_MAXIMUM_RETRY 5
Expand Down Expand Up @@ -172,3 +173,6 @@ void app_main() {
z_close(z_move(s));
printf("OK!\n");
}
#else
void app_main() { printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n"); }
#endif
6 changes: 6 additions & 0 deletions examples/espidf/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define ESP_MAXIMUM_RETRY 5
#define WIFI_CONNECTED_BIT BIT0

#if Z_FEATURE_QUERYABLE == 1
static bool s_is_wifi_connected = false;
static EventGroupHandle_t s_event_group_handler;
static int s_retry_count = 0;
Expand Down Expand Up @@ -171,3 +172,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_QUERYABLE but this example requires it.\n");
}
#endif
7 changes: 7 additions & 0 deletions examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <randLIB.h>
#include <zenoh-pico.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 @@ -94,3 +95,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/mbed/z_queryable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <randLIB.h>
#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 @@ -94,3 +95,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/unix/c11/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERY == 1
void reply_dropper(void *ctx) {
(void)(ctx);
printf(">> Received query final notification\n");
Expand Down Expand Up @@ -129,3 +130,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/unix/c11/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
const char *keyexpr = "demo/example/zenoh-pico-queryable";
const char *value = "Queryable from Pico!";

Expand Down Expand Up @@ -124,3 +125,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/unix/c99/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERY == 1
void reply_dropper(void *ctx) {
(void)(ctx);
printf(">> Received query final notification\n");
Expand Down Expand Up @@ -129,3 +130,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/unix/c99/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <unistd.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
const char *keyexpr = "demo/example/zenoh-pico-queryable";
const char *value = "Queryable from Pico!";

Expand Down Expand Up @@ -120,3 +121,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/windows/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdlib.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERY == 1
void reply_dropper(void *ctx) {
(void)(ctx);
printf(">> Received query final notification\n");
Expand Down Expand Up @@ -94,3 +95,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/windows/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdlib.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
const char *keyexpr = "demo/example/zenoh-pico-queryable";
const char *value = "Queryable from Pico!";

Expand Down Expand Up @@ -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_QUERYABLE but this example requires it.\n");
return -1;
}
#endif
7 changes: 7 additions & 0 deletions examples/zephyr/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <unistd.h>
#include <zenoh-pico.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 @@ -88,3 +89,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
}
#endif
Loading
Loading