Added messaging from browser to server, tap handling, improved resize on clientside

This commit is contained in:
2017-01-24 01:37:26 +01:00
parent 5c948b079b
commit ca93a3b90d
9 changed files with 140 additions and 94 deletions
+1 -1
View File
@@ -579,7 +579,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
ss->lastFg = 0;
ss->lastChar = '\0';
bufprint("{\"x\":%d,\"y\":%d,\"screen\":\"", cursor.x, cursor.y);
bufprint("{\"w\":%d,\"h\":%d,\"x\":%d,\"y\":%d,\"screen\":\"", W, H, cursor.x, cursor.y);
}
int i = ss->index;
+10 -4
View File
@@ -32,7 +32,7 @@ void screen_notifyChange() {
void *data = NULL;
const int bufsiz = 1024;
const int bufsiz = 256;
char buff[bufsiz];
for (int i = 0; i < 20; i++) {
httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &data);
@@ -41,9 +41,14 @@ void screen_notifyChange() {
}
}
void myWebsocketRecv(Websock *ws, char *data, int len, int flags) {
dbg("Sock RX str: %s, len %d", data, len);
}
/** Socket connected for updates */
void ICACHE_FLASH_ATTR myWebsocketConnect(Websock *ws) {
dbg("Socket connected.");
ws->recvCb=myWebsocketRecv;
}
/**
@@ -61,7 +66,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
return HTTPD_CGI_DONE;
}
const int bufsiz = 1024;
const int bufsiz = 256;
char buff[bufsiz];
if (streq(token, "screenData")) {
@@ -118,8 +123,9 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) {
static int led = 0;
static unsigned int cnt = 0;
if (cnt%3==0) {
os_printf("Free heap: %ld bytes\n", (unsigned long) system_get_free_heap_size());
if (cnt==5) {
dbg("HEAP: %ld bytes free", (unsigned long) system_get_free_heap_size());
cnt = 0;
}
//cgiWebsockBroadcast("/ws/update.cgi", "HELLO", 5, WEBSOCK_FLAG_NONE);