diff --git a/telldus-core/common/Message.cpp b/telldus-core/common/Message.cpp index 290be250..56504d9e 100644 --- a/telldus-core/common/Message.cpp +++ b/telldus-core/common/Message.cpp @@ -42,20 +42,6 @@ void Message::addArgument(const char *value) { this->addArgument(TelldusCore::charToWstring(value)); } -std::wstring Message::charUnsignedToWstring(const unsigned char value) { - //todo move? - std::wstringstream st; - st << value; - return st.str(); -} - -std::wstring Message::intToWstring(int value) { - //todo move? - std::wstringstream st; - st << value; - return st.str(); -} - bool Message::nextIsInt(const std::wstring &message) { if (message.length() == 0) { return false; diff --git a/telldus-core/common/Message.h b/telldus-core/common/Message.h index 8ae7991a..cf63251d 100644 --- a/telldus-core/common/Message.h +++ b/telldus-core/common/Message.h @@ -14,8 +14,6 @@ namespace TelldusCore { void addArgument(int); void addArgument(const char *); - static std::wstring charUnsignedToWstring(const unsigned char value); - static std::wstring intToWstring(int value); static bool nextIsInt(const std::wstring &); static bool nextIsString(const std::wstring &); diff --git a/telldus-core/common/Strings.cpp b/telldus-core/common/Strings.cpp index 6b2d7484..d301ff1a 100644 --- a/telldus-core/common/Strings.cpp +++ b/telldus-core/common/Strings.cpp @@ -70,6 +70,12 @@ int TelldusCore::charToInteger(const char *input){ return retval; } +std::wstring TelldusCore::charUnsignedToWstring(const unsigned char value) { + std::wstringstream st; + st << value; + return st.str(); +} + /** * This method doesn't support all locales */ @@ -80,6 +86,12 @@ bool TelldusCore::comparei(std::wstring stringA, std::wstring stringB) { return stringA == stringB; } +std::wstring TelldusCore::intToWstring(int value) { + std::wstringstream st; + st << value; + return st.str(); +} + int TelldusCore::wideToInteger(const std::wstring &input){ std::wstringstream inputstream; inputstream << input; diff --git a/telldus-core/common/Strings.h b/telldus-core/common/Strings.h index 8b97792b..211c74a2 100644 --- a/telldus-core/common/Strings.h +++ b/telldus-core/common/Strings.h @@ -6,7 +6,10 @@ namespace TelldusCore { std::wstring charToWstring(const char *value); int charToInteger(const char *value); + std::wstring charUnsignedToWstring(const unsigned char value); + bool comparei(std::wstring stringA, std::wstring stringB); + std::wstring intToWstring(int value); std::string wideToString(const std::wstring &input); int wideToInteger(const std::wstring &input); diff --git a/telldus-core/service/Device.cpp b/telldus-core/service/Device.cpp index 4152c580..3e565472 100644 --- a/telldus-core/service/Device.cpp +++ b/telldus-core/service/Device.cpp @@ -203,7 +203,7 @@ int Device::maskUnsupportedMethods(int methods, int supportedMethods) { } // Execute -> On - if ((methods & TELLSTICK_EXECUTE) && !(supportedMethods & TELLSTICK_EXECUTE)) { //TODO ok everywhere? (check down/up too) + if ((methods & TELLSTICK_EXECUTE) && !(supportedMethods & TELLSTICK_EXECUTE)) { methods |= TELLSTICK_TURNON; } diff --git a/telldus-core/service/DeviceManager.cpp b/telldus-core/service/DeviceManager.cpp index 2a2efe23..358545b3 100644 --- a/telldus-core/service/DeviceManager.cpp +++ b/telldus-core/service/DeviceManager.cpp @@ -421,7 +421,7 @@ int DeviceManager::doAction(int deviceId, int action, unsigned char data){ } if(retval == TELLSTICK_SUCCESS && device->getType() != TELLSTICK_TYPE_SCENE && device->getMethods() & action) { //if method isn't explicitly supported by device, but used anyway as a fallback (i.e. bell), don't change state - std::wstring datastring = TelldusCore::Message::charUnsignedToWstring(data); + std::wstring datastring = TelldusCore::charUnsignedToWstring(data); if (this->triggerDeviceStateChange(deviceId, action, datastring)) { device->setLastSentCommand(action, datastring); d->set.setDeviceState(deviceId, action, datastring); @@ -467,7 +467,7 @@ int DeviceManager::doGroupAction(const std::wstring devices, const int action, c deviceReturnValue = doGroupAction(DeviceManager::getDeviceParameter(deviceId, L"devices", L""), action, data, childType, deviceId, duplicateDeviceIds); if(deviceReturnValue == TELLSTICK_SUCCESS) { - std::wstring datastring = TelldusCore::Message::charUnsignedToWstring(data); + std::wstring datastring = TelldusCore::charUnsignedToWstring(data); if (this->triggerDeviceStateChange(deviceId, action, datastring)) { DeviceManager::setDeviceLastSentCommand(deviceId, action, datastring); d->set.setDeviceState(deviceId, action, datastring); @@ -577,7 +577,6 @@ void DeviceManager::handleControllerMessage(const ControllerEventData &eventData std::list parameters = it->second->getParametersForProtocol(); bool thisDevice = true; for (std::list::iterator paramIt = parameters.begin(); paramIt != parameters.end(); ++paramIt){ - //TODO more efficient conversion/compare? wstring or not? if(!TelldusCore::comparei(it->second->getParameter(TelldusCore::charToWstring((*paramIt).c_str())), TelldusCore::charToWstring(msg.getParameter(*paramIt).c_str()))){ thisDevice = false; break;