OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / projects / example / sample.net.udp / src / sketch.c
index d4544ce..43f3e0e 100644 (file)
@@ -5,7 +5,7 @@
 #include "boot/sketch.h"\r
 \r
 #include "NyLPC_net.h"\r
-#include "NyLPC_uipService.h"\r
+#include "../netif/mimicip/NyLPC_cMiMicIpNetIf.h"\r
 #include "NyLPC_http.h"\r
 #include "NyLPC_utils.h"\r
 #include <stdio.h>\r
 /**\r
  * UDP loopback test\r
  */\r
-NyLPC_TcNet_t net;\r
-NyLPC_TcUdpSocket_t udp;\r
-char buf[512];\r
+const struct NyLPC_TiNetInterface_Interface* netif;\r
+NyLPC_TiUdpSocket_t* udp;\r
 void setup(void)\r
 {\r
        //uipサービス初期化。いろいろ利用可能に。\r
-       NyLPC_cNet_initialize(&net);\r
-       NyLPC_cUdpSocket_initialize(&udp,9999,buf,512);\r
+       netif=NyLPC_cMiMicIpNetIf_getNetInterface();\r
+       NyLPC_cNet_initialize(netif);\r
+       udp=NyLPC_cNet_createUdpSocketEx(9999,NyLPC_TSocketType_UDP_NORMAL);\r
 }\r
 \r
 \r
@@ -36,13 +36,13 @@ void loop(void)
        NyLPC_cNetConfig_initialize(&c2,NyLPC_TBool_TRUE);\r
        NyLPC_cNetConfig_setIpAddr(&c2,192,168,128,39);\r
        NyLPC_cNetConfig_setGateway(&c2,192,168,128,254);\r
-       NyLPC_cNet_start(&net,&c2);\r
+       NyLPC_cNet_start(&(c2.super));\r
        for(;;)\r
        {\r
-               rs=NyLPC_cUdpSocket_precv(&udp,&b,&info,1000);\r
+               rs=NyLPC_iUdpSocket_precv(udp,&b,&info,1000);\r
                if(rs>0){\r
-                       NyLPC_cUdpSocket_send(&udp,&info->peer_ip,info->peer_port,b,rs,1000);\r
-                       NyLPC_cUdpSocket_pseek(&udp);\r
+                       NyLPC_iUdpSocket_send(udp,&info->peer_ip,info->peer_port,b,rs,1000);\r
+                       NyLPC_iUdpSocket_pseek(udp);\r
                }\r
        }\r
 }\r