-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Labels
bugSomething isn't workingSomething isn't workingresolvedthe issue was resolvedthe issue was resolved
Description
Hi. This might be more of a programming question again but...
Something like this works:
void delete_all_faces() {
delete_face_all_in_flash_with_name(&st_face_list);
}
void handle_message(WebsocketsMessage msg) {
if (msg.data() == "delete_all") {
delete_all_faces();
g_state = DELETE_ALL;
}
}
void loop() {
auto client = socket_server.accept();
client.onMessage(handle_message);
while (client.available()) {
client.poll();
switch (g_state) {
case DELETE_ALL:
client.send("All Faces Deleted");
break;
case ...
}
}
}
But I would prefer to send the message from the delete_all_faces function something like this...
void delete_all_faces() {
delete_face_all_in_flash_with_name(&st_face_list);
client.send("All Faces Deleted");
}
void handle_message(WebsocketsMessage msg) {
if (msg.data() == "delete_all") {
delete_all_faces();
}
}
void loop() {
auto client = socket_server.accept();
client.onMessage(handle_message);
while (client.available()) {
...
}
}
Is it possible to make 'client' accessible outside the loop?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingresolvedthe issue was resolvedthe issue was resolved