Преглед изворни кода

discovery heeft magic gekregen

master
Wouter Horlings пре 8 година
родитељ
комит
8754ab61d3
1 измењених фајлова са 15 додато и 12 уклоњено
  1. +15
    -12
      Equipment/prologix_discovery.m

+ 15
- 12
Equipment/prologix_discovery.m Прегледај датотеку

@@ -1,4 +1,4 @@
function ipaddress = prologix_discovery(localhost)
function ipaddress = prologix_discovery()
%% PROLOGIX_DISCOVERY Find your prologix GPIB device.
% ipaddress = PROLOGIX_DISCOVERY() finds prologix on your
% local network. When your prologix device is detected
@@ -10,11 +10,11 @@ function ipaddress = prologix_discovery(localhost)

%% setup correct variables.
% if location of prologix is known: just return stored ip address
if nargin < 1
localhostcellarray = getLocalIP();
else
localhostcellarray{1} = localhost;
end
% if nargin < 1
% localhostcellarray = getLocalIP();
% else
% localhostcellarray{1} = localhost;
% end
persistent stored_ipaddress;
if ~isempty(stored_ipaddress)
ipaddress = stored_ipaddress;
@@ -23,9 +23,15 @@ end
local_port = randi([49152 65535]);
remote_port = 3040;

%%Magic
udpmagic = udp('10.255.255.255',12345);
fopen(udpmagic);
fwrite(udpmagic,'windows moet dood');
fclose(udpmagic);
delete udpmagic

%% setup dsp to send and recieve udp packets.
for ipIndex = 1:length(localhostcellarray)
udpconnection = udp('10.255.255.255',3040);
udpconnection = udp('255.255.255.255',3040);
%hudpr = dsp.UDPReceiver('LocalIPPort',local_port);
% hudps = dsp.UDPSender('RemoteIPAddress','255.255.255.255','RemoteIPPort',remote_port,'LocalIPPortSource','Property','LocalIPPort',local_port);
% start recieving udp packets
@@ -53,10 +59,7 @@ for ipIndex = 1:length(localhostcellarray)
end
end
fclose(udpconnection);
if ~isempty(msg)
break;
end
end

if isempty(msg)
error('No prologix found on network');
end


Loading…
Откажи
Сачувај