random ai stuff
This commit is contained in:
131
telldus-core/client/CMakeLists.txt
Normal file
131
telldus-core/client/CMakeLists.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
IF(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
ENDIF(COMMAND cmake_policy)
|
||||
|
||||
FIND_PACKAGE( SignTool REQUIRED )
|
||||
|
||||
######## Non configurable options ########
|
||||
SET( telldus-core_SRCS
|
||||
CallbackDispatcher.cpp
|
||||
CallbackMainDispatcher.cpp
|
||||
Client.cpp
|
||||
telldus-core.cpp
|
||||
)
|
||||
|
||||
SET( telldus-core_HDRS
|
||||
CallbackDispatcher.h
|
||||
CallbackMainDispatcher.cpp
|
||||
Client.h
|
||||
)
|
||||
SET( telldus-core_PUB_HDRS
|
||||
telldus-core.h
|
||||
)
|
||||
|
||||
FIND_PACKAGE(Threads)
|
||||
LIST(APPEND telldus-core_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
|
||||
|
||||
######## Configurable options for the platform ########
|
||||
|
||||
|
||||
|
||||
######## Platforms-specific, non configurable ########
|
||||
|
||||
IF (APPLE)
|
||||
#### Mac OS X ####
|
||||
SET( telldus-core_TARGET TelldusCore )
|
||||
ADD_DEFINITIONS(
|
||||
-D_MACOSX
|
||||
)
|
||||
LIST(APPEND telldus-core_LIBRARIES
|
||||
TelldusCommon
|
||||
)
|
||||
ELSEIF (WIN32)
|
||||
#### Windows ####
|
||||
ADD_DEFINITIONS( -DUNICODE )
|
||||
ADD_DEFINITIONS( /Zc:wchar_t- ) # Treat wchar_t as Built-in Type' = No
|
||||
SET( telldus-core_TARGET TelldusCore )
|
||||
LIST(APPEND telldus-core_LIBRARIES
|
||||
TelldusCommon
|
||||
)
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/telldus-core.rc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/telldus-core.rc
|
||||
)
|
||||
LIST(APPEND telldus-core_SRCS
|
||||
libtelldus-core.def
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/telldus-core.rc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/telldus-core.rc
|
||||
)
|
||||
ADD_DEFINITIONS(
|
||||
-D_WINDOWS
|
||||
-DTELLDUSCORE_EXPORTS
|
||||
)
|
||||
IF (CMAKE_CL_64)
|
||||
ADD_DEFINITIONS(-D_CL64)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ELSE (APPLE)
|
||||
#### Linux ####
|
||||
SET( telldus-core_TARGET telldus-core )
|
||||
LIST(APPEND telldus-core_LIBRARIES
|
||||
TelldusCommon
|
||||
)
|
||||
|
||||
ADD_DEFINITIONS(
|
||||
-D_LINUX
|
||||
)
|
||||
ENDIF (APPLE)
|
||||
|
||||
|
||||
|
||||
######## Configuring ########
|
||||
|
||||
ADD_LIBRARY(${telldus-core_TARGET} SHARED
|
||||
${telldus-core_SRCS}
|
||||
${telldus-core_HDRS}
|
||||
${telldus-core_PUB_HDRS}
|
||||
)
|
||||
|
||||
#Copy public headers files on windows
|
||||
IF (WIN32)
|
||||
FOREACH(_FILE ${telldus-core_PUB_HDRS})
|
||||
ADD_CUSTOM_COMMAND( TARGET ${telldus-core_TARGET}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy \"${CMAKE_CURRENT_SOURCE_DIR}/${_FILE}\" \"${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}\"
|
||||
COMMENT "Copy ${_FILE}"
|
||||
)
|
||||
ENDFOREACH(_FILE)
|
||||
ENDIF ()
|
||||
|
||||
ADD_DEPENDENCIES(${telldus-core_TARGET} TelldusCommon)
|
||||
|
||||
IF (UNIX)
|
||||
SET_TARGET_PROPERTIES( ${telldus-core_TARGET} PROPERTIES COMPILE_FLAGS "-fPIC -fvisibility=hidden")
|
||||
ENDIF (UNIX)
|
||||
|
||||
TARGET_LINK_LIBRARIES( ${telldus-core_TARGET} ${telldus-core_LIBRARIES} )
|
||||
|
||||
SET(telldus-core_TARGET ${telldus-core_TARGET} PARENT_SCOPE)
|
||||
SET_TARGET_PROPERTIES(${telldus-core_TARGET} PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
INSTALL_NAME_DIR "/Library/Frameworks"
|
||||
PUBLIC_HEADER ${telldus-core_PUB_HDRS}
|
||||
VERSION ${PACKAGE_VERSION}
|
||||
SOVERSION ${PACKAGE_SOVERSION}
|
||||
)
|
||||
SIGN(${telldus-core_TARGET})
|
||||
|
||||
IF (NOT LIB_INSTALL_DIR)
|
||||
SET(LIB_INSTALL_DIR "lib")
|
||||
ENDIF (NOT LIB_INSTALL_DIR)
|
||||
|
||||
IF (UNIX)
|
||||
INSTALL(TARGETS ${telldus-core_TARGET}
|
||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
||||
FRAMEWORK DESTINATION "/Library/Frameworks"
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
)
|
||||
ENDIF (UNIX)
|
||||
|
||||
139
telldus-core/client/CallbackDispatcher.cpp
Normal file
139
telldus-core/client/CallbackDispatcher.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* CallbackDispatcher.cpp
|
||||
* telldus-core
|
||||
*
|
||||
* Created by Micke Prag on 2010-11-02.
|
||||
* Copyright 2010 Telldus Technologies AB. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "client/CallbackDispatcher.h"
|
||||
#include "common/Event.h"
|
||||
#include "common/EventHandler.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
|
||||
class TDEventDispatcher::PrivateData {
|
||||
public:
|
||||
EventHandler eventHandler;
|
||||
EventRef stopEvent, callbackEvent;
|
||||
int id;
|
||||
void *func, *context;
|
||||
};
|
||||
|
||||
TDEventDispatcher::TDEventDispatcher(int id, void *func, void *context)
|
||||
:Thread() {
|
||||
d = new PrivateData;
|
||||
d->stopEvent = d->eventHandler.addEvent();
|
||||
d->callbackEvent = d->eventHandler.addEvent();
|
||||
d->id = id;
|
||||
d->func = func;
|
||||
d->context = context;
|
||||
this->start();
|
||||
}
|
||||
|
||||
TDEventDispatcher::~TDEventDispatcher() {
|
||||
d->stopEvent->signal();
|
||||
this->wait();
|
||||
delete d;
|
||||
}
|
||||
|
||||
int TDEventDispatcher::id() const {
|
||||
return d->id;
|
||||
}
|
||||
|
||||
void TDEventDispatcher::queue(EventDataRef eventData) {
|
||||
d->callbackEvent->signal(eventData);
|
||||
}
|
||||
|
||||
void TDEventDispatcher::run() {
|
||||
while (!d->stopEvent->isSignaled()) {
|
||||
d->eventHandler.waitForAny();
|
||||
if (d->callbackEvent->isSignaled()) {
|
||||
TelldusCore::EventDataRef eventData = d->callbackEvent->takeSignal();
|
||||
this->execute(eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TDDeviceEventDispatcher::TDDeviceEventDispatcher(int id, void *func, void *context)
|
||||
:TDEventDispatcher(id, func, context)
|
||||
{}
|
||||
|
||||
void TDDeviceEventDispatcher::execute(EventDataRef eventData) {
|
||||
DeviceEventCallbackData *data = dynamic_cast<DeviceEventCallbackData *>(eventData.get());
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
((TDDeviceEvent)d->func)(data->deviceId, data->deviceState, data->deviceStateValue.c_str(), d->id, d->context);
|
||||
}
|
||||
|
||||
CallbackStruct::CallbackType TDDeviceEventDispatcher::type() {
|
||||
return CallbackStruct::DeviceEvent;
|
||||
}
|
||||
|
||||
TDDeviceChangeEventDispatcher::TDDeviceChangeEventDispatcher(int id, void *func, void *context)
|
||||
:TDEventDispatcher(id, func, context)
|
||||
{}
|
||||
|
||||
void TDDeviceChangeEventDispatcher::execute(EventDataRef eventData) {
|
||||
DeviceChangeEventCallbackData *data = dynamic_cast<DeviceChangeEventCallbackData *>(eventData.get());
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
((TDDeviceChangeEvent)d->func)(data->deviceId, data->changeEvent, data->changeType, d->id, d->context);
|
||||
}
|
||||
|
||||
CallbackStruct::CallbackType TDDeviceChangeEventDispatcher::type() {
|
||||
return CallbackStruct::DeviceChangeEvent;
|
||||
}
|
||||
|
||||
TDRawDeviceEventDispatcher::TDRawDeviceEventDispatcher(int id, void *func, void *context)
|
||||
:TDEventDispatcher(id, func, context)
|
||||
{}
|
||||
|
||||
void TDRawDeviceEventDispatcher::execute(EventDataRef eventData) {
|
||||
RawDeviceEventCallbackData *data = dynamic_cast<RawDeviceEventCallbackData *>(eventData.get());
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
((TDRawDeviceEvent)d->func)(data->data.c_str(), data->controllerId, d->id, d->context);
|
||||
}
|
||||
|
||||
CallbackStruct::CallbackType TDRawDeviceEventDispatcher::type() {
|
||||
return CallbackStruct::RawDeviceEvent;
|
||||
}
|
||||
|
||||
TDSensorEventDispatcher::TDSensorEventDispatcher(int id, void *func, void *context)
|
||||
:TDEventDispatcher(id, func, context)
|
||||
{}
|
||||
|
||||
void TDSensorEventDispatcher::execute(EventDataRef eventData) {
|
||||
SensorEventCallbackData *data = dynamic_cast<SensorEventCallbackData *>(eventData.get());
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
((TDSensorEvent)d->func)(data->protocol.c_str(), data->model.c_str(), data->id, data->dataType, data->value.c_str(), data->timestamp, d->id, d->context);
|
||||
}
|
||||
|
||||
CallbackStruct::CallbackType TDSensorEventDispatcher::type() {
|
||||
return CallbackStruct::SensorEvent;
|
||||
}
|
||||
|
||||
TDControllerEventDispatcher::TDControllerEventDispatcher(int id, void *func, void *context)
|
||||
:TDEventDispatcher(id, func, context)
|
||||
{}
|
||||
|
||||
void TDControllerEventDispatcher::execute(EventDataRef eventData) {
|
||||
ControllerEventCallbackData *data = dynamic_cast<ControllerEventCallbackData *>(eventData.get());
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
((TDControllerEvent)d->func)(data->controllerId, data->changeEvent, data->changeType, data->newValue.c_str(), d->id, d->context);
|
||||
}
|
||||
|
||||
CallbackStruct::CallbackType TDControllerEventDispatcher::type() {
|
||||
return CallbackStruct::ControllerEvent;
|
||||
}
|
||||
|
||||
} // namespace TelldusCore
|
||||
129
telldus-core/client/CallbackDispatcher.h
Normal file
129
telldus-core/client/CallbackDispatcher.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* CallbackDispatcher.h
|
||||
* telldus-core
|
||||
*
|
||||
* Created by Micke Prag on 2010-11-02.
|
||||
* Copyright 2010 Telldus Technologies AB. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TELLDUS_CORE_CLIENT_CALLBACKDISPATCHER_H_
|
||||
#define TELLDUS_CORE_CLIENT_CALLBACKDISPATCHER_H_
|
||||
|
||||
#include <string>
|
||||
#include "common/common.h"
|
||||
#include "common/Event.h"
|
||||
#include "common/Thread.h"
|
||||
#include "common/Mutex.h"
|
||||
#include "client/telldus-core.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
|
||||
struct CallbackStruct {
|
||||
enum CallbackType { DeviceEvent, DeviceChangeEvent, RawDeviceEvent, SensorEvent, ControllerEvent };
|
||||
CallbackType type;
|
||||
void *event;
|
||||
int id;
|
||||
void *context;
|
||||
TelldusCore::Mutex mutex;
|
||||
};
|
||||
|
||||
class CallbackData: public EventDataBase {
|
||||
public:
|
||||
explicit CallbackData(CallbackStruct::CallbackType t) : EventDataBase(), type(t) {}
|
||||
CallbackStruct::CallbackType type;
|
||||
};
|
||||
|
||||
class DeviceEventCallbackData : public CallbackData {
|
||||
public:
|
||||
DeviceEventCallbackData() : CallbackData(CallbackStruct::DeviceEvent) {}
|
||||
int deviceId;
|
||||
int deviceState;
|
||||
std::string deviceStateValue;
|
||||
};
|
||||
class DeviceChangeEventCallbackData : public CallbackData {
|
||||
public:
|
||||
DeviceChangeEventCallbackData() : CallbackData(CallbackStruct::DeviceChangeEvent) {}
|
||||
int deviceId;
|
||||
int changeEvent;
|
||||
int changeType;
|
||||
};
|
||||
|
||||
class RawDeviceEventCallbackData : public CallbackData {
|
||||
public:
|
||||
RawDeviceEventCallbackData() : CallbackData(CallbackStruct::RawDeviceEvent) {}
|
||||
std::string data;
|
||||
int controllerId;
|
||||
};
|
||||
|
||||
class SensorEventCallbackData : public CallbackData {
|
||||
public:
|
||||
SensorEventCallbackData() : CallbackData(CallbackStruct::SensorEvent) {}
|
||||
std::string protocol;
|
||||
std::string model;
|
||||
int id;
|
||||
int dataType;
|
||||
std::string value;
|
||||
int timestamp;
|
||||
};
|
||||
class ControllerEventCallbackData : public CallbackData {
|
||||
public:
|
||||
ControllerEventCallbackData() : CallbackData(CallbackStruct::ControllerEvent) {}
|
||||
int controllerId;
|
||||
int changeEvent;
|
||||
int changeType;
|
||||
std::string newValue;
|
||||
};
|
||||
|
||||
class TDEventDispatcher : public Thread {
|
||||
public:
|
||||
TDEventDispatcher(int id, void *func, void *context);
|
||||
virtual ~TDEventDispatcher();
|
||||
int id() const;
|
||||
void queue(EventDataRef eventData);
|
||||
virtual CallbackStruct::CallbackType type() = 0;
|
||||
protected:
|
||||
class PrivateData;
|
||||
PrivateData *d;
|
||||
|
||||
virtual void run();
|
||||
virtual void execute(EventDataRef eventData) = 0;
|
||||
};
|
||||
class TDDeviceEventDispatcher : public TDEventDispatcher {
|
||||
public:
|
||||
TDDeviceEventDispatcher(int id, void *func, void *context);
|
||||
virtual CallbackStruct::CallbackType type();
|
||||
protected:
|
||||
virtual void execute(EventDataRef eventData);
|
||||
};
|
||||
class TDDeviceChangeEventDispatcher : public TDEventDispatcher {
|
||||
public:
|
||||
TDDeviceChangeEventDispatcher(int id, void *func, void *context);
|
||||
virtual CallbackStruct::CallbackType type();
|
||||
protected:
|
||||
virtual void execute(EventDataRef eventData);
|
||||
};
|
||||
class TDRawDeviceEventDispatcher : public TDEventDispatcher {
|
||||
public:
|
||||
TDRawDeviceEventDispatcher(int id, void *func, void *context);
|
||||
virtual CallbackStruct::CallbackType type();
|
||||
protected:
|
||||
virtual void execute(EventDataRef eventData);
|
||||
};
|
||||
class TDSensorEventDispatcher : public TDEventDispatcher {
|
||||
public:
|
||||
TDSensorEventDispatcher(int id, void *func, void *context);
|
||||
virtual CallbackStruct::CallbackType type();
|
||||
protected:
|
||||
virtual void execute(EventDataRef eventData);
|
||||
};
|
||||
class TDControllerEventDispatcher : public TDEventDispatcher {
|
||||
public:
|
||||
TDControllerEventDispatcher(int id, void *func, void *context);
|
||||
virtual CallbackStruct::CallbackType type();
|
||||
protected:
|
||||
virtual void execute(EventDataRef eventData);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TELLDUS_CORE_CLIENT_CALLBACKDISPATCHER_H_
|
||||
95
telldus-core/client/CallbackMainDispatcher.cpp
Normal file
95
telldus-core/client/CallbackMainDispatcher.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* CallbackMainDispatcher.cpp
|
||||
* telldus-core
|
||||
*
|
||||
* Created by Stefan Persson on 2012-02-23.
|
||||
* Copyright 2012 Telldus Technologies AB. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "client/CallbackMainDispatcher.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace TelldusCore {
|
||||
|
||||
typedef std::list<TelldusCore::TDEventDispatcher *> CallbackList;
|
||||
|
||||
class CallbackMainDispatcher::PrivateData {
|
||||
public:
|
||||
Mutex mutex;
|
||||
CallbackList callbackList;
|
||||
int lastCallbackId;
|
||||
};
|
||||
|
||||
CallbackMainDispatcher::CallbackMainDispatcher() {
|
||||
d = new PrivateData;
|
||||
d->lastCallbackId = 0;
|
||||
}
|
||||
|
||||
CallbackMainDispatcher::~CallbackMainDispatcher(void) {
|
||||
{
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
for(CallbackList::iterator it = d->callbackList.begin(); it != d->callbackList.end(); ++it) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void CallbackMainDispatcher::execute(CallbackStruct::CallbackType type, EventData *eventData) {
|
||||
{
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
EventDataRef eventDataRef(eventData);
|
||||
for(CallbackList::iterator callback_it = d->callbackList.begin(); callback_it != d->callbackList.end(); ++callback_it) {
|
||||
if ( (*callback_it)->type() != type ) {
|
||||
continue;
|
||||
}
|
||||
(*callback_it)->queue(eventDataRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CallbackMainDispatcher::registerCallback(CallbackStruct::CallbackType type, void *eventFunction, void *context) {
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
int id = ++d->lastCallbackId;
|
||||
TelldusCore::TDEventDispatcher *callback;
|
||||
if (type == CallbackStruct::DeviceEvent) {
|
||||
callback = new TelldusCore::TDDeviceEventDispatcher(id, eventFunction, context);
|
||||
} else if (type == CallbackStruct::DeviceChangeEvent) {
|
||||
callback = new TelldusCore::TDDeviceChangeEventDispatcher(id, eventFunction, context);
|
||||
} else if (type == CallbackStruct::RawDeviceEvent) {
|
||||
callback = new TelldusCore::TDRawDeviceEventDispatcher(id, eventFunction, context);
|
||||
} else if (type == CallbackStruct::SensorEvent) {
|
||||
callback = new TelldusCore::TDSensorEventDispatcher(id, eventFunction, context);
|
||||
} else if (type == CallbackStruct::ControllerEvent) {
|
||||
callback = new TelldusCore::TDControllerEventDispatcher(id, eventFunction, context);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
d->callbackList.push_back(callback);
|
||||
return id;
|
||||
}
|
||||
|
||||
int CallbackMainDispatcher::unregisterCallback(int callbackId) {
|
||||
CallbackList newEventList;
|
||||
{
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
for(CallbackList::iterator callback_it = d->callbackList.begin(); callback_it != d->callbackList.end(); ++callback_it) {
|
||||
if ( (*callback_it)->id() != callbackId ) {
|
||||
continue;
|
||||
}
|
||||
newEventList.splice(newEventList.begin(), d->callbackList, callback_it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (newEventList.size()) {
|
||||
CallbackList::iterator it = newEventList.begin();
|
||||
delete (*it);
|
||||
newEventList.erase(it);
|
||||
return TELLSTICK_SUCCESS;
|
||||
}
|
||||
return TELLSTICK_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
} // namespace TelldusCore
|
||||
35
telldus-core/client/CallbackMainDispatcher.h
Normal file
35
telldus-core/client/CallbackMainDispatcher.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* CallbackMainDispatcher.h
|
||||
* telldus-core
|
||||
*
|
||||
* Created by Stefan Persson on 2012-02-23.
|
||||
* Copyright 2012 Telldus Technologies AB. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALLBACKMAINDISPATCHER_H
|
||||
#define CALLBACKMAINDISPATCHER_H
|
||||
|
||||
#include "client/CallbackDispatcher.h"
|
||||
#include "common/Thread.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
|
||||
class CallbackMainDispatcher
|
||||
{
|
||||
public:
|
||||
CallbackMainDispatcher(void);
|
||||
~CallbackMainDispatcher(void);
|
||||
|
||||
void execute(TelldusCore::CallbackStruct::CallbackType type, EventData *eventData);
|
||||
|
||||
int registerCallback( TelldusCore::CallbackStruct::CallbackType type, void *eventFunction, void *context );
|
||||
int unregisterCallback( int callbackId );
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
PrivateData *d;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //CALLBACKMAINDISPATCHER_H
|
||||
269
telldus-core/client/Client.cpp
Normal file
269
telldus-core/client/Client.cpp
Normal file
@@ -0,0 +1,269 @@
|
||||
//
|
||||
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "client/Client.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "client/CallbackDispatcher.h"
|
||||
#include "client/CallbackMainDispatcher.h"
|
||||
#include "common/Socket.h"
|
||||
#include "common/Strings.h"
|
||||
#include "common/Mutex.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
|
||||
class Client::PrivateData {
|
||||
public:
|
||||
Socket eventSocket;
|
||||
bool running, sensorCached, controllerCached;
|
||||
std::wstring sensorCache, controllerCache;
|
||||
TelldusCore::Mutex mutex;
|
||||
CallbackMainDispatcher callbackMainDispatcher;
|
||||
};
|
||||
|
||||
Client *Client::instance = 0;
|
||||
|
||||
Client::Client()
|
||||
: Thread() {
|
||||
d = new PrivateData;
|
||||
d->running = true;
|
||||
d->sensorCached = false;
|
||||
d->controllerCached = false;
|
||||
start();
|
||||
}
|
||||
|
||||
Client::~Client(void) {
|
||||
stopThread();
|
||||
wait();
|
||||
{
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Client::close() {
|
||||
if (Client::instance != 0) {
|
||||
delete Client::instance;
|
||||
Client::instance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Client *Client::getInstance() {
|
||||
if (Client::instance == 0) {
|
||||
Client::instance = new Client();
|
||||
}
|
||||
return Client::instance;
|
||||
}
|
||||
|
||||
bool Client::getBoolFromService(const Message &msg) {
|
||||
return getIntegerFromService(msg) == TELLSTICK_SUCCESS;
|
||||
}
|
||||
|
||||
int Client::getIntegerFromService(const Message &msg) {
|
||||
std::wstring response = sendToService(msg);
|
||||
if (response.compare(L"") == 0) {
|
||||
return TELLSTICK_ERROR_COMMUNICATING_SERVICE;
|
||||
}
|
||||
return Message::takeInt(&response);
|
||||
}
|
||||
|
||||
std::wstring Client::getWStringFromService(const Message &msg) {
|
||||
std::wstring response = sendToService(msg);
|
||||
return Message::takeString(&response);
|
||||
}
|
||||
|
||||
int Client::registerEvent( CallbackStruct::CallbackType type, void *eventFunction, void *context ) {
|
||||
return d->callbackMainDispatcher.registerCallback(type, eventFunction, context );
|
||||
}
|
||||
|
||||
void Client::run() {
|
||||
// listen here
|
||||
d->eventSocket.connect(L"TelldusEvents");
|
||||
|
||||
while(d->running) {
|
||||
if(!d->eventSocket.isConnected()) {
|
||||
d->eventSocket.connect(L"TelldusEvents"); // try to reconnect to service
|
||||
if(!d->eventSocket.isConnected()) {
|
||||
// reconnect didn't succeed, wait a while and try again
|
||||
msleep(2000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring clientMessage = d->eventSocket.read(1000); // testing 5 second timeout
|
||||
|
||||
while(clientMessage != L"") {
|
||||
// a message arrived
|
||||
std::wstring type = Message::takeString(&clientMessage);
|
||||
if(type == L"TDDeviceChangeEvent") {
|
||||
DeviceChangeEventCallbackData *data = new DeviceChangeEventCallbackData();
|
||||
data->deviceId = Message::takeInt(&clientMessage);
|
||||
data->changeEvent = Message::takeInt(&clientMessage);
|
||||
data->changeType = Message::takeInt(&clientMessage);
|
||||
d->callbackMainDispatcher.execute(CallbackStruct::DeviceChangeEvent, data);
|
||||
|
||||
} else if(type == L"TDDeviceEvent") {
|
||||
DeviceEventCallbackData *data = new DeviceEventCallbackData();
|
||||
data->deviceId = Message::takeInt(&clientMessage);
|
||||
data->deviceState = Message::takeInt(&clientMessage);
|
||||
data->deviceStateValue = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
d->callbackMainDispatcher.execute(CallbackStruct::DeviceEvent, data);
|
||||
|
||||
} else if(type == L"TDRawDeviceEvent") {
|
||||
RawDeviceEventCallbackData *data = new RawDeviceEventCallbackData();
|
||||
data->data = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
data->controllerId = Message::takeInt(&clientMessage);
|
||||
d->callbackMainDispatcher.execute(CallbackStruct::RawDeviceEvent, data);
|
||||
|
||||
} else if(type == L"TDSensorEvent") {
|
||||
SensorEventCallbackData *data = new SensorEventCallbackData();
|
||||
data->protocol = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
data->model = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
data->id = Message::takeInt(&clientMessage);
|
||||
data->dataType = Message::takeInt(&clientMessage);
|
||||
data->value = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
data->timestamp = Message::takeInt(&clientMessage);
|
||||
d->callbackMainDispatcher.execute(CallbackStruct::SensorEvent, data);
|
||||
|
||||
} else if(type == L"TDControllerEvent") {
|
||||
ControllerEventCallbackData *data = new ControllerEventCallbackData();
|
||||
data->controllerId = Message::takeInt(&clientMessage);
|
||||
data->changeEvent = Message::takeInt(&clientMessage);
|
||||
data->changeType = Message::takeInt(&clientMessage);
|
||||
data->newValue = TelldusCore::wideToString(Message::takeString(&clientMessage));
|
||||
d->callbackMainDispatcher.execute(CallbackStruct::ControllerEvent, data);
|
||||
|
||||
} else {
|
||||
clientMessage = L""; // cleanup, if message contained garbage/unhandled data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring Client::sendToService(const Message &msg) {
|
||||
int tries = 0;
|
||||
std::wstring readData;
|
||||
while(tries < 20) {
|
||||
tries++;
|
||||
if(tries == 20) {
|
||||
TelldusCore::Message msg;
|
||||
msg.addArgument(TELLSTICK_ERROR_CONNECTING_SERVICE);
|
||||
return msg;
|
||||
}
|
||||
Socket s;
|
||||
s.connect(L"TelldusClient");
|
||||
if (!s.isConnected()) { // sConnection failed
|
||||
msleep(500);
|
||||
continue; // retry
|
||||
}
|
||||
s.write(msg.data());
|
||||
if (!s.isConnected()) { // Connection failed sometime during operation... (better check here, instead of 5 seconds timeout later)
|
||||
msleep(500);
|
||||
continue; // retry
|
||||
}
|
||||
readData = s.read(1000);
|
||||
if(readData == L"") {
|
||||
msleep(500);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!s.isConnected()) { // Connection failed sometime during operation...
|
||||
msleep(500);
|
||||
continue; // retry
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return readData;
|
||||
}
|
||||
|
||||
void Client::stopThread() {
|
||||
d->running = false;
|
||||
d->eventSocket.stopReadWait();
|
||||
}
|
||||
|
||||
int Client::unregisterCallback( int callbackId ) {
|
||||
return d->callbackMainDispatcher.unregisterCallback(callbackId);
|
||||
}
|
||||
|
||||
int Client::getSensor(char *protocol, int protocolLen, char *model, int modelLen, int *sensorId, int *dataTypes) {
|
||||
if (!d->sensorCached) {
|
||||
Message msg(L"tdSensor");
|
||||
std::wstring response = Client::getWStringFromService(msg);
|
||||
int count = Message::takeInt(&response);
|
||||
d->sensorCached = true;
|
||||
d->sensorCache = L"";
|
||||
if (count > 0) {
|
||||
d->sensorCache = response;
|
||||
}
|
||||
}
|
||||
|
||||
if (d->sensorCache == L"") {
|
||||
d->sensorCached = false;
|
||||
return TELLSTICK_ERROR_DEVICE_NOT_FOUND;
|
||||
}
|
||||
|
||||
std::wstring p = Message::takeString(&d->sensorCache);
|
||||
std::wstring m = Message::takeString(&d->sensorCache);
|
||||
int id = Message::takeInt(&d->sensorCache);
|
||||
int dt = Message::takeInt(&d->sensorCache);
|
||||
|
||||
if (protocol && protocolLen) {
|
||||
strncpy(protocol, TelldusCore::wideToString(p).c_str(), protocolLen);
|
||||
}
|
||||
if (model && modelLen) {
|
||||
strncpy(model, TelldusCore::wideToString(m).c_str(), modelLen);
|
||||
}
|
||||
if (sensorId) {
|
||||
(*sensorId) = id;
|
||||
}
|
||||
if (dataTypes) {
|
||||
(*dataTypes) = dt;
|
||||
}
|
||||
|
||||
return TELLSTICK_SUCCESS;
|
||||
}
|
||||
|
||||
int Client::getController(int *controllerId, int *controllerType, char *name, int nameLen, int *available) {
|
||||
if (!d->controllerCached) {
|
||||
Message msg(L"tdController");
|
||||
std::wstring response = Client::getWStringFromService(msg);
|
||||
int count = Message::takeInt(&response);
|
||||
d->controllerCached = true;
|
||||
d->controllerCache = L"";
|
||||
if (count > 0) {
|
||||
d->controllerCache = response;
|
||||
}
|
||||
}
|
||||
|
||||
if (d->controllerCache == L"") {
|
||||
d->controllerCached = false;
|
||||
return TELLSTICK_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
int id = Message::takeInt(&d->controllerCache);
|
||||
int type = Message::takeInt(&d->controllerCache);
|
||||
std::wstring n = Message::takeString(&d->controllerCache);
|
||||
int a = Message::takeInt(&d->controllerCache);
|
||||
|
||||
if (controllerId) {
|
||||
(*controllerId) = id;
|
||||
}
|
||||
if (controllerType) {
|
||||
(*controllerType) = type;
|
||||
}
|
||||
if (name && nameLen) {
|
||||
strncpy(name, TelldusCore::wideToString(n).c_str(), nameLen);
|
||||
}
|
||||
if (available) {
|
||||
(*available) = a;
|
||||
}
|
||||
|
||||
return TELLSTICK_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace TelldusCore
|
||||
47
telldus-core/client/Client.h
Normal file
47
telldus-core/client/Client.h
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef TELLDUS_CORE_CLIENT_CLIENT_H_
|
||||
#define TELLDUS_CORE_CLIENT_CLIENT_H_
|
||||
|
||||
#include "client/telldus-core.h"
|
||||
#include "client/CallbackDispatcher.h"
|
||||
#include "common/Message.h"
|
||||
#include "common/Thread.h"
|
||||
|
||||
namespace TelldusCore {
|
||||
class Client : public Thread {
|
||||
public:
|
||||
~Client(void);
|
||||
|
||||
static Client *getInstance();
|
||||
static void close();
|
||||
|
||||
int registerEvent(CallbackStruct::CallbackType type, void *eventFunction, void *context );
|
||||
void stopThread(void);
|
||||
int unregisterCallback( int callbackId );
|
||||
|
||||
int getSensor(char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes);
|
||||
int getController(int *controllerId, int *controllerType, char *name, int nameLen, int *available);
|
||||
|
||||
static bool getBoolFromService(const Message &msg);
|
||||
static int getIntegerFromService(const Message &msg);
|
||||
static std::wstring getWStringFromService(const Message &msg);
|
||||
|
||||
protected:
|
||||
void run(void);
|
||||
|
||||
private:
|
||||
Client();
|
||||
static std::wstring sendToService(const Message &msg);
|
||||
|
||||
class PrivateData;
|
||||
PrivateData *d;
|
||||
static Client *instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TELLDUS_CORE_CLIENT_CLIENT_H_
|
||||
60
telldus-core/client/libtelldus-core.def
Normal file
60
telldus-core/client/libtelldus-core.def
Normal file
@@ -0,0 +1,60 @@
|
||||
LIBRARY tellduscore
|
||||
EXPORTS
|
||||
tdGetNumberOfDevices @1
|
||||
tdGetDeviceId @2
|
||||
|
||||
tdGetName @3
|
||||
tdGetProtocol @4
|
||||
tdGetModel @5
|
||||
tdGetDeviceParameter @6
|
||||
|
||||
tdSetName @7
|
||||
tdSetProtocol @8
|
||||
tdSetModel @9
|
||||
tdSetDeviceParameter @10
|
||||
|
||||
tdAddDevice @11
|
||||
tdRemoveDevice @12
|
||||
|
||||
tdMethods @13
|
||||
tdTurnOn @14
|
||||
tdTurnOff @15
|
||||
tdBell @16
|
||||
tdDim @17
|
||||
|
||||
tdGetErrorString @18
|
||||
|
||||
tdClose @19
|
||||
|
||||
tdInit @20
|
||||
tdRegisterDeviceEvent @21
|
||||
tdLastSentCommand @22
|
||||
tdGetDeviceType @23
|
||||
|
||||
tdSendRawCommand @24
|
||||
tdRegisterRawDeviceEvent @25
|
||||
|
||||
tdLearn @26
|
||||
tdLastSentValue @27
|
||||
|
||||
tdReleaseString @28
|
||||
tdUnregisterCallback @29
|
||||
|
||||
tdConnectTellStickController @30
|
||||
tdDisconnectTellStickController @31
|
||||
|
||||
tdRegisterDeviceChangeEvent @32
|
||||
tdExecute @33
|
||||
tdUp @34
|
||||
tdDown @35
|
||||
tdStop @36
|
||||
|
||||
tdRegisterSensorEvent @37
|
||||
tdSensor @38
|
||||
tdSensorValue @39
|
||||
|
||||
tdController @40
|
||||
tdControllerValue @41
|
||||
tdSetControllerValue @42
|
||||
tdRemoveController @43
|
||||
tdRegisterControllerEvent @44
|
||||
1296
telldus-core/client/telldus-core.cpp
Normal file
1296
telldus-core/client/telldus-core.cpp
Normal file
File diff suppressed because it is too large
Load Diff
166
telldus-core/client/telldus-core.h
Normal file
166
telldus-core/client/telldus-core.h
Normal file
@@ -0,0 +1,166 @@
|
||||
//
|
||||
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#ifndef TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_
|
||||
#define TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_
|
||||
|
||||
// The following ifdef block is the standard way of creating macros
|
||||
// which make exporting from a DLL simpler. All files within this DLL
|
||||
// are compiled with the TELLDUSCORE_EXPORTS symbol defined on the command line.
|
||||
// This symbol should not be defined on any project that uses this DLL.
|
||||
// This way any other project whose source files include this file see
|
||||
// TELLSTICK_API functions as being imported from a DLL, whereas this DLL
|
||||
// sees symbols defined with this macro as being exported.
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#if defined(TELLDUSCORE_EXPORTS)
|
||||
#if defined(_CL64)
|
||||
#define TELLSTICK_API
|
||||
#else
|
||||
#define TELLSTICK_API __declspec(dllexport)
|
||||
#endif
|
||||
#else
|
||||
#define TELLSTICK_API __declspec(dllimport)
|
||||
#endif
|
||||
#define WINAPI __stdcall
|
||||
#else
|
||||
#define WINAPI
|
||||
#define TELLSTICK_API __attribute__ ((visibility("default")))
|
||||
#endif
|
||||
|
||||
typedef void (WINAPI *TDDeviceEvent)(int deviceId, int method, const char *data, int callbackId, void *context);
|
||||
typedef void (WINAPI *TDDeviceChangeEvent)(int deviceId, int changeEvent, int changeType, int callbackId, void *context);
|
||||
typedef void (WINAPI *TDRawDeviceEvent)(const char *data, int controllerId, int callbackId, void *context);
|
||||
typedef void (WINAPI *TDSensorEvent)(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *context);
|
||||
typedef void (WINAPI *TDControllerEvent)(int controllerId, int changeEvent, int changeType, const char *newValue, int callbackId, void *context);
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define bool char
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TELLSTICK_API void WINAPI tdInit(void);
|
||||
TELLSTICK_API int WINAPI tdRegisterDeviceEvent( TDDeviceEvent eventFunction, void *context );
|
||||
TELLSTICK_API int WINAPI tdRegisterDeviceChangeEvent( TDDeviceChangeEvent eventFunction, void *context);
|
||||
TELLSTICK_API int WINAPI tdRegisterRawDeviceEvent( TDRawDeviceEvent eventFunction, void *context );
|
||||
TELLSTICK_API int WINAPI tdRegisterSensorEvent( TDSensorEvent eventFunction, void *context );
|
||||
TELLSTICK_API int WINAPI tdRegisterControllerEvent( TDControllerEvent eventFunction, void *context);
|
||||
TELLSTICK_API int WINAPI tdUnregisterCallback( int callbackId );
|
||||
TELLSTICK_API void WINAPI tdClose(void);
|
||||
TELLSTICK_API void WINAPI tdReleaseString(char *thestring);
|
||||
|
||||
TELLSTICK_API int WINAPI tdTurnOn(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdTurnOff(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdBell(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdDim(int intDeviceId, unsigned char level);
|
||||
TELLSTICK_API int WINAPI tdExecute(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdUp(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdDown(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdStop(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdLearn(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdMethods(int id, int methodsSupported);
|
||||
TELLSTICK_API int WINAPI tdLastSentCommand( int intDeviceId, int methodsSupported );
|
||||
TELLSTICK_API char *WINAPI tdLastSentValue( int intDeviceId );
|
||||
|
||||
TELLSTICK_API int WINAPI tdGetNumberOfDevices();
|
||||
TELLSTICK_API int WINAPI tdGetDeviceId(int intDeviceIndex);
|
||||
TELLSTICK_API int WINAPI tdGetDeviceType(int intDeviceId);
|
||||
|
||||
TELLSTICK_API char * WINAPI tdGetErrorString(int intErrorNo);
|
||||
|
||||
TELLSTICK_API char * WINAPI tdGetName(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetName(int intDeviceId, const char* chNewName);
|
||||
TELLSTICK_API char * WINAPI tdGetProtocol(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetProtocol(int intDeviceId, const char* strProtocol);
|
||||
TELLSTICK_API char * WINAPI tdGetModel(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetModel(int intDeviceId, const char *intModel);
|
||||
|
||||
TELLSTICK_API char * WINAPI tdGetDeviceParameter(int intDeviceId, const char *strName, const char *defaultValue);
|
||||
TELLSTICK_API bool WINAPI tdSetDeviceParameter(int intDeviceId, const char *strName, const char* strValue);
|
||||
|
||||
TELLSTICK_API int WINAPI tdAddDevice();
|
||||
TELLSTICK_API bool WINAPI tdRemoveDevice(int intDeviceId);
|
||||
|
||||
TELLSTICK_API int WINAPI tdSendRawCommand(const char *command, int reserved);
|
||||
|
||||
TELLSTICK_API void WINAPI tdConnectTellStickController(int vid, int pid, const char *serial);
|
||||
TELLSTICK_API void WINAPI tdDisconnectTellStickController(int vid, int pid, const char *serial);
|
||||
|
||||
TELLSTICK_API int WINAPI tdSensor(char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes);
|
||||
TELLSTICK_API int WINAPI tdSensorValue(const char *protocol, const char *model, int id, int dataType, char *value, int len, int *timestamp);
|
||||
|
||||
TELLSTICK_API int WINAPI tdController(int *controllerId, int *controllerType, char *name, int nameLen, int *available);
|
||||
TELLSTICK_API int WINAPI tdControllerValue(int controllerId, const char *name, char *value, int valueLen);
|
||||
TELLSTICK_API int WINAPI tdSetControllerValue(int controllerId, const char *name, const char *value);
|
||||
TELLSTICK_API int WINAPI tdRemoveController(int controllerId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Device methods
|
||||
#define TELLSTICK_TURNON 1
|
||||
#define TELLSTICK_TURNOFF 2
|
||||
#define TELLSTICK_BELL 4
|
||||
#define TELLSTICK_TOGGLE 8
|
||||
#define TELLSTICK_DIM 16
|
||||
#define TELLSTICK_LEARN 32
|
||||
#define TELLSTICK_EXECUTE 64
|
||||
#define TELLSTICK_UP 128
|
||||
#define TELLSTICK_DOWN 256
|
||||
#define TELLSTICK_STOP 512
|
||||
|
||||
// Sensor value types
|
||||
#define TELLSTICK_TEMPERATURE 1
|
||||
#define TELLSTICK_HUMIDITY 2
|
||||
#define TELLSTICK_RAINRATE 4
|
||||
#define TELLSTICK_RAINTOTAL 8
|
||||
#define TELLSTICK_WINDDIRECTION 16
|
||||
#define TELLSTICK_WINDAVERAGE 32
|
||||
#define TELLSTICK_WINDGUST 64
|
||||
|
||||
// Error codes
|
||||
#define TELLSTICK_SUCCESS 0
|
||||
#define TELLSTICK_ERROR_NOT_FOUND -1
|
||||
#define TELLSTICK_ERROR_PERMISSION_DENIED -2
|
||||
#define TELLSTICK_ERROR_DEVICE_NOT_FOUND -3
|
||||
#define TELLSTICK_ERROR_METHOD_NOT_SUPPORTED -4
|
||||
#define TELLSTICK_ERROR_COMMUNICATION -5
|
||||
#define TELLSTICK_ERROR_CONNECTING_SERVICE -6
|
||||
#define TELLSTICK_ERROR_UNKNOWN_RESPONSE -7
|
||||
#define TELLSTICK_ERROR_SYNTAX -8
|
||||
#define TELLSTICK_ERROR_BROKEN_PIPE -9
|
||||
#define TELLSTICK_ERROR_COMMUNICATING_SERVICE -10
|
||||
#define TELLSTICK_ERROR_CONFIG_SYNTAX -11
|
||||
#define TELLSTICK_ERROR_UNKNOWN -99
|
||||
|
||||
// Device typedef
|
||||
#define TELLSTICK_TYPE_DEVICE 1
|
||||
#define TELLSTICK_TYPE_GROUP 2
|
||||
#define TELLSTICK_TYPE_SCENE 3
|
||||
|
||||
// Controller typedef
|
||||
#define TELLSTICK_CONTROLLER_TELLSTICK 1
|
||||
#define TELLSTICK_CONTROLLER_TELLSTICK_DUO 2
|
||||
#define TELLSTICK_CONTROLLER_TELLSTICK_NET 3
|
||||
|
||||
// Device changes
|
||||
#define TELLSTICK_DEVICE_ADDED 1
|
||||
#define TELLSTICK_DEVICE_CHANGED 2
|
||||
#define TELLSTICK_DEVICE_REMOVED 3
|
||||
#define TELLSTICK_DEVICE_STATE_CHANGED 4
|
||||
|
||||
// Change types
|
||||
#define TELLSTICK_CHANGE_NAME 1
|
||||
#define TELLSTICK_CHANGE_PROTOCOL 2
|
||||
#define TELLSTICK_CHANGE_MODEL 3
|
||||
#define TELLSTICK_CHANGE_METHOD 4
|
||||
#define TELLSTICK_CHANGE_AVAILABLE 5
|
||||
#define TELLSTICK_CHANGE_FIRMWARE 6
|
||||
|
||||
#endif // TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_
|
||||
18
telldus-core/client/telldus-core.rc.in
Normal file
18
telldus-core/client/telldus-core.rc.in
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <winresrc.h>
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION ${PACKAGE_MAJOR_VERSION},${PACKAGE_MINOR_VERSION},${PACKAGE_PATCH_VERSION},0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "04090000"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Utilities and driver to control wireless receivers through a TellStick"
|
||||
VALUE "FileVersion", "${PACKAGE_VERSION}"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2010 Telldus Technologies AB"
|
||||
VALUE "OriginalFilename", "TelldusCore.dll"
|
||||
VALUE "ProductName", "TelldusCore"
|
||||
VALUE "ProductVersion", "${PACKAGE_MAJOR_VERSION}.${PACKAGE_MINOR_VERSION}"
|
||||
END
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user