Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MyNetIf.cpp
00001 // MyNetIf.cpp 2012/4/17 00002 #include "mbed.h" 00003 #include "MyNetIf.h" 00004 #include "MyNetTcpSocket.h" 00005 #include "MyNetUdpSocket.h" 00006 #include "MyNetDnsRequest.h" 00007 00008 //#define DEBUG 00009 00010 #ifdef DEBUG 00011 #include "w5100.h" 00012 #include "Utils.h" 00013 #define PRINT_FUNC() printf("%p %d:%s\n", this,__LINE__,__PRETTY_FUNCTION__) 00014 #else //DEBUG 00015 #define PRINT_FUNC() 00016 #endif //DEBUG 00017 00018 MyNetIf::MyNetIf() : NetIf(), m_init(false) 00019 { 00020 PRINT_FUNC(); 00021 } 00022 00023 MyNetIf::~MyNetIf() { 00024 PRINT_FUNC(); 00025 } 00026 00027 void MyNetIf::init() { 00028 PRINT_FUNC(); 00029 } 00030 00031 NetTcpSocket* MyNetIf::tcpSocket() { 00032 PRINT_FUNC(); 00033 return new MyNetTcpSocket(); 00034 } 00035 00036 NetUdpSocket* MyNetIf::udpSocket() { 00037 PRINT_FUNC(); 00038 return new MyNetUdpSocket(); 00039 } 00040 00041 NetDnsRequest* MyNetIf::dnsRequest(const char* hostname) { 00042 PRINT_FUNC(); 00043 return new MyNetDnsRequest(hostname); 00044 } 00045 00046 NetDnsRequest* MyNetIf::dnsRequest(Host* pHost) { 00047 PRINT_FUNC(); 00048 return new MyNetDnsRequest(pHost); 00049 } 00050 00051 void MyNetIf::poll() { 00052 PRINT_FUNC(); 00053 #ifdef DEBUG 00054 printf("SnMR:"); 00055 for(int s = 0; s < MAX_SOCK_NUM; s++) { 00056 printf(" %02x", W5100.readSnMR(s)); 00057 } 00058 printf("\n"); 00059 00060 printf("SnIR:"); 00061 for(int s = 0; s < MAX_SOCK_NUM; s++) { 00062 printf(" %02x", W5100.readSnIR(s)); 00063 } 00064 printf("\n"); 00065 00066 printf("SnSR:"); 00067 for(int s = 0; s < MAX_SOCK_NUM; s++) { 00068 printf(" %02x", W5100.readSnSR(s)); 00069 } 00070 printf("\n"); 00071 00072 printf("SnPORT:"); 00073 for(int s = 0; s < MAX_SOCK_NUM; s++) { 00074 printf(" %d", W5100.readSnPORT(s)); 00075 } 00076 printf("\n"); 00077 00078 wait_ms(500); 00079 #endif //DEBUG 00080 }
Generated on Tue Jul 12 2022 19:58:52 by
1.7.2