|
@@ -1,17 +1,22 @@ |
|
|
#include "IZ_app_net.h" |
|
|
#include "IZ_app_net.h" |
|
|
|
|
|
|
|
|
void IZ_AppHandleNetworkingInboundBinaryEvents(struct IZ_App* app, void* binary_raw, size_t len) { |
|
|
void IZ_AppHandleNetworkingInboundBinaryEvents(struct IZ_App* app, void* binary_raw, size_t len) { |
|
|
|
|
|
if (len < 1) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
u8* binary = binary_raw; |
|
|
u8* binary = binary_raw; |
|
|
size_t i; |
|
|
size_t i; |
|
|
printf("%lu: Binary", IZ_AppGetTicks(app)); |
|
|
|
|
|
for (i = 0; i < len; i += 1) { |
|
|
|
|
|
printf("%c%02x", i == 0 ? '(' : ' ', binary[i]); |
|
|
|
|
|
|
|
|
char binary_string[len * 3 + 1]; |
|
|
|
|
|
IZ_memset(binary_string, 0, len * 3 + 1); |
|
|
|
|
|
sprintf(binary_string, "%02x", binary[0]); |
|
|
|
|
|
for (i = 1; i < len; i += 1) { |
|
|
|
|
|
sprintf(binary_string, "%s %02x", binary_string, binary[i]); |
|
|
} |
|
|
} |
|
|
printf(")\n"); |
|
|
|
|
|
|
|
|
IZ_LogInfo(IZ_LOG_CATEGORY_INPUT, "net/ws", "Received binary(length: %d): %s", len, binary_string); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void IZ_AppHandleNetworkingInboundTextEvents(struct IZ_App* app, const char* text, size_t len) { |
|
|
void IZ_AppHandleNetworkingInboundTextEvents(struct IZ_App* app, const char* text, size_t len) { |
|
|
printf("%lu: String(%s)\n", IZ_AppGetTicks(app), text); |
|
|
|
|
|
|
|
|
IZ_LogInfo(IZ_LOG_CATEGORY_INPUT, "net/ws", "Received string(length: %d): %s", len, text); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void IZ_AppHandleOutboundNetworking(struct IZ_App* app) { |
|
|
void IZ_AppHandleOutboundNetworking(struct IZ_App* app) { |
|
|