|
|
@@ -22,6 +22,8 @@ static err_t tcp_recv_handle(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err
|
|
|
static void tcp_close_conn(struct tcp_pcb *pcb);
|
|
|
err_t tcp_send_data(struct tcp_pcb *pcb, struct pbuf *p);
|
|
|
|
|
|
+static udp_pcb *gui_udp_pcb;
|
|
|
+
|
|
|
void lwip_device_init(void)
|
|
|
{
|
|
|
unsigned char macArray[6] = MAC_ADDRESS;
|
|
|
@@ -35,6 +37,8 @@ void lwip_device_init(void)
|
|
|
ConsolePrintf("lwIP HostIP:%d.%d.%d.%d\n", (ipAddr >> (0 * 8)) & 0xFF,
|
|
|
(ipAddr >> (1 * 8)) & 0xFF, (ipAddr >> (2 * 8)) & 0xFF,
|
|
|
(ipAddr >> (3 * 8)) & 0xFF);
|
|
|
+
|
|
|
+ gui_udp_pcb = udp_new();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -182,3 +186,16 @@ void lwip_udp_sendto(struct udp_pcb *pcb, unsigned int ip,int port,unsigned char
|
|
|
udp_sendto(pcb,pbuf,&ip_dst,port);
|
|
|
pbuf_free(pbuf);
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * udp Ïògui·¢ËÍÊý¾Ý
|
|
|
+ */
|
|
|
+void lwip_udp_send_gui(unsigned char* data,int len)
|
|
|
+{
|
|
|
+ struct ip_addr ip_dst;
|
|
|
+ ip_dst.addr = htonl(UI_IP_ADDRESS);
|
|
|
+ struct pbuf* pbuf = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct pbuf), PBUF_REF);
|
|
|
+ pbuf->payload = data;
|
|
|
+ udp_sendto(gui_udp_pcb,pbuf,&ip_dst,UI_UDP_PORT);
|
|
|
+ pbuf_free(pbuf);
|
|
|
+}
|