void ethernet_websocket_close_frame(const WebsocketFrame *wsf, const uint8_t socket) {
	uint8_t length = wsf->payload_length;
	uint8_t tmp_buffer[length];
	while(length > 0) {
		length -= ethernet_low_level_read_data_tcp(socket, tmp_buffer, length);
	}
	ethernet_low_level_disconnect(socket);
	brickd_disconnect(socket);

	ethernet_low_level_socket_init(socket);
	ethernet_low_level_socket_listen(socket);
	brickd_disconnect(socket);
}
void ICACHE_FLASH_ATTR tfp_disconnect_callback(void *arg) {
	espconn *con = (espconn *)arg;
	TFPConnection *tfp_con = (TFPConnection *)con->reverse;

	brickd_disconnect(tfp_con->cid);

	tfp_init_con(tfp_con->cid);

	logd("tfp_disconnect_callback: cid %d\n", tfp_con->cid);
}
Esempio n. 3
0
void wifi_data_disconnect(const uint8_t cid) {
	if(cid > 0 && cid < 16) {
		if(brickd_authentication_state[cid] != BRICKD_AUTHENTICATION_STATE_DISABLED) {
			brickd_authentication_state[cid] = BRICKD_AUTHENTICATION_STATE_ENABLED;
		}

		wifi_data_cid_present[cid] = false;
		brickd_disconnect(cid);
	}
}
void ICACHE_FLASH_ATTR tfp_reconnect_callback(void *arg, sint8 error) {
	espconn *con = (espconn *)arg;
	TFPConnection *tfp_con = (TFPConnection *)con->reverse;

	brickd_disconnect(tfp_con->cid);

	tfp_init_con(tfp_con->cid);

	if(error == ESPCONN_TIMEOUT) {
		// espconn_disconnect(arg);
	}

	logd("tfp_reconnect_callback: cid %d -> %d\n", tfp_con->cid, error);
}