543 static void task_HTTPserver(void* pvParameters) |
543 static void task_HTTPserver(void* pvParameters) |
544 { |
544 { |
545 struct netconn *conn, *newconn; |
545 struct netconn *conn, *newconn; |
546 static err_t err; |
546 static err_t err; |
547 |
547 |
548 ESP_LOGI(TAG, "Starting http server_task"); |
548 ESP_LOGI(TAG, "Start http server_task"); |
549 client_queue = xQueueCreate(client_queue_size,sizeof(struct netconn*)); |
549 client_queue = xQueueCreate(client_queue_size,sizeof(struct netconn*)); |
550 |
550 |
551 conn = netconn_new(NETCONN_TCP); |
551 conn = netconn_new(NETCONN_TCP); |
552 netconn_bind(conn,NULL,80); |
552 netconn_bind(conn,NULL,80); |
553 netconn_listen(conn); |
553 netconn_listen(conn); |
575 */ |
575 */ |
576 static void task_Queue(void* pvParameters) |
576 static void task_Queue(void* pvParameters) |
577 { |
577 { |
578 struct netconn* conn; |
578 struct netconn* conn; |
579 |
579 |
580 ESP_LOGI(TAG, "Starting Queue task"); |
580 ESP_LOGI(TAG, "Start Queue task"); |
581 for(;;) { |
581 for(;;) { |
582 xQueueReceive(client_queue, &conn, portMAX_DELAY); |
582 xQueueReceive(client_queue, &conn, portMAX_DELAY); |
583 if (!conn) |
583 if (!conn) |
584 continue; |
584 continue; |
585 http_serve(conn); |
585 http_serve(conn); |
591 |
591 |
592 |
592 |
593 |
593 |
594 void start_http_websocket(void) |
594 void start_http_websocket(void) |
595 { |
595 { |
596 ESP_LOGI(TAG, "Starting HTTP/Websocket server"); |
596 ESP_LOGI(TAG, "Start HTTP/Websocket server"); |
597 |
597 |
598 ws_server_start(); |
598 ws_server_start(); |
599 xTaskCreate(&task_HTTPserver, "HTTPserver", 3000, NULL, 9, &xTaskHTTP); |
599 xTaskCreate(&task_HTTPserver, "HTTPserver", 3000, NULL, 9, &xTaskHTTP); |
600 xTaskCreate(&task_Queue, "Queue", 4000, NULL, 6, &xTaskQueue); |
600 xTaskCreate(&task_Queue, "Queue", 4000, NULL, 6, &xTaskQueue); |
601 } |
601 } |