⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stopreceiving.m

📁 传感器网络中的嵌入式操作系统源代码
💻 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 + -