#pragma once #include #include #include #if defined(GEKKO) && !defined(USE_WIISOCKET) #include #define net_recvfrom recvfrom #define net_sendto sendto #define net_bind bind #define net_close close #define net_setsockopt setsockopt #define net_socket socket #else #include #include #include #endif #define BROADCAST_DEFAULT_PORT 6942 typedef struct { char* name; char* url; struct sockaddr addr; socklen_t addrlen; void* user; } broadcast_device_t; typedef struct { bool toSend; struct sockaddr addr; socklen_t addrlen; char* serviceName; char* serviceUrl; char* deviceName; } broadcast_server_ctx_t; typedef bool (*broadcast_sleep_t)(void* user,int times); typedef void (*broadcast_client_device_t)(broadcast_device_t* dev); typedef void (*broadcast_server_cb_t)(broadcast_server_ctx_t* ctx); char* broadcast_fromconst(const char* text); void broadcast_client(const char* serviceName,uint16_t port,void* user,broadcast_sleep_t sleepcb,broadcast_client_device_t deviceCb); void broadcast_server(broadcast_server_cb_t cb,uint16_t port);