├── .gitignore ├── LICENSE ├── README.md └── matlab ├── AE512Blockset.slx ├── SendPositionOrientationAndCameraViewToXPlaneOverUDP.m ├── SendPositionOrientationToXPlaneOverUDP.m ├── SendStringOverUDP.m ├── SplitOnDesiredChar.m ├── UWConversionFactorsLength.m ├── UWConversionFactorsMisc.m └── tcp_udp_ip_2_0_6 ├── license.txt └── tcp_udp_ip ├── Contents.m ├── GNU_General_Public_License.txt ├── UDP_SIM_DAQ_DEMO ├── README_UDP_DAQ_Simulator.txt ├── new_transmit_and_get.m └── sim_daq.m ├── license.txt ├── old_tcpip-1.2.4.zip ├── pnet.c ├── pnet.m ├── pnet.mexglx ├── pnet.mexsol ├── pnet.mexw32 ├── pnet.mexw64 ├── pnet_getvar.m ├── pnet_putvar.m ├── pnet_remote.m ├── popmail_demo.m ├── udp_plotter_demo.m ├── udp_send_demo.m ├── webget_demo.m ├── webserver_demo.m ├── whatsnew.txt └── ws_demo.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Debug files 32 | *.dSYM/ 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Christopher Lum 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RCAMAircraftVisualization 2 | Matlab/Simulink files necessary to visualize and render the Research Civil Aircraft Model (RCAM) simulation. 3 | 4 | These are relevant Matlab functions that are required to interface with the X-plane plugin system. 5 | 6 | You should add the 'matlab' folder and all its subfolders to your Matlab path. -------------------------------------------------------------------------------- /matlab/AE512Blockset.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/AE512Blockset.slx -------------------------------------------------------------------------------- /matlab/SendPositionOrientationAndCameraViewToXPlaneOverUDP.m: -------------------------------------------------------------------------------- 1 | function [varargout] = SendPositionOrientationAndCameraViewToXPlaneOverUDP(varargin) 2 | 3 | %SENDPOSITIONORIENTATIONANDCAMERAVIEWTOXPLANEOVERUDP Does as described 4 | % 5 | % SENDPOSITIONORIENTATIONANDCAMERAVIEWTOXPLANEOVERUDP(U, IP_ADDRESS, 6 | % PORT_NUMBER, DIGITSPREC) takes the orientation and positions of both 7 | % the aircraft and the camera (in vector U) and converts to an 8 | % appropriate string to send and sends over UDP to X-Plane. 9 | % 10 | % The vector U should be 11 | % 12 | % U = [ 13 | % phi (radians) 14 | % theta (radians) 15 | % psi (radians) 16 | % latitude (radians) 17 | % longitude (radians) 18 | % altitude (m) 19 | % phi_c (radians) (camera view euler angle) 20 | % theta_c (radians) camera view euler angle) 21 | % psi_c (radians) (camera view euler angle) 22 | % latitude_c (radians) (camera view location) 23 | % longitude_c (radians) (camera view location) 24 | % altitude_c (m) (camera view location) 25 | % zoom_c (camera zoom factor, 1 = no zoom, 2 = double zoom) 26 | % ] 27 | % 28 | % X-Plane receives and handles this message using the 29 | % UWTimedProcessingWithCameraUDP.xpl plugin. 30 | % 31 | % The PORT_NUMBER should be set to the same thing that the 32 | % UWTimedProcessingWithCameraUDP.xpl (the X-Plane plugin) is expecting 33 | % (typically 49003). 34 | % 35 | % DIGITSPREC specifies how many digits of precision to use when 36 | % converting from a number to a string (in the num2str command). If you 37 | % are getting choppy animation X-Plane, try increasing this value. 38 | % 39 | % Example usage 40 | % 41 | % SendPositionOrientationAndCameraViewToXPlaneOverUDP(U, 42 | % '192.168.1.3', 49003, 10) 43 | % 44 | % 45 | % 46 | %INPUT: -U: 13x1 vector of [phi;theta;psi;lat;lon;alt;phi_c;theta_c;psi_c;lat_c;lon_c;alt_c;zoom_c] 47 | % -IP_ADDRESS: string of the IP address of the machine running 48 | % X-Plane 49 | % -PORT_NUMBER: port number that 50 | % UWTimedProcessingWithCameraUDP.xpl is using to 51 | % listen for UDP packets 52 | % -DIGITSPREC: number of digits of precision to use when 53 | % converting a number to a string 54 | % 55 | %OUTPUT: -None 56 | % 57 | %Created by Christopher Lum 58 | %lum@u.washington.edu 59 | 60 | %Version History: 05/11/12: Created 61 | % 05/14/12: Updated documentation 62 | % 05/15/12: Added zoom 63 | % 10/19/14: Updated for new UWMatlab codebase 64 | % 01/09/15: Removed reliance on mapping toolbox radtodeg 65 | 66 | %----------------------OBTAIN USER PREFERENCES----------------------------- 67 | switch nargin 68 | case 4 69 | %User supplies all inputs 70 | U = varargin{1}; 71 | IP_ADDRESS = varargin{2}; 72 | PORT_NUMBER = varargin{3}; 73 | DIGITSPREC = varargin{4}; 74 | 75 | otherwise 76 | error('Invalid number of inputs'); 77 | end 78 | 79 | 80 | %-----------------------CHECKING DATA FORMAT------------------------------- 81 | %In the interest of efficiency, do not check inputs, errors should be 82 | %raised later if input arguments are incorrect 83 | 84 | % U 85 | 86 | % IP_ADDRESS 87 | 88 | % PORT_NUMBER 89 | 90 | % DIGITSPREC 91 | 92 | 93 | %-------------------------BEGIN CALCULATIONS------------------------------- 94 | %Unpack inputs 95 | phi = U(1); 96 | theta = U(2); 97 | psi = U(3); 98 | latitude = U(4); 99 | longitude = U(5); 100 | altitude = U(6); 101 | phi_c = U(7); 102 | theta_c = U(8); 103 | psi_c = U(9); 104 | latitude_c = U(10); 105 | longitude_c = U(11); 106 | altitude_c = U(12); 107 | zoom_c = U(13); 108 | 109 | %UWTimedProcessingWithCameraUDP.xpl is expecting phi, theta, psi, lat, and 110 | %lon to be in degrees, convert there here 111 | phiDeg = UWConversionFactorsMisc.RadianToDegree(phi); 112 | thetaDeg = UWConversionFactorsMisc.RadianToDegree(theta); 113 | psiDeg = UWConversionFactorsMisc.RadianToDegree(psi); 114 | latitudeDeg = UWConversionFactorsMisc.RadianToDegree(latitude); 115 | longitudeDeg = UWConversionFactorsMisc.RadianToDegree(longitude); 116 | 117 | phi_c_Deg = UWConversionFactorsMisc.RadianToDegree(phi_c); 118 | theta_c_Deg = UWConversionFactorsMisc.RadianToDegree(theta_c); 119 | psi_c_Deg = UWConversionFactorsMisc.RadianToDegree(psi_c); 120 | latitude_c_Deg = UWConversionFactorsMisc.RadianToDegree(latitude_c); 121 | longitude_c_Deg = UWConversionFactorsMisc.RadianToDegree(longitude_c); 122 | 123 | %UWTimedProcessingWithCameraUDP.xpl is expecting a space deliniated file string 124 | data=[num2str(phiDeg, DIGITSPREC),' ',... 125 | num2str(thetaDeg, DIGITSPREC),' ',... 126 | num2str(psiDeg, DIGITSPREC),' ',... 127 | num2str(latitudeDeg, DIGITSPREC),' ',... 128 | num2str(longitudeDeg, DIGITSPREC),' ',... 129 | num2str(altitude, DIGITSPREC),' ',... 130 | num2str(phi_c_Deg, DIGITSPREC),' ',... 131 | num2str(theta_c_Deg, DIGITSPREC),' ',... 132 | num2str(psi_c_Deg, DIGITSPREC),' ',... 133 | num2str(latitude_c_Deg, DIGITSPREC),' ',... 134 | num2str(longitude_c_Deg, DIGITSPREC),' ',... 135 | num2str(altitude_c, DIGITSPREC),' ',... 136 | num2str(zoom_c, DIGITSPREC)]; 137 | 138 | %Send the data over UDP 139 | debug = 0; 140 | SendStringOverUDP(data, IP_ADDRESS, PORT_NUMBER, debug ); 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /matlab/SendPositionOrientationToXPlaneOverUDP.m: -------------------------------------------------------------------------------- 1 | function [varargout] = SendPositionOrientationToXPlaneOverUDP(varargin) 2 | 3 | %SENDPOSITIONORIENTATIONTOXPLANEOVERUDP Does as described 4 | % 5 | % SENDPOSITIONORIENTATIONTOXPLANEOVERUDP(U, IP_ADDRESS, PORT_NUMBER, 6 | % DIGITSPREC) takes the orientation and positions (in vector U) and 7 | % converts to an appropriate string to send and sends over UDP to 8 | % X-Plane. 9 | % 10 | % The vector U should be 11 | % 12 | % U = [ 13 | % phi (radians) 14 | % theta (radians) 15 | % psi (radians) 16 | % latitude (radians) 17 | % longitude (radians) 18 | % altitude (m) 19 | % ] 20 | % 21 | % X-Plane receives and handles this message using the 22 | % UWTimedProcessingUDP.xpl plugin. 23 | % 24 | % The PORT_NUMBER should be set to the same thing that the 25 | % UWTimedProcessingUDP.xpl (the X-Plane plugin) is expecting (typically 26 | % 49003). 27 | % 28 | % DIGITSPREC specifies how many digits of precision to use when 29 | % converting from a number to a string (in the num2str command). If you 30 | % are getting choppy animation X-Plane, try increasing this value. 31 | % 32 | % Example usage 33 | % 34 | % SendPositionOrientationToXPlaneOverUDP(U, '192.168.1.3', 49003, 10) 35 | % 36 | % 37 | % 38 | %INPUT: -U: 6x1 vector of [phi;theta;psi;lat;lon;alt] 39 | % -IP_ADDRESS: string of the IP address of the machine running 40 | % X-Plane 41 | % -PORT_NUMBER: port number that UWTimedProcessingUDP.xpl is 42 | % using to listen for UDP packets 43 | % -DIGITSPREC: number of digits of precision to use when 44 | % converting a number to a string 45 | % 46 | %OUTPUT: -None 47 | % 48 | %Created by Christopher Lum 49 | %lum@u.washington.edu 50 | 51 | %Version History: 05/04/12: Created 52 | % 10/19/14: Updated for UWMatlab codebase 53 | % 01/09/15: Removed reliance on mapping toolbox radtodeg 54 | 55 | 56 | %----------------------OBTAIN USER PREFERENCES----------------------------- 57 | switch nargin 58 | case 4 59 | %User supplies all inputs 60 | U = varargin{1}; 61 | IP_ADDRESS = varargin{2}; 62 | PORT_NUMBER = varargin{3}; 63 | DIGITSPREC = varargin{4}; 64 | 65 | otherwise 66 | error('Invalid number of inputs'); 67 | end 68 | 69 | 70 | %-----------------------CHECKING DATA FORMAT------------------------------- 71 | %In the interest of efficiency, do not check inputs, errors should be 72 | %raised later if input arguments are incorrect 73 | 74 | % U 75 | 76 | % IP_ADDRESS 77 | 78 | % PORT_NUMBER 79 | 80 | % DIGITSPREC 81 | 82 | 83 | %-------------------------BEGIN CALCULATIONS------------------------------- 84 | %Unpack inputs 85 | phi = U(1); 86 | theta = U(2); 87 | psi = U(3); 88 | latitude = U(4); 89 | longitude = U(5); 90 | altitude = U(6); 91 | 92 | %UWTimedProcessingUDP.xpl is expecting phi, theta, psi, lat, and lon to be 93 | %in degrees, convert there here 94 | phiDeg = UWConversionFactorsMisc.RadianToDegree(phi); 95 | thetaDeg = UWConversionFactorsMisc.RadianToDegree(theta); 96 | psiDeg = UWConversionFactorsMisc.RadianToDegree(psi); 97 | latitudeDeg = UWConversionFactorsMisc.RadianToDegree(latitude); 98 | longitudeDeg = UWConversionFactorsMisc.RadianToDegree(longitude); 99 | 100 | %UWTimedProcessingUDP.xpl is expecting a space deliniated file string 101 | data=[num2str(phiDeg, DIGITSPREC),' ',... 102 | num2str(thetaDeg, DIGITSPREC),' ',... 103 | num2str(psiDeg, DIGITSPREC),' ',... 104 | num2str(latitudeDeg, DIGITSPREC),' ',... 105 | num2str(longitudeDeg, DIGITSPREC),' ',... 106 | num2str(altitude, DIGITSPREC)]; 107 | 108 | %Send the data over UDP 109 | debug = 0; 110 | SendStringOverUDP(data, IP_ADDRESS, PORT_NUMBER, debug ); 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /matlab/SendStringOverUDP.m: -------------------------------------------------------------------------------- 1 | function [] = SendStringOverUDP(varargin) 2 | 3 | %SENDSTRINGOVERUDP Sends a string over UDP to a location and port number 4 | % 5 | % SENDSTRINGOVERUDP(STR,IP_ADDRESS,PORT_NUMBER) Sends the string STR to 6 | % the specified IP_ADDRESS using PORT_NUMBER over a UDP connection. 7 | % 8 | % SENDSTRINGOVERUDP(STR,IP_ADDRESS,PORT_NUMBER,DEBUG) Does as above but 9 | % prints messages to the screen about the status if DEBUG==1. 10 | % 11 | % Example usage 12 | % 13 | % SendStringOverUDP('test string', '192.168.1.112', 49003) 14 | % 15 | % This requires the UDP Toolbox (downloaded from Matlab Central and 16 | % located at D:\lum\matlab\UDP_toolbox\tcp_udp_ip_2_0_6\tcp_udp_ip) 17 | % 18 | % 19 | %INPUT: -STR: string of data to send 20 | % -IP_ADDRESS: string of the IP address where to send data 21 | % -PORT_NUMBER: port number to use for sending data 22 | % -DEBUG: set to 1 to display messages about status 23 | % 24 | %OUTPUT: -None 25 | % 26 | %Created by Christopher Lum 27 | %lum@u.washington.edu 28 | 29 | %Version History: -05/04/12: Created 30 | 31 | %----------------------OBTAIN USER PREFERENCES----------------------------- 32 | switch nargin 33 | case 4 34 | %User supplies all inputs 35 | STR = varargin{1}; 36 | IP_ADDRESS = varargin{2}; 37 | PORT_NUMBER = varargin{3}; 38 | DEBUG = varargin{4}; 39 | 40 | case 3 41 | %Assume user does not want DEBUG messages 42 | STR = varargin{1}; 43 | IP_ADDRESS = varargin{2}; 44 | PORT_NUMBER = varargin{3}; 45 | DEBUG = 0; 46 | 47 | otherwise 48 | error('Invalid number of inputs'); 49 | end 50 | 51 | 52 | %-----------------------CHECKING DATA FORMAT------------------------------- 53 | % STR 54 | 55 | % IP_ADDRESS 56 | 57 | % PORT_NUMBER 58 | 59 | % DEBUG 60 | 61 | 62 | %-------------------------BEGIN CALCULATIONS------------------------------- 63 | %Setup a UDP port 64 | 65 | if(DEBUG) 66 | disp(['Setting up udpsocket on port #',num2str(PORT_NUMBER),' ...']) 67 | end 68 | udp=pnet('udpsocket',PORT_NUMBER); 69 | 70 | if udp~=-1 71 | if(DEBUG) 72 | disp(' Success'); 73 | disp(' ') 74 | end 75 | 76 | try 77 | %Write to the write buffer 78 | pnet(udp,'write',STR); 79 | 80 | %send data in the write buffer as a UDP packet 81 | if(DEBUG) 82 | disp('Sending data over UDP...') 83 | end 84 | 85 | pnet(udp,'writepacket',IP_ADDRESS,PORT_NUMBER); 86 | 87 | if(DEBUG) 88 | disp(' Success'); 89 | disp(' ') 90 | end 91 | catch exception 92 | if(DEBUG) 93 | disp([' FAIL!!! ',exception.message]) 94 | disp(' ') 95 | end 96 | throw(exception) 97 | end 98 | 99 | %Close the UDP connection 100 | if(DEBUG) 101 | disp('Closing UDP socket...') 102 | end 103 | 104 | pnet(udp,'close'); 105 | 106 | if(DEBUG) 107 | disp(' Success'); 108 | disp(' ') 109 | end 110 | 111 | else 112 | error('Could not setup the UDP port') 113 | end -------------------------------------------------------------------------------- /matlab/SplitOnDesiredChar.m: -------------------------------------------------------------------------------- 1 | function [varargout] = SplitOnDesiredChar(varargin) 2 | 3 | %SPLITONDESIREDCHAR Splits a string into a 1xN cell array 4 | % 5 | % [X] = SPLITONDESIREDCHAR(S, DELINIATOR) Splits the string S into a 1 x 6 | % N cell array of words which are delinated by the DELINIATOR. 7 | % 8 | %See also LoadTextData, LoadTextDataMatrix 9 | % 10 | %INPUT: -S: string to split 11 | % -DELINIATOR: character to use as column deliniator 12 | % 13 | %OUTPUT: -X: 1 x N cell array of words 14 | % 15 | %Created by Christopher Lum 16 | %lum@u.washington.edu 17 | 18 | %Version History: -10/16/08: Created 19 | 20 | %----------------------OBTAIN USER PREFERENCES----------------------------- 21 | switch nargin 22 | case 2 23 | %User supplies all inputs 24 | S = varargin{1}; 25 | DELINIATOR = varargin{2}; 26 | 27 | otherwise 28 | error('Invalid number of inputs'); 29 | end 30 | 31 | 32 | %-----------------------CHECKING DATA FORMAT------------------------------- 33 | % S 34 | if(~isstr(S)) 35 | error('S must be a string') 36 | end 37 | 38 | % DELINIATOR 39 | if(~ischar(DELINIATOR)) 40 | error('DELINIATOR must be a char') 41 | end 42 | 43 | 44 | %-------------------------BEGIN CALCULATIONS------------------------------- 45 | X = {}; 46 | if(isempty(S)) 47 | %S is empty, return an empty cell array 48 | 49 | else 50 | %S is non-empty 51 | wordStartIndex = 1; 52 | wordEndIndex = length(S); 53 | for k=1:length(S) 54 | if (S(k)==DELINIATOR) 55 | wordEndIndex = k; 56 | 57 | if((wordEndIndex-1) < wordStartIndex) 58 | %encountered two DELINIATOR in a row, this should be empty 59 | currentWord = ''; 60 | else 61 | currentWord = S(wordStartIndex:wordEndIndex-1); 62 | end 63 | X{1,end+1} = currentWord; 64 | wordStartIndex = wordEndIndex + 1; 65 | end 66 | end 67 | 68 | %Push the back the remainder 69 | if(wordStartIndex > length(S)) 70 | currentWord = ''; 71 | else 72 | currentWord = S(wordStartIndex:end); 73 | end 74 | X{1,end+1} = currentWord; 75 | end 76 | 77 | %Output the object 78 | varargout{1} = X; 79 | 80 | -------------------------------------------------------------------------------- /matlab/UWConversionFactorsLength.m: -------------------------------------------------------------------------------- 1 | classdef UWConversionFactorsLength 2 | %Conversion factors of lengths 3 | % 4 | %Christopher Lum 5 | %lum@u.washington.edu 6 | % 7 | %Version History: 01/05/15: Created from C# version of this struct 8 | 9 | %---------------------------------------------------------------------- 10 | %Static methods 11 | %---------------------------------------------------------------------- 12 | methods(Static) 13 | function [M] = FtToM(Ft) 14 | %Convert feet to meters 15 | M = Ft ./ UWConversionFactorsLength.MToFt(1); 16 | end 17 | 18 | function [Ft] = MToFt(M) 19 | %Convert meters to feet 20 | Ft = 3.28083989501 * M; 21 | end 22 | 23 | function [M] = NauticalMilesToMeters(NauticalMiles) 24 | %Convert nautical miles to meters 25 | M = 1852 * NauticalMiles; 26 | end 27 | 28 | function [NauticalMiles] = MetersToNauticalMiles(M) 29 | %Convert meters to nautical miles 30 | NauticalMiles = M ./ UWConversionFactorsLength.NauticalMilesToMeters(1); 31 | end 32 | 33 | end 34 | 35 | end 36 | 37 | -------------------------------------------------------------------------------- /matlab/UWConversionFactorsMisc.m: -------------------------------------------------------------------------------- 1 | classdef UWConversionFactorsMisc 2 | %Conversion factors for miscellaneous units 3 | % 4 | %Christopher Lum 5 | %lum@u.washington.edu 6 | % 7 | %Version History: 01/07/15: Created from C# version of this struct 8 | 9 | %---------------------------------------------------------------------- 10 | %Static methods 11 | %---------------------------------------------------------------------- 12 | methods(Static) 13 | function [Radian] = DegreeToRadian(Degree) 14 | %Convert degree to radian 15 | Radian = Degree .* (pi/180); 16 | end 17 | 18 | function [Degree] = RadianToDegree(Radian) 19 | %Convert radian to degree 20 | Degree = Radian .* (180/pi); 21 | end 22 | 23 | function [Seconds] = DaysToSeconds(Days) 24 | %Convert days to seconds 25 | Seconds = Days*24*60*60; 26 | end 27 | 28 | function [Days] = SecondsToDays(Seconds) 29 | %Convert seconds to days 30 | Days = Seconds./(UWConversionFactorsMisc.DaysToSeconds(1)); 31 | end 32 | end 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1997-2009, Peter Rydesäter 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/Contents.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/Contents.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/GNU_General_Public_License.txt: -------------------------------------------------------------------------------- 1 | (View this file in a web-browser if not properly displayed now.) 2 | 3 | 4 | 5 | GNU GENERAL PUBLIC LICENSE 6 | Version 2, June 1991 7 | 8 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 9 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 10 | Everyone is permitted to copy and distribute verbatim copies 11 | of this license document, but changing it is not allowed. 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | License is intended to guarantee your freedom to share and change free 18 | software--to make sure the software is free for all its users. This 19 | General Public License applies to most of the Free Software 20 | Foundation's software and to any other program whose authors commit to 21 | using it. (Some other Free Software Foundation software is covered by 22 | the GNU Library General Public License instead.) You can apply it to 23 | your programs, too. 24 | 25 | When we speak of free software, we are referring to freedom, not 26 | price. Our General Public Licenses are designed to make sure that you 27 | have the freedom to distribute copies of free software (and charge for 28 | this service if you wish), that you receive source code or can get it 29 | if you want it, that you can change the software or use pieces of it 30 | in new free programs; and that you know you can do these things. 31 | 32 | To protect your rights, we need to make restrictions that forbid 33 | anyone to deny you these rights or to ask you to surrender the rights. 34 | These restrictions translate to certain responsibilities for you if you 35 | distribute copies of the software, or if you modify it. 36 | 37 | For example, if you distribute copies of such a program, whether 38 | gratis or for a fee, you must give the recipients all the rights that 39 | you have. You must make sure that they, too, receive or can get the 40 | source code. And you must show them these terms so they know their 41 | rights. 42 | 43 | We protect your rights with two steps: (1) copyright the software, and 44 | (2) offer you this license which gives you legal permission to copy, 45 | distribute and/or modify the software. 46 | 47 | Also, for each author's protection and ours, we want to make certain 48 | that everyone understands that there is no warranty for this free 49 | software. If the software is modified by someone else and passed on, we 50 | want its recipients to know that what they have is not the original, so 51 | that any problems introduced by others will not reflect on the original 52 | authors' reputations. 53 | 54 | Finally, any free program is threatened constantly by software 55 | patents. We wish to avoid the danger that redistributors of a free 56 | program will individually obtain patent licenses, in effect making the 57 | program proprietary. To prevent this, we have made it clear that any 58 | patent must be licensed for everyone's free use or not licensed at all. 59 | 60 | The precise terms and conditions for copying, distribution and 61 | modification follow. 62 | 63 | GNU GENERAL PUBLIC LICENSE 64 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 65 | 66 | 0. This License applies to any program or other work which contains 67 | a notice placed by the copyright holder saying it may be distributed 68 | under the terms of this General Public License. The "Program", below, 69 | refers to any such program or work, and a "work based on the Program" 70 | means either the Program or any derivative work under copyright law: 71 | that is to say, a work containing the Program or a portion of it, 72 | either verbatim or with modifications and/or translated into another 73 | language. (Hereinafter, translation is included without limitation in 74 | the term "modification".) Each licensee is addressed as "you". 75 | 76 | Activities other than copying, distribution and modification are not 77 | covered by this License; they are outside its scope. The act of 78 | running the Program is not restricted, and the output from the Program 79 | is covered only if its contents constitute a work based on the 80 | Program (independent of having been made by running the Program). 81 | Whether that is true depends on what the Program does. 82 | 83 | 1. You may copy and distribute verbatim copies of the Program's 84 | source code as you receive it, in any medium, provided that you 85 | conspicuously and appropriately publish on each copy an appropriate 86 | copyright notice and disclaimer of warranty; keep intact all the 87 | notices that refer to this License and to the absence of any warranty; 88 | and give any other recipients of the Program a copy of this License 89 | along with the Program. 90 | 91 | You may charge a fee for the physical act of transferring a copy, and 92 | you may at your option offer warranty protection in exchange for a fee. 93 | 94 | 2. You may modify your copy or copies of the Program or any portion 95 | of it, thus forming a work based on the Program, and copy and 96 | distribute such modifications or work under the terms of Section 1 97 | above, provided that you also meet all of these conditions: 98 | 99 | a) You must cause the modified files to carry prominent notices 100 | stating that you changed the files and the date of any change. 101 | 102 | b) You must cause any work that you distribute or publish, that in 103 | whole or in part contains or is derived from the Program or any 104 | part thereof, to be licensed as a whole at no charge to all third 105 | parties under the terms of this License. 106 | 107 | c) If the modified program normally reads commands interactively 108 | when run, you must cause it, when started running for such 109 | interactive use in the most ordinary way, to print or display an 110 | announcement including an appropriate copyright notice and a 111 | notice that there is no warranty (or else, saying that you provide 112 | a warranty) and that users may redistribute the program under 113 | these conditions, and telling the user how to view a copy of this 114 | License. (Exception: if the Program itself is interactive but 115 | does not normally print such an announcement, your work based on 116 | the Program is not required to print an announcement.) 117 | 118 | These requirements apply to the modified work as a whole. If 119 | identifiable sections of that work are not derived from the Program, 120 | and can be reasonably considered independent and separate works in 121 | themselves, then this License, and its terms, do not apply to those 122 | sections when you distribute them as separate works. But when you 123 | distribute the same sections as part of a whole which is a work based 124 | on the Program, the distribution of the whole must be on the terms of 125 | this License, whose permissions for other licensees extend to the 126 | entire whole, and thus to each and every part regardless of who wrote it. 127 | 128 | Thus, it is not the intent of this section to claim rights or contest 129 | your rights to work written entirely by you; rather, the intent is to 130 | exercise the right to control the distribution of derivative or 131 | collective works based on the Program. 132 | 133 | In addition, mere aggregation of another work not based on the Program 134 | with the Program (or with a work based on the Program) on a volume of 135 | a storage or distribution medium does not bring the other work under 136 | the scope of this License. 137 | 138 | 3. You may copy and distribute the Program (or a work based on it, 139 | under Section 2) in object code or executable form under the terms of 140 | Sections 1 and 2 above provided that you also do one of the following: 141 | 142 | a) Accompany it with the complete corresponding machine-readable 143 | source code, which must be distributed under the terms of Sections 144 | 1 and 2 above on a medium customarily used for software interchange; or, 145 | 146 | b) Accompany it with a written offer, valid for at least three 147 | years, to give any third party, for a charge no more than your 148 | cost of physically performing source distribution, a complete 149 | machine-readable copy of the corresponding source code, to be 150 | distributed under the terms of Sections 1 and 2 above on a medium 151 | customarily used for software interchange; or, 152 | 153 | c) Accompany it with the information you received as to the offer 154 | to distribute corresponding source code. (This alternative is 155 | allowed only for noncommercial distribution and only if you 156 | received the program in object code or executable form with such 157 | an offer, in accord with Subsection b above.) 158 | 159 | The source code for a work means the preferred form of the work for 160 | making modifications to it. For an executable work, complete source 161 | code means all the source code for all modules it contains, plus any 162 | associated interface definition files, plus the scripts used to 163 | control compilation and installation of the executable. However, as a 164 | special exception, the source code distributed need not include 165 | anything that is normally distributed (in either source or binary 166 | form) with the major components (compiler, kernel, and so on) of the 167 | operating system on which the executable runs, unless that component 168 | itself accompanies the executable. 169 | 170 | If distribution of executable or object code is made by offering 171 | access to copy from a designated place, then offering equivalent 172 | access to copy the source code from the same place counts as 173 | distribution of the source code, even though third parties are not 174 | compelled to copy the source along with the object code. 175 | 176 | 4. You may not copy, modify, sublicense, or distribute the Program 177 | except as expressly provided under this License. Any attempt 178 | otherwise to copy, modify, sublicense or distribute the Program is 179 | void, and will automatically terminate your rights under this License. 180 | However, parties who have received copies, or rights, from you under 181 | this License will not have their licenses terminated so long as such 182 | parties remain in full compliance. 183 | 184 | 5. You are not required to accept this License, since you have not 185 | signed it. However, nothing else grants you permission to modify or 186 | distribute the Program or its derivative works. These actions are 187 | prohibited by law if you do not accept this License. Therefore, by 188 | modifying or distributing the Program (or any work based on the 189 | Program), you indicate your acceptance of this License to do so, and 190 | all its terms and conditions for copying, distributing or modifying 191 | the Program or works based on it. 192 | 193 | 6. Each time you redistribute the Program (or any work based on the 194 | Program), the recipient automatically receives a license from the 195 | original licensor to copy, distribute or modify the Program subject to 196 | these terms and conditions. You may not impose any further 197 | restrictions on the recipients' exercise of the rights granted herein. 198 | You are not responsible for enforcing compliance by third parties to 199 | this License. 200 | 201 | 7. If, as a consequence of a court judgment or allegation of patent 202 | infringement or for any other reason (not limited to patent issues), 203 | conditions are imposed on you (whether by court order, agreement or 204 | otherwise) that contradict the conditions of this License, they do not 205 | excuse you from the conditions of this License. If you cannot 206 | distribute so as to satisfy simultaneously your obligations under this 207 | License and any other pertinent obligations, then as a consequence you 208 | may not distribute the Program at all. For example, if a patent 209 | license would not permit royalty-free redistribution of the Program by 210 | all those who receive copies directly or indirectly through you, then 211 | the only way you could satisfy both it and this License would be to 212 | refrain entirely from distribution of the Program. 213 | 214 | If any portion of this section is held invalid or unenforceable under 215 | any particular circumstance, the balance of the section is intended to 216 | apply and the section as a whole is intended to apply in other 217 | circumstances. 218 | 219 | It is not the purpose of this section to induce you to infringe any 220 | patents or other property right claims or to contest validity of any 221 | such claims; this section has the sole purpose of protecting the 222 | integrity of the free software distribution system, which is 223 | implemented by public license practices. Many people have made 224 | generous contributions to the wide range of software distributed 225 | through that system in reliance on consistent application of that 226 | system; it is up to the author/donor to decide if he or she is willing 227 | to distribute software through any other system and a licensee cannot 228 | impose that choice. 229 | 230 | This section is intended to make thoroughly clear what is believed to 231 | be a consequence of the rest of this License. 232 | 233 | 8. If the distribution and/or use of the Program is restricted in 234 | certain countries either by patents or by copyrighted interfaces, the 235 | original copyright holder who places the Program under this License 236 | may add an explicit geographical distribution limitation excluding 237 | those countries, so that distribution is permitted only in or among 238 | countries not thus excluded. In such case, this License incorporates 239 | the limitation as if written in the body of this License. 240 | 241 | 9. The Free Software Foundation may publish revised and/or new versions 242 | of the General Public License from time to time. Such new versions will 243 | be similar in spirit to the present version, but may differ in detail to 244 | address new problems or concerns. 245 | 246 | Each version is given a distinguishing version number. If the Program 247 | specifies a version number of this License which applies to it and "any 248 | later version", you have the option of following the terms and conditions 249 | either of that version or of any later version published by the Free 250 | Software Foundation. If the Program does not specify a version number of 251 | this License, you may choose any version ever published by the Free Software 252 | Foundation. 253 | 254 | 10. If you wish to incorporate parts of the Program into other free 255 | programs whose distribution conditions are different, write to the author 256 | to ask for permission. For software which is copyrighted by the Free 257 | Software Foundation, write to the Free Software Foundation; we sometimes 258 | make exceptions for this. Our decision will be guided by the two goals 259 | of preserving the free status of all derivatives of our free software and 260 | of promoting the sharing and reuse of software generally. 261 | 262 | NO WARRANTY 263 | 264 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 265 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 266 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 267 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 268 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 269 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 270 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 271 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 272 | REPAIR OR CORRECTION. 273 | 274 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 275 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 276 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 277 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 278 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 279 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 280 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 281 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 282 | POSSIBILITY OF SUCH DAMAGES. 283 | 284 | END OF TERMS AND CONDITIONS 285 | 286 | How to Apply These Terms to Your New Programs 287 | 288 | If you develop a new program, and you want it to be of the greatest 289 | possible use to the public, the best way to achieve this is to make it 290 | free software which everyone can redistribute and change under these terms. 291 | 292 | To do so, attach the following notices to the program. It is safest 293 | to attach them to the start of each source file to most effectively 294 | convey the exclusion of warranty; and each file should have at least 295 | the "copyright" line and a pointer to where the full notice is found. 296 | 297 | 298 | Copyright (C) 299 | 300 | This program is free software; you can redistribute it and/or modify 301 | it under the terms of the GNU General Public License as published by 302 | the Free Software Foundation; either version 2 of the License, or 303 | (at your option) any later version. 304 | 305 | This program is distributed in the hope that it will be useful, 306 | but WITHOUT ANY WARRANTY; without even the implied warranty of 307 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 308 | GNU General Public License for more details. 309 | 310 | You should have received a copy of the GNU General Public License 311 | along with this program; if not, write to the Free Software 312 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 313 | 314 | 315 | Also add information on how to contact you by electronic and paper mail. 316 | 317 | If the program is interactive, make it output a short notice like this 318 | when it starts in an interactive mode: 319 | 320 | Gnomovision version 69, Copyright (C) year name of author 321 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 322 | This is free software, and you are welcome to redistribute it 323 | under certain conditions; type `show c' for details. 324 | 325 | The hypothetical commands `show w' and `show c' should show the appropriate 326 | parts of the General Public License. Of course, the commands you use may 327 | be called something other than `show w' and `show c'; they could even be 328 | mouse-clicks or menu items--whatever suits your program. 329 | 330 | You should also get your employer (if you work as a programmer) or your 331 | school, if any, to sign a "copyright disclaimer" for the program, if 332 | necessary. Here is a sample; alter the names: 333 | 334 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 335 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 336 | 337 | , 1 April 1989 338 | Ty Coon, President of Vice 339 | 340 | This General Public License does not permit incorporating your program into 341 | proprietary programs. If your program is a subroutine library, you may 342 | consider it more useful to permit linking proprietary applications with the 343 | library. If this is what you want to do, use the GNU Library General 344 | Public License instead of this License. 345 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/UDP_SIM_DAQ_DEMO/README_UDP_DAQ_Simulator.txt: -------------------------------------------------------------------------------- 1 | This two is demo ripped from a demo solotion for a real application. 2 | 3 | The DAQ simulator: 4 | 5 | As I do not have a DAQ system, I made a simple DAQ simulator. 6 | The script sim_daq.m simulates a daq system and sends some data packets with sinus wave data in UDP packets. 7 | Start it in its own MATLAB window on the same computer or an other one start it with for an example: 8 | 9 | sim_daq('localhost',3001,3002) 10 | 11 | It will send 16-bit data with "Network" byte order. You may change it to "Intel" byte order if thats more correct. 12 | If transmisstion speed it to fast. then will the network or reciving application loss packets. 13 | You can adjust delay with the pause(xxx) comands. you will read out different average transmission speeds from this. 14 | I fill the initial 2-byte position with 16-bit "id" number for the transmission. 15 | 16 | 17 | DAQ Reciver: 18 | 19 | First of all I switched over to use only pnet comunication and no matlabs own UDP. 20 | You can run it like this: 21 | 22 | [data_matrix,id_list]=new_transmit_and_get('localhost',3002,3001); 23 | plot(data_matrix); 24 | 25 | You will se the sinus waves plotted if you receive from the sim_daq application. 26 | You may change the byte order if im wrong about the byteorder your daq system use.... -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/UDP_SIM_DAQ_DEMO/new_transmit_and_get.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/UDP_SIM_DAQ_DEMO/new_transmit_and_get.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/UDP_SIM_DAQ_DEMO/sim_daq.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/UDP_SIM_DAQ_DEMO/sim_daq.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/license.txt -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/old_tcpip-1.2.4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/old_tcpip-1.2.4.zip -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.c -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexglx -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexsol -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexw32 -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet.mexw64 -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_getvar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_getvar.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_putvar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_putvar.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_remote.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/pnet_remote.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/popmail_demo.m: -------------------------------------------------------------------------------- 1 | function popmail_demo(site,user,pass) 2 | % popmail_demo - Demo that read mail from pop mail server (not delete). 3 | % The first lines of each mail will be printed out. 4 | % 5 | % Syntax: 6 | % popmail_demo(site,user,password) 7 | % or 8 | % popmail_demo site user password 9 | % or 10 | % popmail_demo 11 | % 12 | % In the last case you will be asked for intput parameters. 13 | % 14 | % Version: 2002-02-01 Uppgraded to use the API in tcpiptoolbox 2.x, from tcpiptoolbox 1.x API 15 | % 16 | 17 | if nargin<3, 18 | site=input('Input adress to pop server:','s'); 19 | user=input('user:','s'); 20 | pass=input('password: (sorry, will be displayed on the screen)','s'); 21 | end 22 | % CONNECT 23 | fid=pnet('tcpconnect',site,110); 24 | if fid==-1, 25 | disp 'Cant connect to server!'; 26 | return; 27 | end 28 | %LOGIN 29 | read_mresp(fid); 30 | pnet(fid,'printf','USER %s\n',user); 31 | read_mresp(fid); 32 | pnet(fid,'printf','PASS %s\n',pass); 33 | read_mresp(fid); 34 | pnet(fid,'printf','STAT\n'); 35 | pnet(fid,'readline'); 36 | all=0; 37 | % READ HEADERS OF FIRST 50 mail. 38 | for a=1:50 , 39 | if all, break; end 40 | pnet(fid,'printf','TOP %d 0\n',a); 41 | s=''; 42 | b=0; 43 | while strncmp(s,'.',1)==0, 44 | s=pnet(fid,'readline'); 45 | b=b+1; 46 | if strncmp(s,'-ERR',4), 47 | all=1; 48 | nummes=a-1; 49 | break; 50 | elseif strncmp('Subject:',s,8); 51 | subject{a}=s(9:end); 52 | elseif strncmp('From:',s,5); 53 | from{a}=s(6:end); 54 | end 55 | end 56 | mlines(a)=b-1; 57 | end 58 | disp(sprintf('Number of mails in mailbox on server: %d\n',nummes)); 59 | % DISPLAY HEADER AND READ MESSAGE LINES 60 | for a=1:nummes, 61 | disp '###############################################################' 62 | disp(sprintf('Subject: %s\n From: %s',subject{a},from{a})); 63 | disp '---------------------------------------------------------------' 64 | %Request next line in current mail message. 65 | pnet(fid,'printf','RETR %d\n',a); 66 | for b=1:mlines(a), 67 | s=pnet(fid,'readline'); 68 | end 69 | b=0; 70 | atflag=0; % Set "not displaying" flag to false. 71 | while strcmp(s,'.')==0, 72 | b=b+1; 73 | s=pnet(fid,'readline'); 74 | 75 | % Don't display attachment lines and similar stuff. 76 | if atflag==0 & b<100, 77 | disp(s); 78 | end 79 | if strncmp(s,'Content-',8), 80 | atflag=1; % If start of attachment set "not displaying" flag. 81 | end 82 | end 83 | end 84 | pnet(fid,'close'); 85 | return; 86 | 87 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 88 | % Read and check that response is OK 89 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 90 | function ok=read_mresp(fid) 91 | s=pnet(fid,'readline'); 92 | if strncmp(s,'+OK',3)==0, 93 | pnet(fid,'close'); 94 | error('Response error!'); 95 | end 96 | return; 97 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/udp_plotter_demo.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/udp_plotter_demo.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/udp_send_demo.m: -------------------------------------------------------------------------------- 1 | function udp_send_demo(fun,host,port) 2 | % UDP_SEND_DEMO - a demo that sends a squence of doubles in network byte order to local or remote host 3 | % 4 | % Syntax: 5 | % UDP_SEND_DEMO 6 | % or 7 | % UDP_SEND_DEMO function_string 8 | % or 9 | % UDP_SEND_DEMO function_string hostname 10 | % or 11 | % UDP_SEND_DEMO function_string hostname portnumber 12 | % 13 | % Default values: 14 | % function_string is by default sin(0:0.1:6) that will be evaluated and transmitted 15 | % as a sequence of network byte ordered doubles (or generated datatype) 16 | % 17 | % hostname is by default localhost but can be any hostname if you whant to send 18 | % the packet to an other host. 19 | % 20 | % portnumber is by default 3333. 21 | % 22 | % 23 | % The purpose of this demo is to illustrate how a udp packat can be created, filled with numbers 24 | % and then transmitted to any host and udp port. Use this demo together with udp_plotter_demo 25 | % that receives and plott the packets of numbers. 26 | % 27 | % Example: 28 | % 29 | % udp_send_demo sin(0:0.1:50)./(0:0.1:50) plotterhost 33333 30 | % 31 | 32 | if nargin<1, fun='sin(0:0.1:6)'; end 33 | if nargin<2, host='localhost'; end 34 | if nargin<3, port='3333'; end 35 | 36 | data=evalin('caller',fun); 37 | udp=pnet('udpsocket',1111); 38 | if udp~=-1, 39 | try, % Failsafe 40 | pnet(udp,'write',data); % Write to write buffer 41 | pnet(udp,'writepacket',host,port); % Send buffer as UDP packet 42 | end 43 | pnet(udp,'close'); 44 | end 45 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/webget_demo.m: -------------------------------------------------------------------------------- 1 | function [pagedata,hdr]=webget_demo(url) 2 | % WEBGET_DEMO - Demo webpage downloader, returns a webpage as a string 3 | % 4 | % Syntax: 5 | % webget_demo url_adress 6 | % or 7 | % str=webget_demo('url_adress') 8 | % 9 | % Version: 2002-02-01 for the tcpiptoolbox 2.x API 10 | % 11 | if nargin==0, url='http://www.mathworks.com'; end 12 | MAXPAGESIZE=1024*1024; 13 | %Decode URL 14 | if strncmp(url,'http:',5), url=url(6:end); end 15 | if strncmp(url,'//',2), url=url(3:end); end 16 | [host,page]=strtok(url,'/'); 17 | [host,port]=strtok(host,':'); 18 | if length(port)>1, port=port(2:end); else port='80'; end 19 | if length(page)==0, page='/'; end 20 | %Connect to web server 21 | con=pnet('tcpconnect',host,port); 22 | if con==-1, error 'Bad url or server down.....'; end 23 | disp(['Connected to: ' host]); 24 | if 1, 25 | pnet(con,'setwritetimeout',1); 26 | pnet(con,'setreadtimeout',30); 27 | %Send request 28 | pnet(con,'printf','GET %s HTTP1.0\n\n',page); 29 | pnet(con,'read',MAXPAGESIZE,'view'); % Read data to local buffer with 30 sec timout. 30 | pnet(con,'setreadtimeout',0.1); %Change timeout 31 | hdrstr=''; hdr=''; 32 | %Remove header 33 | while length(hdrstr) | length(hdr)==0, 34 | stat=pnet(con,'status'); 35 | hdrstr=pnet(con,'readline'); 36 | hdr=sprintf('%s%s\n',hdr,hdrstr); 37 | end 38 | %Return page 39 | pnet(con,'setreadtimeout',60); 40 | pagedata=pnet(con,'read',MAXPAGESIZE); 41 | end 42 | pnet(con,'close'); 43 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/webserver_demo.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/webserver_demo.m -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/whatsnew.txt: -------------------------------------------------------------------------------- 1 | History of tcp/udp/ip toolbox for MATLAB 2 | ======================================== 3 | 4 | Version 2.0.6 2008-03-06 5 | 6 | -Including precompiled pnet.mexw32 for support to in matlab R2007 (R2008?) 7 | No need to compile pnet.c to run at R2007.... 8 | (Included a real application demo that uses UDP and simulates a UDP based DAQ system.) 9 | 10 | Version 2.0.5 2003-09-16 11 | -Fixing all GNU License notes more proper and clear and writing an 12 | exception that make it "100%" legal and proper to use this as a plug-in 13 | as the basic intention of cause is. The note also makes it clear that 14 | you can link and distribute this toolbox as non-free stand alone as long as 15 | this part (the tcp_udp_ip toolbox) is distributed with it and fullfills 16 | the licence agreement for it. See license.txt 17 | 18 | - The windows dll is compiled with matlab 5.3 to make it possible to 19 | run in matlab 5.x 20 | 21 | Version 2.0.4 2003-07-22 22 | -Major bug fix: 'readtofile' and 'writefromfile' now opens the files in 23 | binary mode also for the Windows platform which makes the toolbox work properly 24 | for many cases where it erlier failed. This probably solvs many bugs 25 | that could not be solved. erlier! 26 | -changed call frequency of 'drawnow' from 1 per sec to 10 per seconds. 27 | -'pnet_remote' now supports an array of conection handles for calls that 28 | do not return any thing. 29 | - new author adress information 30 | 31 | Version 2.0.3 2002-04-23 32 | -Added support for the "single" (float 32-bit) datatype. 33 | 34 | Version 2.0.2 2002-03-12 35 | Windows buggfixes (also bugs for unix): 36 | -Breaking blocking operations with ctrl-c now works (better..) 37 | Fixed with a call to drawnow evry second. 38 | -UDP receive of packets now works stable after initialzing fromlen 39 | in revfrom() call. 40 | 41 | Version 2.0.1 2002-02-25 42 | -Long delays in windows is fixed by changing Sleep(...) in pnet.c 43 | to correspond to sleep(...) in unix by div. by 1000. 44 | -Added drawnow into SERVER loop in pnet_remote. 45 | 46 | Version 2.0 (Beta) 2002-02-14 47 | Complete rewrite of the API with new calls. 48 | All tcpip_* function is replaced with new mex function named pnet(....). 49 | NEW mutch faster support for datatypes and byte swapping!! 50 | Datatype support: double,char,uint8,unint16,uint32,int8,nint16,int32. 51 | Byte swapping support: native,swap,intel,network byte orders. 52 | tcpip_feval family function replaced by the pnet_remote function. 53 | This version in not backwards compatible wit version 1.x but 54 | are similar -> easy to port (easy to write wrapper functions?) 55 | 56 | Version 1.3 2001-01-13 57 | Added support to UDP/IP-packet transmission by Mike Medeiros 58 | This version is never published...... 59 | 60 | Verion 1.2.1 2001-01-04 61 | 62 | Bugfix of variable and file tranfer functions 63 | Prelimnaray remote execution interface! 64 | 65 | Version 1.2 2000-12-14 66 | 67 | tcpip_servopen() replace by tcpip_servsocket() and 68 | tcpip_listen() Now its a non blocking multi connection 69 | server!! 70 | A simple webserver_demo is now also included. 71 | 72 | Version 1.2 BETA 2000-11-20 73 | 74 | Bug fixed. multi connections work proper! 75 | 76 | 77 | Version 1.1 1999-10-28 78 | 79 | Now also support for Windows 95/98(?)/NT4 By Mario Bergeron 80 | All data types is now supported to be sent/rec. in network byte 81 | order. Solaris and Linux also seams to work well without 82 | "broke pipe handling" bug! 83 | A demo that reads mail from a pop mail server is also included. 84 | 85 | 86 | Version 1.0 Beta 1 1999-04-06 87 | 88 | Open connections as client or server and send/receive 89 | text strings. Works under Linux and Solaris. 90 | Under soloris some trouble with "broken pipe handling" 91 | -------------------------------------------------------------------------------- /matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/ws_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clum/RCAMAircraftVisualization/48e283d7d23f21fa652b8b9a92c8b6bfbcdbe6bc/matlab/tcp_udp_ip_2_0_6/tcp_udp_ip/ws_demo.jpg --------------------------------------------------------------------------------