00001 /* 00002 00003 Copyright 2007, 2008 Damian Stewart damian@frey.co.nz 00004 Distributed under the terms of the GNU Lesser General Public License v3 00005 00006 This file is part of the ofxOsc openFrameworks OSC addon. 00007 00008 ofxOsc is free software: you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as published by 00010 the Free Software Foundation, either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 ofxOsc is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public License 00019 along with ofxOsc. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 00023 #ifndef _ofxOscSENDER_H 00024 #define _ofxOscSENDER_H 00025 00034 class UdpTransmitSocket; 00035 #include <string> 00036 #include "OscTypes.h" 00037 #include "OscOutboundPacketStream.h" 00038 00039 #include "ofxOscBundle.h" 00040 #include "ofxOscMessage.h" 00041 00042 00043 class ofxOscSender 00044 { 00045 public: 00046 ofxOscSender(); 00047 ~ofxOscSender(); 00048 00050 void setup( std::string hostname, int port ); 00051 00053 void sendMessage( ofxOscMessage& message ); 00055 void sendBundle( ofxOscBundle& bundle ); 00056 00057 private: 00058 00059 // helper methods for constructing messages 00060 void appendBundle( ofxOscBundle& bundle, osc::OutboundPacketStream& p ); 00061 void appendMessage( ofxOscMessage& message, osc::OutboundPacketStream& p ); 00062 00063 UdpTransmitSocket* socket; 00064 }; 00065 00066 #endif