#include #include #include #include #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; }