Added branding-options to TelldusCore 2.0.
This commit is contained in:
parent
3ad6bcd901
commit
e82cd232fc
4 changed files with 48 additions and 11 deletions
|
@ -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(BUILD_TDTOOL TRUE CACHE BOOL "Build tdtool")
|
||||||
|
|
||||||
SET(GENERATE_MAN FALSE CACHE BOOL "Enable generation of man-files")
|
SET(GENERATE_MAN FALSE CACHE BOOL "Enable generation of man-files")
|
||||||
|
SET(BRANDING "telldus" CACHE STRING "The brand to use")
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(driver)
|
ADD_SUBDIRECTORY(driver)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ SET( telldus-core_SRCS
|
||||||
|
|
||||||
SET( telldus-core_HDRS
|
SET( telldus-core_HDRS
|
||||||
telldus-core.h
|
telldus-core.h
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( telldus-core_MOC_HDRS
|
SET( telldus-core_MOC_HDRS
|
||||||
|
@ -50,6 +51,11 @@ IF (SUPPORT_USB)
|
||||||
)
|
)
|
||||||
ENDIF (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 ########
|
######## Configurable options for the platform ########
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "TellStick.h"
|
#include "TellStick.h"
|
||||||
#endif
|
#endif
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -84,54 +85,65 @@ Device *Manager::getDevice(int intDeviceId){
|
||||||
std::string strName = settings.getName(intDeviceId);
|
std::string strName = settings.getName(intDeviceId);
|
||||||
|
|
||||||
//each new brand must be added here
|
//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);
|
dev = new DeviceNexa(intDeviceId, strModel, strName);
|
||||||
((DeviceNexa*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceNexa*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceNexa*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceNexa*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_BRATECK
|
||||||
} else if (strcasecmp(protocol.c_str(), "brateck") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "brateck") == 0) {
|
||||||
dev = new DeviceBrateck(intDeviceId, strModel, strName);
|
dev = new DeviceBrateck(intDeviceId, strModel, strName);
|
||||||
((DeviceBrateck*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceBrateck*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_EVERFLOURISH
|
||||||
} else if (strcasecmp(protocol.c_str(), "everflourish") == 0){
|
} else if (strcasecmp(protocol.c_str(), "everflourish") == 0){
|
||||||
dev = new DeviceEverflourish(intDeviceId, strModel, strName);
|
dev = new DeviceEverflourish(intDeviceId, strModel, strName);
|
||||||
((DeviceEverflourish*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceEverflourish*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceEverflourish*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceEverflourish*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_GROUP
|
||||||
} else if (strcasecmp(protocol.c_str(), "group") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "group") == 0) {
|
||||||
dev = new DeviceGroup(intDeviceId, strModel, strName);
|
dev = new DeviceGroup(intDeviceId, strModel, strName);
|
||||||
((DeviceGroup*)dev)->setDevices(settings.getDeviceParameter(intDeviceId, "devices"));
|
((DeviceGroup*)dev)->setDevices(settings.getDeviceParameter(intDeviceId, "devices"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_RISINGSUN
|
||||||
} else if (strcasecmp(protocol.c_str(), "risingsun") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "risingsun") == 0) {
|
||||||
dev = new DeviceRisingSun(intDeviceId, strModel, strName);
|
dev = new DeviceRisingSun(intDeviceId, strModel, strName);
|
||||||
((DeviceRisingSun*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceRisingSun*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceRisingSun*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceRisingSun*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_WAVEMAN
|
||||||
} else if (strcasecmp(protocol.c_str(), "Waveman") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "Waveman") == 0) {
|
||||||
dev = new DeviceWaveman(intDeviceId, strModel, strName);
|
dev = new DeviceWaveman(intDeviceId, strModel, strName);
|
||||||
((DeviceWaveman*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceWaveman*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceWaveman*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceWaveman*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_SARTANO
|
||||||
} else if (strcasecmp(protocol.c_str(), "Sartano") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "Sartano") == 0) {
|
||||||
dev = new DeviceSartano(intDeviceId, strModel, strName);
|
dev = new DeviceSartano(intDeviceId, strModel, strName);
|
||||||
((DeviceSartano*)dev)->setCode(settings.getDeviceParameter(intDeviceId, "code"));
|
((DeviceSartano*)dev)->setCode(settings.getDeviceParameter(intDeviceId, "code"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_IKEA
|
||||||
} else if (strcasecmp(protocol.c_str(), "Ikea") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "Ikea") == 0) {
|
||||||
dev = new DeviceIkea(intDeviceId, strModel, strName);
|
dev = new DeviceIkea(intDeviceId, strModel, strName);
|
||||||
((DeviceIkea*)dev)->setSystem(settings.getDeviceParameter(intDeviceId, "system"));
|
((DeviceIkea*)dev)->setSystem(settings.getDeviceParameter(intDeviceId, "system"));
|
||||||
((DeviceIkea*)dev)->setUnits(settings.getDeviceParameter(intDeviceId, "units"));
|
((DeviceIkea*)dev)->setUnits(settings.getDeviceParameter(intDeviceId, "units"));
|
||||||
((DeviceIkea*)dev)->setFade(settings.getDeviceParameter(intDeviceId, "fade"));
|
((DeviceIkea*)dev)->setFade(settings.getDeviceParameter(intDeviceId, "fade"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_UPM
|
||||||
} else if (strcasecmp(protocol.c_str(), "upm") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "upm") == 0) {
|
||||||
dev = new DeviceUpm(intDeviceId, strModel, strName);
|
dev = new DeviceUpm(intDeviceId, strModel, strName);
|
||||||
((DeviceUpm*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceUpm*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceUpm*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceUpm*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
|
#ifdef PROTOCOL_X10
|
||||||
} else if (strcasecmp(protocol.c_str(), "x10") == 0) {
|
} else if (strcasecmp(protocol.c_str(), "x10") == 0) {
|
||||||
dev = new DeviceX10(intDeviceId, strModel, strName);
|
dev = new DeviceX10(intDeviceId, strModel, strName);
|
||||||
((DeviceX10*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
((DeviceX10*)dev)->setHouse(settings.getDeviceParameter(intDeviceId, "house"));
|
||||||
((DeviceX10*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
((DeviceX10*)dev)->setUnit(settings.getDeviceParameter(intDeviceId, "unit"));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
//This is a dummy device needed when the parameters isn't setup correctly.
|
//This is a dummy device needed when the parameters isn't setup correctly.
|
||||||
dev = new DeviceUndefined(intDeviceId, strModel, strName);
|
dev = new DeviceUndefined(intDeviceId, strModel, strName);
|
||||||
|
|
18
driver/libtelldus-core/config.h.in
Normal file
18
driver/libtelldus-core/config.h.in
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue