📄 stopreceiving.m
字号:
function stopReceiving(functionName, message, port)
%STOPRECEIVING
%This function deregisters a function for receiving incoming messages of
%a message type through certain PC ports. If no ports are specified, all existing ports are used.
%
%Usage:
% stopReceiving(function, message, port);
%
% function: the string or function handle of a function, eg. 'myfunction'
% message: a subclass of net.tinyos.message.Message
% port: a socket, eg. 'localhost:9000' or a serial port, eg. 'COM1'
global COMM
if nargin<3
port=COMM.sockets;
end
if iscell(port)
for i=1:length(port)
stopReceiving(functionName, message, port{i});
end
return
end
if ~ischar(port) | ~ischar(functionName) | ~isjava(message)
disp(['usage: stopReceiving(''myFunction'', net.tinyos.oscope.OscopeMsg'')']);
disp([' stopReceiving(''myFunction'', net.tinyos.oscope.OscopeMsg'', ''COM1'')']);
return
end
TF = strcmpi(COMM.functions, functionName) & strcmpi(COMM.messageTypes, message.getClass.toString.toCharArray');
moteIF = [COMM.dataSource{TF}];
mml=[COMM.messageListener{TF}];
for i=1:length(moteIF)
moteIF(i).deregisterListener(message, mml(i));
end
COMM.functions(TF)=[];
COMM.messageTypes(TF)=[];
COMM.dataSource(TF)=[];
COMM.messageListener(TF)=[];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -