Xbee test 2

Dependencies:   XBee mbed

Committer:
takashiyamanoue
Date:
Sat Jul 21 04:08:27 2012 +0000
Revision:
0:ffac63d6a7f0
xbee test 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takashiyamanoue 0:ffac63d6a7f0 1
takashiyamanoue 0:ffac63d6a7f0 2 /*
takashiyamanoue 0:ffac63d6a7f0 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
takashiyamanoue 0:ffac63d6a7f0 4
takashiyamanoue 0:ffac63d6a7f0 5 Permission is hereby granted, free of charge, to any person obtaining a copy
takashiyamanoue 0:ffac63d6a7f0 6 of this software and associated documentation files (the "Software"), to deal
takashiyamanoue 0:ffac63d6a7f0 7 in the Software without restriction, including without limitation the rights
takashiyamanoue 0:ffac63d6a7f0 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
takashiyamanoue 0:ffac63d6a7f0 9 copies of the Software, and to permit persons to whom the Software is
takashiyamanoue 0:ffac63d6a7f0 10 furnished to do so, subject to the following conditions:
takashiyamanoue 0:ffac63d6a7f0 11
takashiyamanoue 0:ffac63d6a7f0 12 The above copyright notice and this permission notice shall be included in
takashiyamanoue 0:ffac63d6a7f0 13 all copies or substantial portions of the Software.
takashiyamanoue 0:ffac63d6a7f0 14
takashiyamanoue 0:ffac63d6a7f0 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
takashiyamanoue 0:ffac63d6a7f0 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
takashiyamanoue 0:ffac63d6a7f0 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
takashiyamanoue 0:ffac63d6a7f0 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
takashiyamanoue 0:ffac63d6a7f0 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
takashiyamanoue 0:ffac63d6a7f0 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
takashiyamanoue 0:ffac63d6a7f0 21 THE SOFTWARE.
takashiyamanoue 0:ffac63d6a7f0 22 */
takashiyamanoue 0:ffac63d6a7f0 23
takashiyamanoue 0:ffac63d6a7f0 24 #ifndef NETIF_H
takashiyamanoue 0:ffac63d6a7f0 25 #define NETIF_H
takashiyamanoue 0:ffac63d6a7f0 26
takashiyamanoue 0:ffac63d6a7f0 27 #include "core/ipaddr.h"
takashiyamanoue 0:ffac63d6a7f0 28 /*
takashiyamanoue 0:ffac63d6a7f0 29 #include "nettcpsocket.h"
takashiyamanoue 0:ffac63d6a7f0 30 #include "netudpsocket.h"
takashiyamanoue 0:ffac63d6a7f0 31 #include "netdnsrequest.h"
takashiyamanoue 0:ffac63d6a7f0 32 */
takashiyamanoue 0:ffac63d6a7f0 33 class NetTcpSocket;
takashiyamanoue 0:ffac63d6a7f0 34 class NetUdpSocket;
takashiyamanoue 0:ffac63d6a7f0 35 class NetDnsRequest;
takashiyamanoue 0:ffac63d6a7f0 36
takashiyamanoue 0:ffac63d6a7f0 37 #if 0
takashiyamanoue 0:ffac63d6a7f0 38 enum NetifEvent
takashiyamanoue 0:ffac63d6a7f0 39 {
takashiyamanoue 0:ffac63d6a7f0 40 NETIF_CONNECTED, //Connected, can create & use sockets now
takashiyamanoue 0:ffac63d6a7f0 41 NETIF_DNSREPLY,
takashiyamanoue 0:ffac63d6a7f0 42 NETIF_DISCONNECTED
takashiyamanoue 0:ffac63d6a7f0 43 };
takashiyamanoue 0:ffac63d6a7f0 44 #endif
takashiyamanoue 0:ffac63d6a7f0 45
takashiyamanoue 0:ffac63d6a7f0 46 class NetIf
takashiyamanoue 0:ffac63d6a7f0 47 {
takashiyamanoue 0:ffac63d6a7f0 48 public:
takashiyamanoue 0:ffac63d6a7f0 49 NetIf();
takashiyamanoue 0:ffac63d6a7f0 50 virtual ~NetIf();
takashiyamanoue 0:ffac63d6a7f0 51 virtual NetTcpSocket* tcpSocket() = 0; //Create a new tcp socket
takashiyamanoue 0:ffac63d6a7f0 52 virtual NetUdpSocket* udpSocket() = 0; //Create a new udp socket
takashiyamanoue 0:ffac63d6a7f0 53 virtual void poll() = 0;
takashiyamanoue 0:ffac63d6a7f0 54 virtual NetDnsRequest* dnsRequest(const char* hostname) = 0; //Create a new NetDnsRequest object
takashiyamanoue 0:ffac63d6a7f0 55 virtual NetDnsRequest* dnsRequest(Host* pHost) = 0; //Create a new NetDnsRequest object
takashiyamanoue 0:ffac63d6a7f0 56
takashiyamanoue 0:ffac63d6a7f0 57 //!Returns the IP of the interface once it's connected
takashiyamanoue 0:ffac63d6a7f0 58 IpAddr getIp() const;
takashiyamanoue 0:ffac63d6a7f0 59
takashiyamanoue 0:ffac63d6a7f0 60 protected:
takashiyamanoue 0:ffac63d6a7f0 61 IpAddr m_ip;
takashiyamanoue 0:ffac63d6a7f0 62 };
takashiyamanoue 0:ffac63d6a7f0 63
takashiyamanoue 0:ffac63d6a7f0 64 #endif