Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
LPC1768/core/net.h@1:2c9d412ad471, 2011-05-04 (annotated)
- Committer:
- networker
- Date:
- Wed May 04 15:42:13 2011 +0000
- Revision:
- 1:2c9d412ad471
- Parent:
- 0:7f26f0680202
first publication (mbed challenge submission)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
networker | 0:7f26f0680202 | 1 | |
networker | 0:7f26f0680202 | 2 | /* |
networker | 0:7f26f0680202 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
networker | 0:7f26f0680202 | 4 | |
networker | 0:7f26f0680202 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
networker | 0:7f26f0680202 | 6 | of this software and associated documentation files (the "Software"), to deal |
networker | 0:7f26f0680202 | 7 | in the Software without restriction, including without limitation the rights |
networker | 0:7f26f0680202 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
networker | 0:7f26f0680202 | 9 | copies of the Software, and to permit persons to whom the Software is |
networker | 0:7f26f0680202 | 10 | furnished to do so, subject to the following conditions: |
networker | 0:7f26f0680202 | 11 | |
networker | 0:7f26f0680202 | 12 | The above copyright notice and this permission notice shall be included in |
networker | 0:7f26f0680202 | 13 | all copies or substantial portions of the Software. |
networker | 0:7f26f0680202 | 14 | |
networker | 0:7f26f0680202 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
networker | 0:7f26f0680202 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
networker | 0:7f26f0680202 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
networker | 0:7f26f0680202 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
networker | 0:7f26f0680202 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
networker | 0:7f26f0680202 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
networker | 0:7f26f0680202 | 21 | THE SOFTWARE. |
networker | 0:7f26f0680202 | 22 | */ |
networker | 0:7f26f0680202 | 23 | |
networker | 0:7f26f0680202 | 24 | #ifndef NET_H |
networker | 0:7f26f0680202 | 25 | #define NET_H |
networker | 0:7f26f0680202 | 26 | |
networker | 0:7f26f0680202 | 27 | class NetIf; |
networker | 0:7f26f0680202 | 28 | class NetTcpSocket; |
networker | 0:7f26f0680202 | 29 | class NetUdpSocket; |
networker | 0:7f26f0680202 | 30 | class NetDnsRequest; |
networker | 0:7f26f0680202 | 31 | |
networker | 0:7f26f0680202 | 32 | #include <list> |
networker | 0:7f26f0680202 | 33 | using std::list; |
networker | 0:7f26f0680202 | 34 | |
networker | 0:7f26f0680202 | 35 | /* |
networker | 0:7f26f0680202 | 36 | #include "host.h" |
networker | 0:7f26f0680202 | 37 | #include "ipaddr.h" |
networker | 0:7f26f0680202 | 38 | #include "netservice.h" |
networker | 0:7f26f0680202 | 39 | #include "if/net/netif.h" |
networker | 0:7f26f0680202 | 40 | #include "if/net/nettcpsocket.h" |
networker | 0:7f26f0680202 | 41 | #include "if/net/netudpsocket.h" |
networker | 0:7f26f0680202 | 42 | #include "if/net/netdnsrequest.h" |
networker | 0:7f26f0680202 | 43 | */ |
networker | 0:7f26f0680202 | 44 | |
networker | 0:7f26f0680202 | 45 | class Host; |
networker | 0:7f26f0680202 | 46 | class NetIf; |
networker | 0:7f26f0680202 | 47 | class NetTcpSocket; |
networker | 0:7f26f0680202 | 48 | class NetUdpSocket; |
networker | 0:7f26f0680202 | 49 | class NetDnsRequest; |
networker | 0:7f26f0680202 | 50 | |
networker | 0:7f26f0680202 | 51 | class Net |
networker | 0:7f26f0680202 | 52 | { |
networker | 0:7f26f0680202 | 53 | private: |
networker | 0:7f26f0680202 | 54 | Net(); |
networker | 0:7f26f0680202 | 55 | ~Net(); |
networker | 0:7f26f0680202 | 56 | public: |
networker | 0:7f26f0680202 | 57 | static void poll(); //Poll every if & socket |
networker | 0:7f26f0680202 | 58 | |
networker | 0:7f26f0680202 | 59 | static NetTcpSocket* tcpSocket(NetIf& netif); |
networker | 0:7f26f0680202 | 60 | static NetTcpSocket* tcpSocket(); //Socket on default if |
networker | 0:7f26f0680202 | 61 | static void releaseTcpSocket(NetTcpSocket* pNetTcpSocket); |
networker | 0:7f26f0680202 | 62 | |
networker | 0:7f26f0680202 | 63 | static NetUdpSocket* udpSocket(NetIf& netif); |
networker | 0:7f26f0680202 | 64 | static NetUdpSocket* udpSocket(); //Socket on default if |
networker | 0:7f26f0680202 | 65 | static void releaseUdpSocket(NetUdpSocket* pNetUdpSocket); |
networker | 0:7f26f0680202 | 66 | |
networker | 0:7f26f0680202 | 67 | static NetDnsRequest* dnsRequest(const char* hostname, NetIf& netif); |
networker | 0:7f26f0680202 | 68 | static NetDnsRequest* dnsRequest(const char* hostname); //Create a new NetDnsRequest object from default if |
networker | 0:7f26f0680202 | 69 | |
networker | 0:7f26f0680202 | 70 | static NetDnsRequest* dnsRequest(Host* pHost, NetIf& netif); |
networker | 0:7f26f0680202 | 71 | static NetDnsRequest* dnsRequest(Host* pHost); //Create a new NetDnsRequest object from default if |
networker | 0:7f26f0680202 | 72 | |
networker | 0:7f26f0680202 | 73 | static void setDefaultIf(NetIf& netif); //Deprecated |
networker | 0:7f26f0680202 | 74 | static void setDefaultIf(NetIf* pIf); |
networker | 0:7f26f0680202 | 75 | static NetIf* getDefaultIf(); |
networker | 0:7f26f0680202 | 76 | |
networker | 0:7f26f0680202 | 77 | protected: |
networker | 0:7f26f0680202 | 78 | friend class NetIf; |
networker | 0:7f26f0680202 | 79 | friend class NetTcpSocket; |
networker | 0:7f26f0680202 | 80 | friend class NetUdpSocket; |
networker | 0:7f26f0680202 | 81 | |
networker | 0:7f26f0680202 | 82 | static void registerIf(NetIf* pIf); |
networker | 0:7f26f0680202 | 83 | static void unregisterIf(NetIf* pIf); |
networker | 0:7f26f0680202 | 84 | |
networker | 0:7f26f0680202 | 85 | static void registerNetTcpSocket(NetTcpSocket* pNetTcpSocket); |
networker | 0:7f26f0680202 | 86 | static void unregisterNetTcpSocket(NetTcpSocket* pNetTcpSocket); |
networker | 0:7f26f0680202 | 87 | |
networker | 0:7f26f0680202 | 88 | static void registerNetUdpSocket(NetUdpSocket* pNetUdpSocket); |
networker | 0:7f26f0680202 | 89 | static void unregisterNetUdpSocket(NetUdpSocket* pNetUdpSocket); |
networker | 0:7f26f0680202 | 90 | |
networker | 0:7f26f0680202 | 91 | private: |
networker | 0:7f26f0680202 | 92 | static Net& net(); //Return inst of singleton |
networker | 0:7f26f0680202 | 93 | |
networker | 0:7f26f0680202 | 94 | NetIf* m_defaultIf; |
networker | 0:7f26f0680202 | 95 | |
networker | 0:7f26f0680202 | 96 | list<NetIf*> m_lpIf; |
networker | 0:7f26f0680202 | 97 | list<NetTcpSocket*> m_lpNetTcpSocket; |
networker | 0:7f26f0680202 | 98 | list<NetUdpSocket*> m_lpNetUdpSocket; |
networker | 0:7f26f0680202 | 99 | }; |
networker | 0:7f26f0680202 | 100 | |
networker | 0:7f26f0680202 | 101 | #endif |