sock_result_t socket_accept(sock_handle_t handle) { TCPServer* server = servers.from(handle); if (!server) return socket_handle_invalid(); return server->accept(); }
sock_handle_t accept() { sock_handle_t handle = next_unused_tcp(); if (!socket_handle_valid(handle)) return handle; ip::tcp::socket& sock = tcp_from(handle); acceptor.accept(sock, ec); return !ec ? handle : socket_handle_invalid(); }
#include <stdio.h> #include <stdint.h> #define IPNUM(ip) ((ip)>>24)&0xff,((ip)>>16)&0xff,((ip)>> 8)&0xff,((ip)>> 0)&0xff #ifndef SPARK_NO_CLOUD int userVarType(const char *varKey); const void *getUserVar(const char *varKey); int userFuncSchedule(const char *funcKey, const char *paramString, SparkDescriptor::FunctionResultCallback callback, void* reserved); static int finish_ota_firmware_update(FileTransfer::Descriptor& file, uint32_t flags, void* module); static void formatResetReasonEventData(int reason, uint32_t data, char *buf, size_t size); static sock_handle_t sparkSocket = socket_handle_invalid(); extern uint8_t LED_RGB_BRIGHTNESS; // LED_Signaling_Override volatile uint8_t LED_Spark_Signal; const uint32_t VIBGYOR_Colors[] = { 0xEE82EE, 0x4B0082, 0x0000FF, 0x00FF00, 0xFFFF00, 0xFFA500, 0xFF0000 }; const int VIBGYOR_Size = sizeof (VIBGYOR_Colors) / sizeof (uint32_t); int VIBGYOR_Index; ProtocolFacade* sp; /** * This is necessary since spark_protocol_instance() was defined in both system_cloud