From 6f733301249e6cb40f36cbfe94e8f15a91d8096a Mon Sep 17 00:00:00 2001 From: Tim Stadtmann <tim.stadtmann@rwth-aachen.de> Date: Tue, 12 Jul 2016 16:32:01 +0200 Subject: [PATCH] Change low-level access conn-handles Handles to, e.g., hidapi-library for USB or a serial port object for BT, can now only be accessed inside of BrickIO classes. --- source/BrickIO.m | 2 +- source/btBrickIO.m | 8 +++++--- source/usbBrickIO.m | 7 +++++-- source/wfBrickIO.m | 7 +++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/source/BrickIO.m b/source/BrickIO.m index a4c00c2..af73a92 100644 --- a/source/BrickIO.m +++ b/source/BrickIO.m @@ -12,7 +12,7 @@ % - The write function should be given a uint8 datatype as a parameter classdef BrickIO - properties (Abstract) + properties (Abstract, Access = 'protected') % connection handle handle end diff --git a/source/btBrickIO.m b/source/btBrickIO.m index 25c28bc..7896967 100644 --- a/source/btBrickIO.m +++ b/source/btBrickIO.m @@ -26,16 +26,18 @@ classdef btBrickIO < BrickIO properties - % connection handle - handle % debug input debug = 0; % bluetooth serial port serialPort = '/dev/rfcomm0' end + properties (Access = 'protected') + % connection handle + handle + end + methods - function brickIO = btBrickIO(debug,serialPort) %btBrickIO.btBrickIO Create a btBrickIO object % diff --git a/source/usbBrickIO.m b/source/usbBrickIO.m index 0d3825e..a3079e3 100644 --- a/source/usbBrickIO.m +++ b/source/usbBrickIO.m @@ -18,8 +18,6 @@ classdef usbBrickIO < BrickIO properties - % connection handle - handle % debug input debug = 0; % vendor ID (EV3 = 0x0694) @@ -32,6 +30,11 @@ classdef usbBrickIO < BrickIO nWriteBuffer = 1024; end + properties (Access = 'protected') + % connection handle + handle + end + methods function brickIO = usbBrickIO(varargin) %usbBrickIO.usbBrickIO Create a usbBrickIO object diff --git a/source/wfBrickIO.m b/source/wfBrickIO.m index e469c9b..b234c56 100644 --- a/source/wfBrickIO.m +++ b/source/wfBrickIO.m @@ -24,8 +24,6 @@ classdef wfBrickIO < BrickIO properties - % connection handle - handle % debug input debug = 0; % socket input strem @@ -40,6 +38,11 @@ classdef wfBrickIO < BrickIO serialNum = '0016533dbaf5'; end + properties (Access = 'protected') + % connection handle + handle + end + methods function brickIO = wfBrickIO(debug,addr,port,serialNum) -- GitLab