Added branding-options to TelldusCore 2.0.

This commit is contained in:
Micke Prag 2010-06-17 09:10:33 +00:00
parent 3ad6bcd901
commit e82cd232fc
4 changed files with 48 additions and 11 deletions

View file

@ -28,6 +28,7 @@ SET(BUILD_RFCMD_WITH_LIBFTDI FALSE CACHE BOOL "Enable support for using rfcmd wi
SET(BUILD_TDTOOL TRUE CACHE BOOL "Build tdtool")
SET(GENERATE_MAN FALSE CACHE BOOL "Enable generation of man-files")
SET(BRANDING "telldus" CACHE STRING "The brand to use")
ADD_SUBDIRECTORY(driver)

View file

@ -28,6 +28,7 @@ SET( telldus-core_SRCS
SET( telldus-core_HDRS
telldus-core.h
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
)
SET( telldus-core_MOC_HDRS
@ -50,6 +51,11 @@ IF (SUPPORT_USB)
)
ENDIF (SUPPORT_USB)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
######## Configurable options for the platform ########

View file

@ -29,6 +29,7 @@
#include "TellStick.h"
#endif
#include "common.h"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
@ -84,54 +85,65 @@ Device *Manager::getDevice(int intDeviceId){
std::string strName = settings.getName(intDeviceId);
//each new brand must be added here
if (strcasecmp(protocol.c_str(), "arctech") == 0){
if (0) {
#ifdef PROTOCOL_ARCTECH
} else if (strcasecmp(protocol.c_str(), "arctech") == 0){
dev = new DeviceNexa(intDeviceId, strModel, strName);
((DeviceNexa*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceNexa*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
#ifdef PROTOCOL_BRATECK
} else if (strcasecmp(protocol.c_str(), "brateck") == 0) {
dev = new DeviceBrateck(intDeviceId, strModel, strName);
((DeviceBrateck*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
#endif
#ifdef PROTOCOL_EVERFLOURISH
} else if (strcasecmp(protocol.c_str(), "everflourish") == 0){
dev = new DeviceEverflourish(intDeviceId, strModel, strName);
((DeviceEverflourish*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceEverflourish*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
#ifdef PROTOCOL_GROUP
} else if (strcasecmp(protocol.c_str(), "group") == 0) {
dev = new DeviceGroup(intDeviceId, strModel, strName);
((DeviceGroup*)dev)->setDevices(settings.getDeviceParameter(intDeviceId, "devices"));
#endif
#ifdef PROTOCOL_RISINGSUN
} else if (strcasecmp(protocol.c_str(), "risingsun") == 0) {
dev = new DeviceRisingSun(intDeviceId, strModel, strName);
((DeviceRisingSun*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceRisingSun*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
#ifdef PROTOCOL_WAVEMAN
} else if (strcasecmp(protocol.c_str(), "Waveman") == 0) {
dev = new DeviceWaveman(intDeviceId, strModel, strName);
((DeviceWaveman*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceWaveman*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
#ifdef PROTOCOL_SARTANO
} else if (strcasecmp(protocol.c_str(), "Sartano") == 0) {
dev = new DeviceSartano(intDeviceId, strModel, strName);
((DeviceSartano*)dev)->setCode(settings.getDeviceParameter(intDeviceId, "code"));
#endif
#ifdef PROTOCOL_IKEA
} else if (strcasecmp(protocol.c_str(), "Ikea") == 0) {
dev = new DeviceIkea(intDeviceId, strModel, strName);
((DeviceIkea*)dev)->setSystem(settings.getDeviceParameter(intDeviceId, "system"));
((DeviceIkea*)dev)->setUnits(settings.getDeviceParameter(intDeviceId, "units"));
((DeviceIkea*)dev)->setFade(settings.getDeviceParameter(intDeviceId, "fade"));
#endif
#ifdef PROTOCOL_UPM
} else if (strcasecmp(protocol.c_str(), "upm") == 0) {
dev = new DeviceUpm(intDeviceId, strModel, strName);
((DeviceUpm*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceUpm*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
#ifdef PROTOCOL_X10
} else if (strcasecmp(protocol.c_str(), "x10") == 0) {
dev = new DeviceX10(intDeviceId, strModel, strName);
((DeviceX10*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
((DeviceX10*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
#endif
} else {
//This is a dummy device needed when the parameters isn't setup correctly.
dev = new DeviceUndefined(intDeviceId, strModel, strName);

View file

@ -0,0 +1,18 @@
#define BRANDING "${BRANDING}"
#define BRANDING_${BRANDING}
#ifdef BRANDING_chacon
#define PROTOCOL_ARCTECH
#else
#define PROTOCOL_ARCTECH
#define PROTOCOL_BRATECK
#define PROTOCOL_EVERFLOURISH
#define PROTOCOL_GROUP
#define PROTOCOL_RISINGSUN
#define PROTOCOL_WAVEMAN
#define PROTOCOL_SARTANO
#define PROTOCOL_IKEA
#define PROTOCOL_UPM
#define PROTOCOL_X10
#endif