Renamed library TellUsbD101 to TelldusCore and some minor fixes for building on Windows.

This commit is contained in:
Micke Prag 2008-10-16 15:03:03 +00:00
parent c865bb0fd6
commit 46ba243c2f
28 changed files with 993 additions and 1018 deletions

View file

@ -1,6 +1,6 @@
PROJECT( tellstick )
CMAKE_MINIMUM_REQUIRED( VERSION 2.4.0 )
ADD_SUBDIRECTORY(TellUsbD101)
PROJECT( tellstick )
CMAKE_MINIMUM_REQUIRED( VERSION 2.4.0 )
ADD_SUBDIRECTORY(libtelldus-core)

View file

@ -1,70 +1,70 @@
SET( tellusbd101_SRCS
Device.cpp
DeviceIkea.cpp
DeviceNexa.cpp
DeviceSartano.cpp
DeviceWaveman.cpp
settings/TelldusSettings.cpp
TellUsbD101.cpp
)
IF (APPLE)
SET( tellusbd101_SRCS
${tellusbd101_SRCS}
win/Device.cpp
settings/TelldusSettingsCoreFoundationPreferences.cpp
)
ADD_DEFINITIONS(
-D_MACOSX
)
ELSE (APPLE)
SET( tellusbd101_SRCS
${tellusbd101_SRCS}
linux/Device.cpp
settings/TelldusSettingsConfuse.cpp
)
ADD_DEFINITIONS(
-D_LINUX
)
ENDIF (APPLE)
ADD_LIBRARY(tellusbd101 SHARED
${tellusbd101_SRCS}
)
IF (APPLE)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
TARGET_LINK_LIBRARIES(tellusbd101
${COREFOUNDATION_LIBRARY}
ftd2xx
)
ELSE (APPLE)
TARGET_LINK_LIBRARIES(tellusbd101
confuse
)
ENDIF (APPLE)
INSTALL(TARGETS tellusbd101 LIBRARY
DESTINATION lib
)
INSTALL(FILES
TellUsbD101.h
DESTINATION include
)
SET(SYSCONF_INSTALL_DIR
"/etc"
CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)"
FORCE
)
IF (UNIX)
INSTALL(FILES
tellstick.conf
DESTINATION ${SYSCONF_INSTALL_DIR}
)
ENDIF (UNIX)
SET( tellusbd101_SRCS
Device.cpp
DeviceIkea.cpp
DeviceNexa.cpp
DeviceSartano.cpp
DeviceWaveman.cpp
settings/TelldusSettings.cpp
telldus-core.cpp
)
IF (APPLE)
SET( tellusbd101_SRCS
${tellusbd101_SRCS}
win/Device.cpp
settings/TelldusSettingsCoreFoundationPreferences.cpp
)
ADD_DEFINITIONS(
-D_MACOSX
)
ELSE (APPLE)
SET( tellusbd101_SRCS
${tellusbd101_SRCS}
linux/Device.cpp
settings/TelldusSettingsConfuse.cpp
)
ADD_DEFINITIONS(
-D_LINUX
)
ENDIF (APPLE)
ADD_LIBRARY(tellusbd101 SHARED
${tellusbd101_SRCS}
)
IF (APPLE)
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
TARGET_LINK_LIBRARIES(tellusbd101
${COREFOUNDATION_LIBRARY}
ftd2xx
)
ELSE (APPLE)
TARGET_LINK_LIBRARIES(tellusbd101
confuse
)
ENDIF (APPLE)
INSTALL(TARGETS tellusbd101
DESTINATION lib
)
INSTALL(FILES
TellUsbD101.h
DESTINATION include
)
SET(SYSCONF_INSTALL_DIR
"/etc"
CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)"
FORCE
)
IF (UNIX)
INSTALL(FILES
tellstick.conf
DESTINATION ${SYSCONF_INSTALL_DIR}
)
ENDIF (UNIX)

View file

@ -27,28 +27,28 @@ Device::~Device(void)
* Turn on, virtual
*/
int Device::turnOn(void){
//do nothing
return TELLSTICK_ERROR_METHOD_NOT_SUPPORTED;
}
/*
* Turn off, virtual
*/
int Device::turnOff(void){
//do nothing
return TELLSTICK_ERROR_METHOD_NOT_SUPPORTED;
}
/*
* Bell, virtual
*/
int Device::bell(void){
//do nothing
return TELLSTICK_ERROR_METHOD_NOT_SUPPORTED;
}
/*
* Dim, virtual
*/
int Device::dim(unsigned char level){
//do nothing
return TELLSTICK_ERROR_METHOD_NOT_SUPPORTED;
}
/*

View file

@ -1,6 +1,6 @@
#pragma once
#include "TellUsbD101.h"
#include "telldus-core.h"
class Device
{

View file

@ -8,6 +8,10 @@
using namespace std;
#ifdef _WINDOWS
#define strcasecmp(x, y) _strcmpi(x, y)
#endif
/*
* Constructor
*/

View file

@ -1,4 +1,4 @@
LIBRARY TellUsbD101
LIBRARY telldus-core
EXPORTS
devGetNumberOfDevices @1
devGetDeviceId @2

View file

@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="TellUsbD101"
Name="telldus-core"
ProjectGUID="{2A868E40-88D9-4800-A83F-21D0F8DCB611}"
RootNamespace="TellUsbD101"
RootNamespace="TelldusCore"
Keyword="Win32Proj"
>
<Platforms>
@ -61,8 +61,9 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="advapi32.lib oleaut32.lib"
LinkIncremental="2"
ModuleDefinitionFile="$(SolutionDir)\tellTest3\tellTest3.def"
ModuleDefinitionFile="libtelldus-core.def"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@ -117,7 +118,7 @@
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TellUsbD101_EXPORTS"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TelldusCore_EXPORTS"
GeneratePreprocessedFile="0"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
@ -138,7 +139,7 @@
Name="VCLinkerTool"
AdditionalDependencies="advapi32.lib oleaut32.lib"
LinkIncremental="1"
ModuleDefinitionFile="TellUsbD101.def"
ModuleDefinitionFile="libtelldus-core.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
@ -179,6 +180,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Device.cpp"
>
</File>
<File
RelativePath=".\win\Device.cpp"
>
@ -201,10 +206,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Device.cpp"
>
</File>
<File
RelativePath=".\DeviceIkea.cpp"
>
@ -225,6 +226,10 @@
RelativePath=".\stdafx.cpp"
>
</File>
<File
RelativePath=".\telldus-core.cpp"
>
</File>
<File
RelativePath=".\settings\TelldusSettings.cpp"
>
@ -233,10 +238,6 @@
RelativePath=".\settings\TelldusSettingsWinRegistry.cpp"
>
</File>
<File
RelativePath=".\TellUsbD101.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@ -276,11 +277,11 @@
>
</File>
<File
RelativePath=".\settings\TelldusSettings.h"
RelativePath=".\telldus-core.h"
>
</File>
<File
RelativePath=".\TellUsbD101.h"
RelativePath=".\settings\TelldusSettings.h"
>
</File>
</Filter>
@ -290,7 +291,7 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\TellUsbD101.def"
RelativePath=".\libtelldus-core.def"
>
</File>
</Filter>

View file

@ -8,7 +8,7 @@
#include "stdafx.h"
#include <ole2.h>
#endif
#include "TellUsbD101.h"
#include "telldus-core.h"
#include "settings/TelldusSettings.h"
#include "Device.h"
#include <vector>

View file

@ -1,16 +1,16 @@
#ifndef TELLUSBD101_H
#define TELLUSBD101_H
#ifndef TELLDUSCORE_H
#define TELLDUSCORE_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 TellUsbD101_EXPORTS symbol defined on the command line.
// 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
#ifdef TellUsbD101_EXPORTS
#ifdef TelldusCore_EXPORTS
#define TELLSTICK_API __declspec(dllexport)
#else
#define TELLSTICK_API __declspec(dllimport)

View file

@ -4,6 +4,10 @@
#include <vector>
#include <iostream>
#include <fstream>
#ifdef _WINDOWS
#include "..\StdAfx.h"
#endif
#include "ftd2xx.h"
int getDongleIndex();
@ -11,7 +15,7 @@ int getDongleIndex();
/*
* Send message to the USB dongle
*/
void Device::send(char* strMessage){
int Device::send(char* strMessage){
try{
FT_STATUS ftStatus = FT_OK;
@ -19,7 +23,7 @@ void Device::send(char* strMessage){
int intDongleIndex = getDongleIndex();
if (intDongleIndex < 0) {
return;
return TELLSTICK_ERROR_NOT_FOUND;
}
ftStatus = FT_Open(intDongleIndex, &fthHandle);
@ -35,6 +39,7 @@ void Device::send(char* strMessage){
catch(...){
throw;
}
return TELLSTICK_SUCCESS;
}
/*
@ -48,8 +53,10 @@ int getDongleIndex(){
try{
DWORD dwNumberOfDevices = 0;
#ifndef _WINDOWS
FT_SetVIDPID(0x1781, 0x0C30);
#endif
ftStatus = FT_CreateDeviceInfoList(&dwNumberOfDevices);
if (ftStatus == FT_OK) {
for (int i = 0; i < (int)dwNumberOfDevices; i++) {