From 648c47a3f600a843eaa6e4e0b9c3e77394333b4e Mon Sep 17 00:00:00 2001 From: Thomas Pietrzak Date: Wed, 15 Feb 2012 13:39:26 +0000 Subject: [PATCH] First import Dwell buttons git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@45 47cf9a05-e0a8-4ed5-9e9b-101a649bc004 --- TactonLibrary.suo | Bin 24064 -> 24576 bytes TactonPlayer/TactonPlayer.cpp | 30 +++++++++++++++++++--- TactonPlayer/TactonPlayer.vcxproj | 8 +++--- TactonPlayer/TactonPlayer.vcxproj.filters | 12 --------- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/TactonLibrary.suo b/TactonLibrary.suo index 70e4b0443ee2254c7c108cfffc975293eca39965..592721446cd606d7c54e95e53ac64722c231c1a2 100644 GIT binary patch delta 2151 zcmbtVUrd`-6uUFjbf14>H=RsIU}oBUZR#dR*SvSAB47NppA3v-Jr zS&TlIIXN-g>zE_cZx2O{VAvvqD)FA;f|(As%J3*&N;-(ZhA2k~Xpx;Rsz2r&SwA#$ulPEGD`I zr4Lp8u&la#kSh=6Eezm%c2Ebd=xnSrm2#SOV4!2k~8dl#U=XW zRh|zV$4DGE62o^0EAn4yX{AB9R5?Ijf)&HCvGXxO5Y}YsQ_>imw_Z@ypp$RP*hA}2 z)D(;+q9G|7Is3}wOd=kN$0DKlxtWQ{iK%dO4(6LGAyuz~_uTa~jmdgJmc9zQ>Y563 zv5={5o@9CJa(+aCNV{{@0QX%6gJ;WM?tK{F0z%rQ@0_87JBIA3W}Neq;UR5u)IgxJ z5$-vxaK-I{*ALmjDXPn)G?m(1_+0QvEnbh?>vFVQhgFlDBi#zK{l(>{$t*s<-Z)e4 zdUYgY+xv6s(T`8Bi(oP96(RDzY+F@hReRIyi_2ng@Zo{Y+OJJtJvgo5Rv_i9f!X#w zbXT^(zuyiI{2nSdnj!eC$F7KwC7C-u41vKtP-L!yUji-~fzHPCKYgjTn!(L(C)NGE zBlN*Wn+k*;I}Nc~E~pMRG@o5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+ _comport = new SerialWindows(port); + } + catch(...) + { + } } TactonPlayer::~TactonPlayer() @@ -16,16 +22,21 @@ TactonPlayer::~TactonPlayer() void TactonPlayer::start() { - _comport->WriteData("S", 1); + if (_comport) + _comport->WriteData("S", 1); } void TactonPlayer::stop() { - _comport->WriteData("Q", 1); + if (_comport) + _comport->WriteData("Q", 1); } void TactonPlayer::regist(const Tacton &t) { + if (!_comport) + return; + unsigned int nbframes = t.getNbFrames(); unsigned char *buffer = new unsigned char[3 + 6 * nbframes]; buffer[0] = 'N'; @@ -38,6 +49,8 @@ void TactonPlayer::regist(const Tacton &t) unsigned int TactonPlayer::registFile(char *filename) { + if (!_comport) + return -1; unsigned int nb = 0; //load icons @@ -66,6 +79,8 @@ unsigned int TactonPlayer::registFile(char *filename) void TactonPlayer::play(unsigned char index) { + if (!_comport) + return; unsigned char buffer[2]; buffer[0] = 'T'; buffer[1] = index; @@ -74,6 +89,9 @@ void TactonPlayer::play(unsigned char index) void TactonPlayer::play(const Tacton &t) { + if (!_comport) + return; + unsigned int nbframes = t.getNbFrames(); unsigned char *buffer = new unsigned char[3 + 6 * nbframes]; buffer[0] = 'V'; @@ -86,6 +104,9 @@ void TactonPlayer::play(const Tacton &t) void TactonPlayer::schedule(unsigned char index, unsigned long timestamp) { + if (!_comport) + return; + unsigned char buffer[6]; buffer[0] = 'P'; buffer[1] = index; @@ -98,5 +119,6 @@ void TactonPlayer::schedule(unsigned char index, unsigned long timestamp) void TactonPlayer::debugRead(char *res, int nb) const { - _comport->ReadData(res, nb); + if (_comport) + _comport->ReadData(res, nb); } diff --git a/TactonPlayer/TactonPlayer.vcxproj b/TactonPlayer/TactonPlayer.vcxproj index 770df4b..7902274 100644 --- a/TactonPlayer/TactonPlayer.vcxproj +++ b/TactonPlayer/TactonPlayer.vcxproj @@ -51,10 +51,12 @@ Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;TACTONPLAYER_EXPORTS;%(PreprocessorDefinitions) 4996 + ArduinoSerial Windows true + arduinoserial.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) copy /y $(CodeAnalysisInputAssembly) C:\Windows\system\ @@ -72,12 +74,14 @@ copy /y $(OutDir)$(ProjectName).lib $(VSInstallDir)VC\lib true WIN32;NDEBUG;_WINDOWS;_USRDLL;TACTONPLAYER_EXPORTS;%(PreprocessorDefinitions) 4996 + ArduinoSerial Windows true true true + arduinoserial.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) REM copy /y $(CodeAnalysisInputAssembly) C:\Windows\system\ @@ -86,14 +90,10 @@ REM copy /y $(OutDir)$(ProjectName).lib $(VSInstallDir)VC\lib - - - - diff --git a/TactonPlayer/TactonPlayer.vcxproj.filters b/TactonPlayer/TactonPlayer.vcxproj.filters index 8f2e3f7..13e88f8 100644 --- a/TactonPlayer/TactonPlayer.vcxproj.filters +++ b/TactonPlayer/TactonPlayer.vcxproj.filters @@ -15,12 +15,6 @@ - - Header Files - - - Header Files - Header Files @@ -32,12 +26,6 @@ Source Files - - Source Files - - - Source Files - Source Files -- 2.30.2