Changeset 406874


Ignore:
Timestamp:
01/11/12 16:16:31 (4 months ago)
Author:
Stefan Persson <stefan.persson@…>
Branches:
('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
Children:
b0f092e98d602301ead905292420777c5da7640e
Parents:
d7cce515ff9fca11b5be98bf926bcc355c949294
git-author:
Stefan Persson <stefan.persson@telldus.se>2012-01-11 16:16:31+01:00
git-committer:
Stefan Persson <stefan.persson@telldus.se>2012-01-11 16:16:31+01:00
Message:

Setting for 'Not wait for confirmation from TellStick' implemented on windows too. This setting must be set manually. Closes #98

Location:
telldus-core/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • telldus-core/service/SettingsWinRegistry.cpp

    r86554b r406874  
    158158} 
    159159 
     160std::wstring Settings::getSetting(const std::wstring &strName) const{ 
     161        std::wstring strReturn; 
     162        HKEY hk; 
     163 
     164        std::wstring strCompleteRegPath = d->strRegPath; 
     165        long lnExists = RegOpenKeyEx(d->rootKey, strCompleteRegPath.c_str(), 0, KEY_QUERY_VALUE, &hk); 
     166                         
     167        if(lnExists == ERROR_SUCCESS){ 
     168                wchar_t* Buff = new wchar_t[intMaxRegValueLength]; 
     169                DWORD dwLength = sizeof(wchar_t)*intMaxRegValueLength; 
     170                long lngStatus = RegQueryValueEx(hk, strName.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength); 
     171 
     172                if(lngStatus == ERROR_MORE_DATA){ 
     173                        //The buffer is to small, recreate it 
     174                        delete Buff; 
     175                        Buff = new wchar_t[dwLength]; 
     176                        lngStatus = RegQueryValueEx(hk, strName.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength); 
     177                } 
     178                if (lngStatus == ERROR_SUCCESS) { 
     179                        strReturn = Buff; 
     180                } 
     181                delete Buff; 
     182        } 
     183        RegCloseKey(hk); 
     184        return strReturn; 
     185} 
     186 
    160187std::wstring Settings::getStringSetting(int intDeviceId, const std::wstring &name, bool parameter) const { 
    161188        std::wstring strReturn; 
  • telldus-core/service/TellStick_ftd2xx.cpp

    r0c8de2 r406874  
    1212#include "TellStick.h" 
    1313#include "Mutex.h" 
     14#include "Settings.h" 
    1415#include "Strings.h" 
    1516#include "Log.h" 
     
    2223class TellStick::PrivateData { 
    2324public: 
    24         bool open, running; 
     25        bool open, running, ignoreControllerConfirmation; 
    2526        int vid, pid, fwVersion; 
    2627        std::string serial, message; 
     
    5556        d->fwVersion = 0; 
    5657        d->serial = td.serial; 
     58        Settings set; 
     59        d->ignoreControllerConfirmation = set.getSetting(L"ignoreControllerConfirmation")==L"true"; 
    5760 
    5861        char *tempSerial = new char[td.serial.size()+1]; 
     
    227230        ftStatus = FT_Write(d->ftHandle, tempMessage, (DWORD)strMessage.length(), &bytesWritten); 
    228231        free(tempMessage); 
    229         if(strMessage == "noop"){ 
     232         
     233        if(d->ignoreControllerConfirmation || (strMessage == "N+" && ((pid() == 0x0C31 && firmwareVersion() < 5) || (pid() == 0x0C30 && firmwareVersion() < 6)))){ 
     234                //these firmware versions doesn't implement ack to noop, just check that the noop can be sent correctly 
    230235                if(c){ 
    231236                        return TELLSTICK_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.