Updated so controlling devices under Max OS X works!

This commit is contained in:
Micke Prag 2008-07-22 12:46:40 +00:00
parent 0495a89b79
commit 2d2b290372
5 changed files with 1013 additions and 884 deletions

View file

@ -1,7 +1,6 @@
SET( tellusbd101_SRCS SET( tellusbd101_SRCS
Device.cpp Device.cpp
linux/Device.cpp
DeviceIkea.cpp DeviceIkea.cpp
DeviceNexa.cpp DeviceNexa.cpp
DeviceSartano.cpp DeviceSartano.cpp
@ -10,20 +9,25 @@ SET( tellusbd101_SRCS
TellUsbD101.cpp TellUsbD101.cpp
) )
ADD_DEFINITIONS(
-DOS_LINUX
)
IF (APPLE) IF (APPLE)
SET( tellusbd101_SRCS SET( tellusbd101_SRCS
${tellusbd101_SRCS} ${tellusbd101_SRCS}
win/Device.cpp
settings/TelldusSettingsCoreFoundationPreferences.cpp settings/TelldusSettingsCoreFoundationPreferences.cpp
) )
ADD_DEFINITIONS(
-D_MACOSX
)
ELSE () ELSE ()
SET( tellusbd101_SRC SET( tellusbd101_SRC
${tellusbd101_SRCS} ${tellusbd101_SRCS}
linux/Device.cpp
settings/TelldusSettingsConfuse.cpp settings/TelldusSettingsConfuse.cpp
) )
ADD_DEFINITIONS(
-D_LINUX
)
ENDIF () ENDIF ()
ADD_LIBRARY(tellusbd101 SHARED ADD_LIBRARY(tellusbd101 SHARED
@ -35,6 +39,7 @@ IF (APPLE)
TARGET_LINK_LIBRARIES(tellusbd101 TARGET_LINK_LIBRARIES(tellusbd101
${COREFOUNDATION_LIBRARY} ${COREFOUNDATION_LIBRARY}
ftd2xx
) )
ENDIF (APPLE) ENDIF (APPLE)

View file

@ -41,7 +41,7 @@ Device* TelldusSettings::getDevice(int intDeviceId){
return NULL; return NULL;
} }
#ifndef _WINDOWS #ifdef _LINUX
dev->setDevice( getSetting("deviceNode") ); dev->setDevice( getSetting("deviceNode") );
#endif #endif

View file

@ -1,11 +1,10 @@
#include "..\Device.h" #include "../Device.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "..\StdAfx.h" #include "ftd2xx.h"
#include "FTD2XX.H"
int getDongleIndex(); int getDongleIndex();
@ -50,6 +49,7 @@ int getDongleIndex(){
try{ try{
DWORD dwNumberOfDevices = 0; DWORD dwNumberOfDevices = 0;
FT_SetVIDPID(0x1781, 0x0C30);
ftStatus = FT_CreateDeviceInfoList(&dwNumberOfDevices); ftStatus = FT_CreateDeviceInfoList(&dwNumberOfDevices);
if (ftStatus == FT_OK) { if (ftStatus == FT_OK) {
for (int i = 0; i < (int)dwNumberOfDevices; i++) { for (int i = 0; i < (int)dwNumberOfDevices; i++) {

View file

@ -0,0 +1,87 @@
#ifndef __WINDOWS_TYPES__
#define __WINDOWS_TYPES__
#define MAX_NUM_DEVICES 50
#include <sys/time.h>
typedef unsigned long DWORD;
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef short SHORT;
typedef unsigned char UCHAR;
typedef unsigned short WORD;
typedef unsigned char BYTE;
typedef unsigned char *LPBYTE;
typedef int BOOL;
typedef char BOOLEAN;
typedef char CHAR;
typedef int *LPBOOL;
typedef unsigned char *PUCHAR;
typedef const char *LPCSTR;
typedef char *PCHAR;
typedef void *PVOID;
typedef void *HANDLE;
typedef long LONG;
typedef int INT;
typedef unsigned int UINT;
typedef char *LPSTR;
typedef char *LPTSTR;
typedef DWORD *LPDWORD;
typedef WORD *LPWORD;
typedef ULONG *PULONG;
typedef PVOID LPVOID;
typedef void VOID;
typedef unsigned long long int ULONGLONG;
typedef struct _OVERLAPPED {
DWORD Internal;
DWORD InternalHigh;
DWORD Offset;
DWORD OffsetHigh;
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES , *LPSECURITY_ATTRIBUTES;
typedef struct timeval SYSTEMTIME;
typedef struct timeval FILETIME;
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
//
// Modem Status Flags
//
#define MS_CTS_ON ((DWORD)0x0010)
#define MS_DSR_ON ((DWORD)0x0020)
#define MS_RING_ON ((DWORD)0x0040)
#define MS_RLSD_ON ((DWORD)0x0080)
//
// Error Flags
//
#define CE_RXOVER 0x0001 // Receive Queue overflow
#define CE_OVERRUN 0x0002 // Receive Overrun Error
#define CE_RXPARITY 0x0004 // Receive Parity Error
#define CE_FRAME 0x0008 // Receive Framing error
#define CE_BREAK 0x0010 // Break Detected
#define CE_TXFULL 0x0100 // TX Queue is full
#define CE_PTO 0x0200 // LPTx Timeout
#define CE_IOE 0x0400 // LPTx I/O Error
#define CE_DNS 0x0800 // LPTx Device not selected
#define CE_OOP 0x1000 // LPTx Out-Of-Paper
#define CE_MODE 0x8000 // Requested mode unsupported
#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE 0xFFFFFFFF
#endif
#endif

File diff suppressed because it is too large Load diff