simple tester example >>> osc destination & receive

Dependencies:   mbed

Fork of myOSC_test by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Sat Oct 15 14:15:55 2011 +0000
Revision:
0:f76708a93fb3
First working test of this simple OSC library.

Who changed what in which revision?

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