diff --git a/source/hidapi.m b/source/hidapi.m index 014c4a15bd580b3e4ae956fbc1c9c32919832593..4542eea7c0501aafb2b6d358c84cadc1a2e1423e 100755 --- a/source/hidapi.m +++ b/source/hidapi.m @@ -116,7 +116,7 @@ classdef hidapi < handle end catch ME % Create own exception for clarification - id = [ID(), ':', 'LoadingLibraryError']; + id = [hid.slib, ':', 'LoadingLibraryError']; msg = strcat({'Could not load library '}, {hid.slib}, {'.'}); exception = MException(id, msg); @@ -124,7 +124,7 @@ classdef hidapi < handle if isempty(findstr(ME.identifier, 'LoadFailed')) ... && isempty(findstr(ME.identifier, 'ErrorLoadingLibrary')) ... && isempty(findstr(ME.identifier, 'ErrorInHeader')) - id = [ID(), ':', 'InvalidFileNameOrFileMissing']; + id = [hid.slib, ':', 'InvalidFileNameOrFileMissing']; msg = 'Invalid file names were given or files are not available.'; cause = MException(id, msg); exception = addCause(exception, cause); @@ -221,7 +221,7 @@ classdef hidapi < handle % (MMI) Assert error case (hid_open returns null-pointer in error case) assert(isLibPointerValid(newHandle)==1, ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to connect to USB device.'); hid.handle = newHandle; @@ -243,7 +243,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to close USB-connection because pointer to USB-device is already invalidated.'); % Close the connection @@ -275,7 +275,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to read USB-data because pointer to USB-device is invalidated.'); % Read data from HID device @@ -284,7 +284,7 @@ classdef hidapi < handle % (MMI) Check the response (No assert as there are multiple cases) if res < 1 % Error occurred - id = [ID(), ':', 'CommError']; + id = [hid.slib, ':', 'CommError']; % Narrow error down if res == -1 msg = 'Connection error (probably lost connection to device)'; @@ -335,7 +335,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to write to USB because pointer to USB-device is invalidated.'); % Write the message @@ -343,7 +343,7 @@ classdef hidapi < handle % (MMI) Check the response assert(res == length(wmsg), ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to write data via USB.'); end @@ -374,7 +374,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to read USB-data because pointer to USB-device is invalidated.'); % Get the HID info string @@ -382,7 +382,7 @@ classdef hidapi < handle % (MMI) Check the response assert(res~=-1, ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to read HID info string.'); % Return the string value @@ -408,7 +408,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to set USB-read-mode to non-blocking because pointer to USB-device is invalidated.'); % Set non blocking @@ -416,7 +416,7 @@ classdef hidapi < handle % (MMI) Check the response assert(res~=-1, ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to set USB-read-mode to non-blocking.'); end @@ -436,7 +436,7 @@ classdef hidapi < handle fprintf('hidapi init\n'); end - warning([ID(), ':', 'RedundantCall'], ... + warning([hid.slib, ':', 'RedundantCall'], ... 'The init-function gets called automatically when connecting!'); % Init device @@ -444,7 +444,7 @@ classdef hidapi < handle % (MMI) Check the response assert(res~=-1, ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to init USB-device.'); end @@ -463,7 +463,7 @@ classdef hidapi < handle fprintf('hidapi exit\n'); end - warning([ID(), ':', 'RedundantCall'], ... + warning([hid.slib, ':', 'RedundantCall'], ... 'The exit-function gets called automatically when disconnecting!'); % Exit device @@ -471,7 +471,7 @@ classdef hidapi < handle % (MMI) Check the response assert(res~=-1, ... - [ID(), ':', 'CommError'], ... + [hid.slib, ':', 'CommError'], ... 'Failed to exit USB-device.'); end @@ -494,7 +494,7 @@ classdef hidapi < handle % (MMI) Check if pointer is (unexpectedly) already invalidated assert(isLibPointerValid(hid.handle)==1, ... - [ID(), ':', 'InvalidHandle'], ... + [hid.slib, ':', 'InvalidHandle'], ... 'Failed to read USB-error-data because pointer to USB-device is invalidated.'); [~,str] = calllib(hid.slib,'hid_error',hid.handle);