Changed the prefix "dev" to "td" for our new platform independent API
This commit is contained in:
parent
6dd66d7d7e
commit
5fe95ef98a
4 changed files with 81 additions and 81 deletions
|
@ -1,25 +1,25 @@
|
|||
LIBRARY telldus-core
|
||||
EXPORTS
|
||||
devGetNumberOfDevices @1
|
||||
devGetDeviceId @2
|
||||
tdGetNumberOfDevices @1
|
||||
tdGetDeviceId @2
|
||||
|
||||
devGetName @3
|
||||
devGetVendor @4
|
||||
devGetModel @5
|
||||
devGetArgument @6
|
||||
tdGetName @3
|
||||
tdGetVendor @4
|
||||
tdGetModel @5
|
||||
tdGetArgument @6
|
||||
|
||||
devSetName @7
|
||||
devSetVendor @8
|
||||
devSetModel @9
|
||||
devSetArgument @10
|
||||
tdSetName @7
|
||||
tdSetVendor @8
|
||||
tdSetModel @9
|
||||
tdSetArgument @10
|
||||
|
||||
devAddDevice @11
|
||||
devRemoveDevice @12
|
||||
tdAddDevice @11
|
||||
tdRemoveDevice @12
|
||||
|
||||
devMethods @13
|
||||
devTurnOn @14
|
||||
devTurnOff @15
|
||||
devBell @16
|
||||
devDim @17
|
||||
tdMethods @13
|
||||
tdTurnOn @14
|
||||
tdTurnOff @15
|
||||
tdBell @16
|
||||
tdDim @17
|
||||
|
||||
devGetErrorString @18
|
||||
tdGetErrorString @18
|
||||
|
|
|
@ -22,19 +22,19 @@ using namespace std;
|
|||
|
||||
/**
|
||||
* @def TELLSTICK_TURNON
|
||||
* Device-flag for devices supporting the devTurnOn() call.
|
||||
* Device-flag for devices supporting the tdTurnOn() call.
|
||||
*
|
||||
* @def TELLSTICK_TURNOFF
|
||||
* Device-flag for devices supporting the devTurnOff() call.
|
||||
* Device-flag for devices supporting the tdTurnOff() call.
|
||||
*
|
||||
* @def TELLSTICK_BELL
|
||||
* Device-flag for devices supporting the devBell() call.
|
||||
* Device-flag for devices supporting the tdBell() call.
|
||||
*
|
||||
* @def TELLSTICK_TOGGLE
|
||||
* This method is currently unimplemented.
|
||||
*
|
||||
* @def TELLSTICK_DIM
|
||||
* Device-flag for devices supporting the devDim() call.
|
||||
* Device-flag for devices supporting the tdDim() call.
|
||||
*
|
||||
* @def TELLSTICK_SUCCESS
|
||||
* Error code. Returned when the command succeeded.
|
||||
|
@ -51,7 +51,7 @@ using namespace std;
|
|||
*
|
||||
* @def TELLSTICK_ERROR_METHOD_NOT_SUPPORTED
|
||||
* Error code. The requested method is not supported device.
|
||||
* This should be avoided by a call to devMethods().
|
||||
* This should be avoided by a call to tdMethods().
|
||||
*
|
||||
* @def TELLSTICK_ERROR_UNKNOWN
|
||||
* Error code. An unkown error has occurred.
|
||||
|
@ -65,11 +65,11 @@ using namespace std;
|
|||
|
||||
/**
|
||||
* Turns a device on.
|
||||
* Make sure the device supports this by calling devMethods() before any
|
||||
* Make sure the device supports this by calling tdMethods() before any
|
||||
* call to this function.
|
||||
* @param intDeviceId The device id to turn on.
|
||||
**/
|
||||
int WINAPI devTurnOn(int intDeviceId){
|
||||
int WINAPI tdTurnOn(int intDeviceId){
|
||||
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -101,11 +101,11 @@ int WINAPI devTurnOn(int intDeviceId){
|
|||
|
||||
/**
|
||||
* Turns a device off.
|
||||
* Make sure the device supports this by calling devMethods() before any
|
||||
* Make sure the device supports this by calling tdMethods() before any
|
||||
* call to this function.
|
||||
* @param intDeviceId The device id to turn off.
|
||||
*/
|
||||
int WINAPI devTurnOff(int intDeviceId){
|
||||
int WINAPI tdTurnOff(int intDeviceId){
|
||||
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -136,11 +136,11 @@ int WINAPI devTurnOff(int intDeviceId){
|
|||
|
||||
/**
|
||||
* Sends bell command to devices supporting this.
|
||||
* Make sure the device supports this by calling devMethods() before any
|
||||
* Make sure the device supports this by calling tdMethods() before any
|
||||
* call to this function.
|
||||
* @param intDeviceId The device id to send bell to
|
||||
*/
|
||||
int WINAPI devBell(int intDeviceId){
|
||||
int WINAPI tdBell(int intDeviceId){
|
||||
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -171,12 +171,12 @@ int WINAPI devBell(int intDeviceId){
|
|||
|
||||
/**
|
||||
* Dims a device.
|
||||
* Make sure the device supports this by calling devMethods() before any
|
||||
* Make sure the device supports this by calling tdMethods() before any
|
||||
* call to this function.
|
||||
* @param intDeviceId The device id to dim
|
||||
* @param level The level the device should dim to. This value should be 0-255
|
||||
*/
|
||||
int WINAPI devDim(int intDeviceId, unsigned char level){
|
||||
int WINAPI tdDim(int intDeviceId, unsigned char level){
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
Device* dev = ts.getDevice(intDeviceId);
|
||||
|
@ -214,7 +214,7 @@ int WINAPI devDim(int intDeviceId, unsigned char level){
|
|||
* This function returns the number of devices configured
|
||||
* @returns an integer of the total number of devices configured
|
||||
*/
|
||||
int WINAPI devGetNumberOfDevices(void){
|
||||
int WINAPI tdGetNumberOfDevices(void){
|
||||
int intReturn = -1;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -231,16 +231,16 @@ int WINAPI devGetNumberOfDevices(void){
|
|||
* This function returns the unique id of a device with a specific index.
|
||||
* To get all the id numbers you should loop over all the devices:
|
||||
* \code
|
||||
* int intNumberOfDevices = devGetNumberOfDevices();
|
||||
* int intNumberOfDevices = tdGetNumberOfDevices();
|
||||
* for (int i = 0; i < intNumberOfDevices; i++) {
|
||||
* int id = devGetDeviceId( i );
|
||||
* int id = tdGetDeviceId( i );
|
||||
* // id now contains the id number of the device with index of i
|
||||
* }
|
||||
* \endcode
|
||||
* @param intDeviceIndex The device index to query. The index starts from 0.
|
||||
* @returns the unique id for the device or -1 if the device is not found.
|
||||
*/
|
||||
int WINAPI devGetDeviceId(int intDeviceIndex){
|
||||
int WINAPI tdGetDeviceId(int intDeviceIndex){
|
||||
int intReturn = -1;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -258,7 +258,7 @@ int WINAPI devGetDeviceId(int intDeviceIndex){
|
|||
* @param intDeviceId The unique id of the device to query
|
||||
* @returns The name of the device or an empty string if the device is not found.
|
||||
*/
|
||||
char * WINAPI devGetName(int intDeviceId){
|
||||
char * WINAPI tdGetName(int intDeviceId){
|
||||
char* strReturn;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -274,7 +274,7 @@ char * WINAPI devGetName(int intDeviceId){
|
|||
return strReturn;
|
||||
}
|
||||
|
||||
bool WINAPI devSetName(int intDeviceId, const char* strNewName){
|
||||
bool WINAPI tdSetName(int intDeviceId, const char* strNewName){
|
||||
bool blnSuccess = false;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -287,7 +287,7 @@ bool WINAPI devSetName(int intDeviceId, const char* strNewName){
|
|||
return blnSuccess;
|
||||
}
|
||||
|
||||
char* WINAPI devGetVendor(int intDeviceId){
|
||||
char* WINAPI tdGetVendor(int intDeviceId){
|
||||
char* strReturn = "";
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -303,7 +303,7 @@ char* WINAPI devGetVendor(int intDeviceId){
|
|||
return strReturn;
|
||||
}
|
||||
|
||||
bool WINAPI devSetVendor(int intDeviceId, const char* strVendor){
|
||||
bool WINAPI tdSetVendor(int intDeviceId, const char* strVendor){
|
||||
bool blnSuccess = false;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -316,7 +316,7 @@ bool WINAPI devSetVendor(int intDeviceId, const char* strVendor){
|
|||
return blnSuccess;
|
||||
}
|
||||
|
||||
int WINAPI devGetModel(int intDeviceId){
|
||||
int WINAPI tdGetModel(int intDeviceId){
|
||||
int intReturn = 0;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -329,7 +329,7 @@ int WINAPI devGetModel(int intDeviceId){
|
|||
return intReturn;
|
||||
}
|
||||
|
||||
bool WINAPI devSetModel(int intDeviceId, int intModel){
|
||||
bool WINAPI tdSetModel(int intDeviceId, int intModel){
|
||||
bool blnSuccess = false;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -342,7 +342,7 @@ bool WINAPI devSetModel(int intDeviceId, int intModel){
|
|||
return blnSuccess;
|
||||
}
|
||||
|
||||
bool WINAPI devSetArgument(int intDeviceId, const char *strName, const char *strValue){
|
||||
bool WINAPI tdSetArgument(int intDeviceId, const char *strName, const char *strValue){
|
||||
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -354,7 +354,7 @@ bool WINAPI devSetArgument(int intDeviceId, const char *strName, const char *str
|
|||
return false;
|
||||
}
|
||||
|
||||
const char * WINAPI devGetArgument(int intDeviceId, const char *strName, const char *defaultValue){
|
||||
const char * WINAPI tdGetArgument(int intDeviceId, const char *strName, const char *defaultValue){
|
||||
char *strReturn = "";
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -372,7 +372,7 @@ const char * WINAPI devGetArgument(int intDeviceId, const char *strName, const c
|
|||
return strReturn;
|
||||
}
|
||||
|
||||
int WINAPI devAddDevice(){
|
||||
int WINAPI tdAddDevice(){
|
||||
int intNewDeviceId = -1;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -385,7 +385,7 @@ int WINAPI devAddDevice(){
|
|||
return intNewDeviceId;
|
||||
}
|
||||
|
||||
bool WINAPI devRemoveDevice(int intDeviceId){
|
||||
bool WINAPI tdRemoveDevice(int intDeviceId){
|
||||
bool blnSuccess = false;
|
||||
try{
|
||||
TelldusSettings ts;
|
||||
|
@ -408,7 +408,7 @@ bool WINAPI devRemoveDevice(int intDeviceId){
|
|||
* @sa TELLSTICK_TOGGLE
|
||||
* @sa TELLSTICK_DIM
|
||||
*/
|
||||
int WINAPI devMethods(int id){
|
||||
int WINAPI tdMethods(int id){
|
||||
|
||||
int intMethods = 0;
|
||||
try{
|
||||
|
@ -438,7 +438,7 @@ int WINAPI devMethods(int id){
|
|||
* @sa TELLSTICK_ERROR_METHOD_NOT_SUPPORTED
|
||||
* @sa TELLSTICK_ERROR_UNKNOWN
|
||||
*/
|
||||
char * WINAPI devGetErrorString(int intErrorNo) {
|
||||
char * WINAPI tdGetErrorString(int intErrorNo) {
|
||||
const int numResponses = 5;
|
||||
const char *responses[numResponses] = {
|
||||
"Success",
|
||||
|
|
|
@ -24,29 +24,29 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TELLSTICK_API int WINAPI devTurnOn(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI devTurnOff(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI devBell(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI devDim(int intDeviceId, unsigned char level);
|
||||
TELLSTICK_API int WINAPI devMethods(int id);
|
||||
TELLSTICK_API int WINAPI tdTurnOn(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdTurnOff(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdBell(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdDim(int intDeviceId, unsigned char level);
|
||||
TELLSTICK_API int WINAPI tdMethods(int id);
|
||||
|
||||
TELLSTICK_API int WINAPI devGetNumberOfDevices();
|
||||
TELLSTICK_API int WINAPI devGetDeviceId(int intDeviceIndex);
|
||||
TELLSTICK_API int WINAPI tdGetNumberOfDevices();
|
||||
TELLSTICK_API int WINAPI tdGetDeviceId(int intDeviceIndex);
|
||||
|
||||
TELLSTICK_API char * WINAPI devGetErrorString(int intErrorNo);
|
||||
TELLSTICK_API char * WINAPI tdGetErrorString(int intErrorNo);
|
||||
|
||||
TELLSTICK_API char * WINAPI devGetName(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI devSetName(int intDeviceId, const char* chNewName);
|
||||
TELLSTICK_API char * WINAPI devGetVendor(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI devSetVendor(int intDeviceId, const char* chNewName);
|
||||
TELLSTICK_API int WINAPI devGetModel(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI devSetModel(int intDeviceId, int intModel);
|
||||
TELLSTICK_API char * WINAPI tdGetName(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetName(int intDeviceId, const char* chNewName);
|
||||
TELLSTICK_API char * WINAPI tdGetVendor(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetVendor(int intDeviceId, const char* chNewName);
|
||||
TELLSTICK_API int WINAPI tdGetModel(int intDeviceId);
|
||||
TELLSTICK_API bool WINAPI tdSetModel(int intDeviceId, int intModel);
|
||||
|
||||
TELLSTICK_API const char * WINAPI devGetArgument(int intDeviceId, const char *strName, const char *defaultValue);
|
||||
TELLSTICK_API bool WINAPI devSetArgument(int intDeviceId, const char *strName, const char* strValue);
|
||||
TELLSTICK_API const char * WINAPI tdGetArgument(int intDeviceId, const char *strName, const char *defaultValue);
|
||||
TELLSTICK_API bool WINAPI tdSetArgument(int intDeviceId, const char *strName, const char* strValue);
|
||||
|
||||
TELLSTICK_API int WINAPI devAddDevice();
|
||||
TELLSTICK_API bool WINAPI devRemoveDevice(int intDeviceId);
|
||||
TELLSTICK_API int WINAPI tdAddDevice();
|
||||
TELLSTICK_API bool WINAPI tdRemoveDevice(int intDeviceId);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "TellUsbD101.h"
|
||||
#include "../driver/libtelldus-core/telldus-core.h"
|
||||
#ifdef __MINGW32__
|
||||
#define sleep(x) _sleep((x)*1000)
|
||||
#endif
|
||||
|
@ -61,14 +61,14 @@ void print_version() {
|
|||
}
|
||||
|
||||
void print_device( int index ) {
|
||||
int intId = devGetDeviceId(index);
|
||||
char *name = devGetName(intId);
|
||||
int intId = tdGetDeviceId(index);
|
||||
char *name = tdGetName(intId);
|
||||
printf("%i\t%s\n", intId, name);
|
||||
free(name);
|
||||
}
|
||||
|
||||
void list_devices() {
|
||||
int intNum = devGetNumberOfDevices();
|
||||
int intNum = tdGetNumberOfDevices();
|
||||
printf("Number of devices: %i\n", intNum);
|
||||
int i = 0;
|
||||
while (i < intNum) {
|
||||
|
@ -80,11 +80,11 @@ void list_devices() {
|
|||
int find_device( char *device ) {
|
||||
int deviceId = atoi(device);
|
||||
if (deviceId == 0) { //Try to find the id from the name
|
||||
int intNum = devGetNumberOfDevices();
|
||||
int intNum = tdGetNumberOfDevices();
|
||||
int index = 0;
|
||||
while (index < intNum) {
|
||||
int id = devGetDeviceId(index);
|
||||
char *name = devGetName( id );
|
||||
int id = tdGetDeviceId(index);
|
||||
char *name = tdGetName( id );
|
||||
if (strcasecmp(name, device) == 0) {
|
||||
deviceId = id;
|
||||
free(name);
|
||||
|
@ -104,9 +104,9 @@ void switch_device( bool turnOn, char *device ) {
|
|||
return;
|
||||
}
|
||||
|
||||
char *name = devGetName( deviceId );
|
||||
int retval = (turnOn ? devTurnOn( deviceId ) : devTurnOff( deviceId ));
|
||||
char *errorString = devGetErrorString(retval);
|
||||
char *name = tdGetName( deviceId );
|
||||
int retval = (turnOn ? tdTurnOn( deviceId ) : tdTurnOff( deviceId ));
|
||||
char *errorString = tdGetErrorString(retval);
|
||||
|
||||
printf("Turning %s device: %i %s - %s\n", (turnOn ? "on" : "off"), deviceId, name, errorString);
|
||||
free(name);
|
||||
|
@ -127,9 +127,9 @@ void dim_device( char *device, int level ) {
|
|||
return;
|
||||
}
|
||||
|
||||
char *name = devGetName( deviceId );
|
||||
int retval = devDim( deviceId, (unsigned char)level );
|
||||
char *errorString = devGetErrorString(retval);
|
||||
char *name = tdGetName( deviceId );
|
||||
int retval = tdDim( deviceId, (unsigned char)level );
|
||||
char *errorString = tdGetErrorString(retval);
|
||||
printf("Dimming device: %i %s to %i - %s\n", deviceId, name, level, errorString);
|
||||
free(name);
|
||||
free(errorString);
|
||||
|
@ -145,9 +145,9 @@ void bell_device( char *device ) {
|
|||
return;
|
||||
}
|
||||
|
||||
char *name = devGetName( deviceId );
|
||||
int retval = devBell( deviceId );
|
||||
char *errorString = devGetErrorString(retval);
|
||||
char *name = tdGetName( deviceId );
|
||||
int retval = tdBell( deviceId );
|
||||
char *errorString = tdGetErrorString(retval);
|
||||
printf("Sending bell to: %i %s - %s\n", deviceId, name, errorString);
|
||||
free(name);
|
||||
free(errorString);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue