Skip to content
Snippets Groups Projects
Commit 0987153a authored by Tim Stadtmann's avatar Tim Stadtmann
Browse files

Rename handleCommand-argument for clarification

parent 78b368d2
No related branches found
No related tags found
No related merge requests found
...@@ -452,7 +452,7 @@ classdef EV3 < MaskedHandle ...@@ -452,7 +452,7 @@ classdef EV3 < MaskedHandle
end end
methods (Access = private) % Private brick functions that are wrapped by dependent params methods (Access = private) % Private brick functions that are wrapped by dependent params
function varargout = handleCommand(ev3, commandHandle, varargin) function varargout = handleCommand(ev3, command, varargin)
% Execute a CommunicationInterface-method given as a handle % Execute a CommunicationInterface-method given as a handle
% %
% As those methods have different, fixed numbers of output arguments, this quantity % As those methods have different, fixed numbers of output arguments, this quantity
...@@ -467,16 +467,16 @@ classdef EV3 < MaskedHandle ...@@ -467,16 +467,16 @@ classdef EV3 < MaskedHandle
end end
if ev3.debug if ev3.debug
fprintf('(DEBUG) Sending %s\n', func2str(commandHandle)); fprintf('(DEBUG) Sending %s\n', func2str(command));
end end
% Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to % Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to
% do this ugly workaround using strings. See % do this ugly workaround using strings. See
% https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method % https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method
nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(commandHandle))); nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(command)));
try try
[varargout{1:nOut}] = commandHandle(ev3.commInterface, varargin{:}); [varargout{1:nOut}] = command(ev3.commInterface, varargin{:});
catch ME catch ME
%ev3.detectedCommError(ME.identifier, ME.message); %ev3.detectedCommError(ME.identifier, ME.message);
if ~isempty(strfind(exceptionID, 'CommError')) if ~isempty(strfind(exceptionID, 'CommError'))
......
...@@ -885,7 +885,7 @@ classdef Motor < MaskedHandle & dynamicprops ...@@ -885,7 +885,7 @@ classdef Motor < MaskedHandle & dynamicprops
end end
methods (Access = private) % Private functions that directly interact with commLayer methods (Access = private) % Private functions that directly interact with commLayer
function varargout = handleCommand(motor, commandHandle, checkDevice, varargin) function varargout = handleCommand(motor, command, checkDevice, varargin)
% Execute a CommunicationInterface-method given as a handle % Execute a CommunicationInterface-method given as a handle
% %
% As those methods have different, fixed numbers of output arguments, this quantity % As those methods have different, fixed numbers of output arguments, this quantity
...@@ -905,15 +905,15 @@ classdef Motor < MaskedHandle & dynamicprops ...@@ -905,15 +905,15 @@ classdef Motor < MaskedHandle & dynamicprops
end end
if motor.debug if motor.debug
fprintf('(DEBUG) Sending %s\n', func2str(commandHandle)); fprintf('(DEBUG) Sending %s\n', func2str(command));
end end
% Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to % Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to
% do this ugly workaround using strings. See % do this ugly workaround using strings. See
% https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method % https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method
nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(commandHandle))); nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(command)));
try try
[varargout{1:nOut}] = commandHandle(motor.commInterface, varargin{:}); [varargout{1:nOut}] = command(motor.commInterface, varargin{:});
catch ME catch ME
if ~isempty(strfind(ME.identifier, 'CommError')) if ~isempty(strfind(ME.identifier, 'CommError'))
warning('Lost connection to the Brick!'); warning('Lost connection to the Brick!');
......
...@@ -444,7 +444,7 @@ classdef Sensor < MaskedHandle ...@@ -444,7 +444,7 @@ classdef Sensor < MaskedHandle
end end
end end
function varargout = handleCommand(sensor, commandHandle, checkDevice, varargin) function varargout = handleCommand(sensor, command, checkDevice, varargin)
% Execute a CommunicationInterface-method given as a handle % Execute a CommunicationInterface-method given as a handle
% %
% As those methods have different, fixed numbers of output arguments, this quantity % As those methods have different, fixed numbers of output arguments, this quantity
...@@ -464,15 +464,15 @@ classdef Sensor < MaskedHandle ...@@ -464,15 +464,15 @@ classdef Sensor < MaskedHandle
end end
if sensor.debug if sensor.debug
fprintf('(DEBUG) Sending %s\n', func2str(commandHandle)); fprintf('(DEBUG) Sending %s\n', func2str(command));
end end
% Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to % Note: Arrg. MATLAB does not support nargout for class methods directly, so I have to
% do this ugly workaround using strings. See % do this ugly workaround using strings. See
% https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method % https://de.mathworks.com/matlabcentral/answers/96617-how-can-i-use-nargin-nargout-to-determine-the-number-of-input-output-arguments-of-an-object-method
nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(commandHandle))); nOut = nargout(strcat('CommunicationInterface>CommunicationInterface.', func2str(command)));
try try
[varargout{1:nOut}] = commandHandle(sensor.commInterface, varargin{:}); [varargout{1:nOut}] = command(sensor.commInterface, varargin{:});
catch ME catch ME
%sensor.ev3Handle.detectedCommError(ME.identifier, ME.message); %sensor.ev3Handle.detectedCommError(ME.identifier, ME.message);
if ~isempty(strfind(ME.identifier, 'CommError')) if ~isempty(strfind(ME.identifier, 'CommError'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment