This commit is contained in:
2026-06-11 13:18:05 +03:00
parent 5da12de147
commit 1bcec8972c
5 changed files with 271 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include "api.h"
int main() {
void* thread_handle;
start_api(&thread_handle);
char* command;
while(1) {
// Clear buffer
command = get_command();
printf("Recieved: %s\n", command);
if (cmp(command, "ping")) {
send_reply("pong");
printf("Sended: pong\n");
}
else if (cmp(command, "hello")) {
send_reply("hi!");
printf("Sended: hello\n");
}
else {
send_reply("Unknown command.");
printf("Sended: Unknown command.\n");
}
sleep(0.01);
}
stop_api(thread_handle);
return 0;
}