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

📄 disconnect.m

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 M
字号:
function disconnect(varargin)%DISCONNECT%%this function disconnects the current matlab environment from a phoenix%source.  If the connection does not exist, nothing is done.  The%parameters must match the exact name that was used to create the%phoenix source, so serial@COM1 will not terminate serial@COM1:mica2dot.%%usage: disconnect('network@localhost:9000')%       disconnect('serial@COM1')%       disconnect('serial@COM1:mica2dot')%       disconnect('network@localhost:9000', 'network@c62b27d:10002', 'serial@COM1:mica2dot', 'serial@COM2',...)global COMMif isempty(COMM)  returnenddisp('WARNING: Due to an error in the 1.3.1 java.net.socket.close() implementation, the disconnect function is not guaranteed to work.')if nargin > 1  for i=1:nargin    disconnect(varargin{i})  end  returnendif nargin==0 usage; return; endconnectionName=varargin{1};if ~ischar(connectionName) usage; return; endmIFtoKill=strcmpi(COMM.connectionName, connectionName); %shoul be only oneif any(mIFtoKill)  packetsToDeregister=strcmpi(COMM.sourceName, connectionName);  while(any(packetsToDeregister))    i=find(packetsToDeregister); %first, delete all the matlab message listeners from this moteIF    stopReceiving(COMM.function{i(1)}, COMM.messageType{i(1)}, COMM.sourceName{i(1)});    packetsToDeregister=strcmpi(COMM.sourceName, connectionName);  end  %then, stop and delete the moteIF itself  phoenixSource = COMM.moteIF{mIFtoKill}.getSource;  shutdown(phoenixSource);  COMM.moteIF={COMM.moteIF{~mIFtoKill}};  COMM.connectionName={COMM.connectionName{~mIFtoKill}};end      function usage	disp('usage: disconnect(''network@localhost:9000'')')disp('       disconnect(''serial@COM1'')')disp('       disconnect(''serial@COM1:mica2dot'')')disp('       disconnect(''network@localhost:9000'', ''network@c62b27d:10002'', ''serial@COM1:mica2dot'', ''serial@COM2'',...)')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -