|
|
@@ -3621,47 +3621,11 @@ static int webSetCallback(void)
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void read_ipaddr(web_handle_t *h)
|
|
|
-{
|
|
|
- sprintf(h->wpath,"ws://%s:6785", getLocalIpAddress("eth0"));
|
|
|
- printf("____ ws path: %s\n", h->wpath);
|
|
|
-}
|
|
|
-
|
|
|
int appweb_init(void)
|
|
|
{
|
|
|
- web_handle_t *wh=&webHandle;
|
|
|
-
|
|
|
- if (pthread_mutex_init(&WSlock, NULL) != 0) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- read_ipaddr(wh);
|
|
|
-
|
|
|
thread_start(THREAD_ID_UPDATE, update_thread, &__globalDeviceManage, 20*MB, 0);
|
|
|
thread_start(THREAD_ID_WEB, web_thread, &__globalDeviceManage, 16*MB, 0);
|
|
|
- wh->inited = 1;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-int websocket_send(void *data, int len)
|
|
|
-{
|
|
|
- int i;
|
|
|
- web_handle_t *wh=&webHandle;
|
|
|
-
|
|
|
- if(!wh->inited) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- pthread_mutex_lock(&WSlock);
|
|
|
- mg_ws_send(wh->c, data, len, WEBSOCKET_OP_TEXT);
|
|
|
- pthread_mutex_unlock(&WSlock);
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-int websocket_isok(void)
|
|
|
-{
|
|
|
- web_handle_t *wh=&webHandle;
|
|
|
- return (wh->c)?1:0;
|
|
|
-}
|