Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
LPC2368/if/eth/EthernetNetIf.h@0:7f26f0680202, 2010-12-31 (annotated)
- Committer:
- networker
- Date:
- Fri Dec 31 14:01:14 2010 +0000
- Revision:
- 0:7f26f0680202
initial release: comprises ftlib (no usb), ft-over-ip socket server, and the http server (the html page and java jar I still have to publish somewhere)
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 | /** \file |
networker | 0:7f26f0680202 | 25 | Ethernet network interface header file |
networker | 0:7f26f0680202 | 26 | */ |
networker | 0:7f26f0680202 | 27 | |
networker | 0:7f26f0680202 | 28 | #ifndef ETHERNETNETIF_H |
networker | 0:7f26f0680202 | 29 | #define ETHERNETNETIF_H |
networker | 0:7f26f0680202 | 30 | |
networker | 0:7f26f0680202 | 31 | struct netif; |
networker | 0:7f26f0680202 | 32 | |
networker | 0:7f26f0680202 | 33 | #include "mbed.h" |
networker | 0:7f26f0680202 | 34 | |
networker | 0:7f26f0680202 | 35 | #include "if/lwip/LwipNetIf.h" |
networker | 0:7f26f0680202 | 36 | |
networker | 0:7f26f0680202 | 37 | ///Ethernet network interface return codes |
networker | 0:7f26f0680202 | 38 | enum EthernetErr |
networker | 0:7f26f0680202 | 39 | { |
networker | 0:7f26f0680202 | 40 | __ETH_MIN = -0xFFFF, |
networker | 0:7f26f0680202 | 41 | ETH_TIMEOUT, ///<Timeout during setup |
networker | 0:7f26f0680202 | 42 | ETH_OK = 0 ///<Success |
networker | 0:7f26f0680202 | 43 | }; |
networker | 0:7f26f0680202 | 44 | |
networker | 0:7f26f0680202 | 45 | ///Ethernet network interface |
networker | 0:7f26f0680202 | 46 | /** |
networker | 0:7f26f0680202 | 47 | This class provides Ethernet connectivity to the stack |
networker | 0:7f26f0680202 | 48 | */ |
networker | 0:7f26f0680202 | 49 | class EthernetNetIf : public LwipNetIf |
networker | 0:7f26f0680202 | 50 | { |
networker | 0:7f26f0680202 | 51 | public: |
networker | 0:7f26f0680202 | 52 | ///Instantiates the Interface and register it against the stack, DHCP will be used |
networker | 0:7f26f0680202 | 53 | EthernetNetIf(); //W/ DHCP |
networker | 0:7f26f0680202 | 54 | |
networker | 0:7f26f0680202 | 55 | ///Instantiates the Interface and register it against the stack, DHCP will not be used |
networker | 0:7f26f0680202 | 56 | /** |
networker | 0:7f26f0680202 | 57 | IpAddr is a container class that can be constructed with either 4 bytes or no parameters for a null IP address. |
networker | 0:7f26f0680202 | 58 | */ |
networker | 0:7f26f0680202 | 59 | EthernetNetIf(IpAddr ip, IpAddr netmask, IpAddr gateway, IpAddr dns); //W/o DHCP |
networker | 0:7f26f0680202 | 60 | virtual ~EthernetNetIf(); |
networker | 0:7f26f0680202 | 61 | |
networker | 0:7f26f0680202 | 62 | ///Brings the interface up |
networker | 0:7f26f0680202 | 63 | /** |
networker | 0:7f26f0680202 | 64 | Uses DHCP if necessary |
networker | 0:7f26f0680202 | 65 | @param timeout_ms : You can set the timeout parameter in milliseconds, if not it defaults to 15s |
networker | 0:7f26f0680202 | 66 | @return : ETH_OK on success or ETH_TIMEOUT on timeout |
networker | 0:7f26f0680202 | 67 | */ |
networker | 0:7f26f0680202 | 68 | EthernetErr setup(int timeout_ms = 15000); |
networker | 0:7f26f0680202 | 69 | |
networker | 0:7f26f0680202 | 70 | virtual void poll(); |
networker | 0:7f26f0680202 | 71 | |
networker | 0:7f26f0680202 | 72 | private: |
networker | 0:7f26f0680202 | 73 | Timer m_ethArpTimer; |
networker | 0:7f26f0680202 | 74 | Timer m_dhcpCoarseTimer; |
networker | 0:7f26f0680202 | 75 | Timer m_dhcpFineTimer; |
networker | 0:7f26f0680202 | 76 | Timer m_igmpTimer; |
networker | 0:7f26f0680202 | 77 | |
networker | 0:7f26f0680202 | 78 | bool m_useDhcp; |
networker | 0:7f26f0680202 | 79 | |
networker | 0:7f26f0680202 | 80 | netif* m_pNetIf; |
networker | 0:7f26f0680202 | 81 | |
networker | 0:7f26f0680202 | 82 | IpAddr m_netmask; |
networker | 0:7f26f0680202 | 83 | IpAddr m_gateway; |
networker | 0:7f26f0680202 | 84 | |
networker | 0:7f26f0680202 | 85 | const char* m_hostname; |
networker | 0:7f26f0680202 | 86 | |
networker | 0:7f26f0680202 | 87 | }; |
networker | 0:7f26f0680202 | 88 | |
networker | 0:7f26f0680202 | 89 | #endif |
networker | 0:7f26f0680202 | 90 |