From a4c6e62eafb7858ed8f6cb7136e50e913a876146 Mon Sep 17 00:00:00 2001 From: Tim Stadtmann <tim.stadtmann@rwth-aachen.de> Date: Fri, 28 Apr 2017 16:18:22 +0200 Subject: [PATCH] Make default BT-backend OS-dependent On linux/mac: MATLAB's virtual serial port implementation On windows: Instrument Control toolbox --- source/CommunicationInterface.m | 6 +++++- source/btBrickIO.m | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/CommunicationInterface.m b/source/CommunicationInterface.m index 4972fe0..7c222a5 100755 --- a/source/CommunicationInterface.m +++ b/source/CommunicationInterface.m @@ -200,7 +200,11 @@ classdef CommunicationInterface < handle defaultSerPort = '/dev/rfcomm0'; defaultBTDevice = 'EV3'; defaultBTChannel = 1; - defaultBackend = 'serial'; + if(ispc) + defaultBackend = 'instrumentControl'; + else + defaultBackend = 'serial'; + end defaultDebug = false; % Define anonymous functions that will return whether given value in varargin is valid diff --git a/source/btBrickIO.m b/source/btBrickIO.m index a11bfc8..5ed51f7 100755 --- a/source/btBrickIO.m +++ b/source/btBrickIO.m @@ -48,7 +48,6 @@ classdef btBrickIO < BrickIO end methods - %function brickIO = btBrickIO(debug,serialPort,backend) function brickIO = btBrickIO(brickIO, varargin) %btBrickIO.btBrickIO Create a btBrickIO object % @@ -64,7 +63,11 @@ classdef btBrickIO < BrickIO p.addOptional('deviceName', 'EV3'); p.addOptional('channel', 1); p.addOptional('timeOut', 10); - p.addOptional('backend', 'serial'); + if(ispc == 1) + p.addOptional('backend', 'instrumentControl'); + else + p.addOptional('backend', 'serial'); + end p.parse(varargin{:}); -- GitLab