Removed function
bool devHasMethod(int id, int method) and replaced with int devMethods(int id)
This commit is contained in:
parent
be464c4efc
commit
08c02530a6
13 changed files with 26 additions and 58 deletions
|
@ -45,8 +45,8 @@ void Device::dim(unsigned char level){
|
|||
}
|
||||
|
||||
/*
|
||||
* Has Method, virtual
|
||||
* Methods, virtual
|
||||
*/
|
||||
bool Device::hasMethod(int methodname, char* strModel){
|
||||
return false;
|
||||
int Device::methods(char* strModel){
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual void turnOff(void);
|
||||
virtual void bell(void);
|
||||
virtual void dim(unsigned char level);
|
||||
virtual bool hasMethod(int methodname, char* strModel);
|
||||
virtual int methods(char* strModel);
|
||||
static int getDongleIndex();
|
||||
|
||||
static void debugLog(char* debugstring);
|
||||
|
|
|
@ -130,12 +130,10 @@ string DeviceIkea::getStringCode(unsigned char level){
|
|||
/*
|
||||
* Has the device got the method?
|
||||
*/
|
||||
bool DeviceIkea::hasMethod(int methodname, char* strModel){
|
||||
int DeviceIkea::methods(char* strModel){
|
||||
|
||||
if(strcmp(strModel, TELLSTICK_DEVICE_KOPPLA) == 0) {
|
||||
if(methodname == TELLSTICK_TURNON || methodname == TELLSTICK_TURNOFF || methodname == TELLSTICK_DIM){
|
||||
return true;
|
||||
}
|
||||
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_DIM);
|
||||
}
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
virtual void turnOn(void);
|
||||
virtual void turnOff(void);
|
||||
virtual void dim(unsigned char level);
|
||||
virtual bool hasMethod(int methodname, char* strModel);
|
||||
virtual int methods(char* strModel);
|
||||
|
||||
public:
|
||||
~DeviceIkea(void);
|
||||
|
|
|
@ -132,7 +132,7 @@ string DeviceNexa::getStringCode(int intToConvert){
|
|||
/*
|
||||
* Has the device got the method?
|
||||
*/
|
||||
bool DeviceNexa::hasMethod(int methodname, char* strModel){
|
||||
int DeviceNexa::methods(char* strModel){
|
||||
|
||||
if( strcmp(strModel, TELLSTICK_DEVICE_YCR3500) == 0 ||
|
||||
strcmp(strModel, TELLSTICK_DEVICE_YCR300D) == 0 ||
|
||||
|
@ -151,13 +151,9 @@ bool DeviceNexa::hasMethod(int methodname, char* strModel){
|
|||
strcmp(strModel, TELLSTICK_DEVICE_EL2010) == 0
|
||||
)
|
||||
{
|
||||
if(methodname == TELLSTICK_TURNON || methodname == TELLSTICK_TURNOFF){
|
||||
return true;
|
||||
}
|
||||
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF);
|
||||
} else if ( strcmp(strModel, TELLSTICK_DEVICE_ML7100) == 0 ) {
|
||||
if(methodname == TELLSTICK_BELL) {
|
||||
return true;
|
||||
}
|
||||
return TELLSTICK_BELL;
|
||||
}
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
virtual void turnOn(void);
|
||||
virtual void turnOff(void);
|
||||
virtual void bell(void);
|
||||
virtual bool hasMethod(int methodname, char* strModel);
|
||||
virtual int methods(char* strModel);
|
||||
|
||||
public:
|
||||
~DeviceNexa(void);
|
||||
|
|
|
@ -72,21 +72,8 @@ void DeviceSartano::turnOff(void){
|
|||
/*
|
||||
* Has the device got the method?
|
||||
*/
|
||||
bool DeviceSartano::hasMethod(int methodname, char* strModel){
|
||||
|
||||
bool blnExists = false;
|
||||
|
||||
try{
|
||||
// if(strModel == "xxxx" || strModel == "yyyy"){
|
||||
if(methodname == TELLSTICK_TURNON || methodname == TELLSTICK_TURNOFF){
|
||||
blnExists = true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
throw;
|
||||
}
|
||||
return blnExists;
|
||||
int DeviceSartano::methods(char* strModel){
|
||||
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,7 +9,7 @@ public:
|
|||
DeviceSartano(int intSystem, int intCode, int intDeviceIndex);
|
||||
virtual void turnOn(void);
|
||||
virtual void turnOff(void);
|
||||
virtual bool hasMethod(int methodname, char* strModel);
|
||||
virtual int methods(char* strModel);
|
||||
|
||||
~DeviceSartano(void);
|
||||
|
||||
|
|
|
@ -40,19 +40,6 @@ void DeviceWaveman::turnOff(void){
|
|||
/*
|
||||
* Has the device got the method?
|
||||
*/
|
||||
bool DeviceWaveman::hasMethod(int methodname, char* strModel){
|
||||
|
||||
bool blnExists = false;
|
||||
|
||||
try{
|
||||
// if(strModel == "xxxx" || strModel == "yyyy"){
|
||||
if(methodname == TELLSTICK_TURNON || methodname == TELLSTICK_TURNOFF){
|
||||
blnExists = true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
catch(...){
|
||||
throw;
|
||||
}
|
||||
return blnExists;
|
||||
int DeviceWaveman::methods(char* strModel){
|
||||
return (TELLSTICK_TURNON | TELLSTICK_TURNOFF);
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ class DeviceWaveman : public DeviceNexa
|
|||
public:
|
||||
DeviceWaveman(int intHouse, int intCode, int intDeviceIndex);
|
||||
virtual void turnOff(void);
|
||||
virtual bool hasMethod(int methodname, char* strModel);
|
||||
virtual int methods(char* strModel);
|
||||
};
|
||||
|
|
|
@ -285,22 +285,22 @@ bool __stdcall devRemoveDevice(int intDeviceId){
|
|||
return blnSuccess;
|
||||
}
|
||||
|
||||
bool __stdcall devHasMethod(int id, int methodname){
|
||||
int __stdcall devMethods(int id){
|
||||
|
||||
bool blnExists = false;
|
||||
int intMethods = 0;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
char* strModel = ts.getModel(id);
|
||||
Device* dev = ts.getDevice(id);
|
||||
if (dev != NULL) {
|
||||
blnExists = dev->hasMethod(methodname, strModel);
|
||||
intMethods = dev->methods(strModel);
|
||||
}
|
||||
}
|
||||
catch(exception e){
|
||||
blnExists = false;
|
||||
intMethods = 0;
|
||||
handleException(e);
|
||||
}
|
||||
return blnExists;
|
||||
return intMethods;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ EXPORTS
|
|||
devAddDevice @12
|
||||
devRemoveDevice @13
|
||||
|
||||
devHasMethod @14
|
||||
devMethods @14
|
||||
devTurnOn @16
|
||||
devTurnOff @17
|
||||
devBell @18
|
||||
|
|
|
@ -40,7 +40,7 @@ extern "C" {
|
|||
TELLSTICK_API int WINAPI devAddDeviceWithArguments(char* strVendor, int* intArguments[], int intNumberOfArguments);
|
||||
TELLSTICK_API bool WINAPI devRemoveDevice(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI devGetDeviceId(int intDeviceIndex);
|
||||
TELLSTICK_API bool WINAPI devHasMethod(int id, int methodname);
|
||||
TELLSTICK_API int WINAPI devMethods(int id);
|
||||
}
|
||||
|
||||
#define TELLSTICK_TURNON 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue