• Help/Guide
  • About Trac
  • Preferences
  • OpenID Login
  • Wiki
  • Blog
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search
  • Doxygen

Context Navigation


  • Main Page
  • Related Pages
  • Modules
  • Files
  • File List

telldus-core/client/telldus-core.h

00001 #ifndef TELLDUSCORE_H
00002 #define TELLDUSCORE_H
00003 
00004 // The following ifdef block is the standard way of creating macros
00005 // which make exporting from a DLL simpler.  All files within this DLL
00006 // are compiled with the TELLDUSCORE_EXPORTS symbol defined on the command line.
00007 // This symbol should not be defined on any project that uses this DLL.
00008 // This way any other project whose source files include this file see
00009 // TELLSTICK_API functions as being imported from a DLL, whereas this DLL
00010 // sees symbols defined with this macro as being exported.
00011
00012 #ifdef _WINDOWS
00013         #if defined(TELLDUSCORE_EXPORTS)
00014                 #if defined(_CL64)
00015                         #define TELLSTICK_API
00016                 #else
00017                         #define TELLSTICK_API __declspec(dllexport)
00018                 #endif
00019         #else
00020                 #define TELLSTICK_API __declspec(dllimport)
00021         #endif
00022         #define WINAPI __stdcall
00023 #else
00024         #define WINAPI
00025         #define TELLSTICK_API __attribute__ ((visibility("default")))
00026 #endif
00027 
00028 typedef void (WINAPI *TDDeviceEvent)(int deviceId, int method, const char *data, int callbackId, void *context);
00029 typedef void (WINAPI *TDDeviceChangeEvent)(int deviceId, int changeEvent, int changeType, int callbackId, void *context);
00030 typedef void (WINAPI *TDRawDeviceEvent)(const char *data, int controllerId, int callbackId, void *context);
00031 typedef void (WINAPI *TDSensorEvent)(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *context);
00032 typedef void (WINAPI *TDControllerEvent)(int controllerId, int changeEvent, int changeType, const char *newValue, int callbackId, void *context);
00033
00034 #ifndef __cplusplus
00035         #define bool char
00036 #endif
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041         TELLSTICK_API void WINAPI tdInit(void);
00042         TELLSTICK_API int WINAPI tdRegisterDeviceEvent( TDDeviceEvent eventFunction, void *context );
00043         TELLSTICK_API int WINAPI tdRegisterDeviceChangeEvent( TDDeviceChangeEvent eventFunction, void *context);
00044         TELLSTICK_API int WINAPI tdRegisterRawDeviceEvent( TDRawDeviceEvent eventFunction, void *context );
00045         TELLSTICK_API int WINAPI tdRegisterSensorEvent( TDSensorEvent eventFunction, void *context );
00046         TELLSTICK_API int WINAPI tdRegisterControllerEvent( TDControllerEvent eventFunction, void *context);
00047         TELLSTICK_API int WINAPI tdUnregisterCallback( int callbackId );
00048         TELLSTICK_API void WINAPI tdClose(void);
00049         TELLSTICK_API void WINAPI tdReleaseString(char *string);
00050
00051         TELLSTICK_API int WINAPI tdTurnOn(int intDeviceId);
00052         TELLSTICK_API int WINAPI tdTurnOff(int intDeviceId);
00053         TELLSTICK_API int WINAPI tdBell(int intDeviceId);
00054         TELLSTICK_API int WINAPI tdDim(int intDeviceId, unsigned char level);
00055         TELLSTICK_API int WINAPI tdExecute(int intDeviceId);
00056         TELLSTICK_API int WINAPI tdUp(int intDeviceId);
00057         TELLSTICK_API int WINAPI tdDown(int intDeviceId);
00058         TELLSTICK_API int WINAPI tdStop(int intDeviceId);
00059         TELLSTICK_API int WINAPI tdLearn(int intDeviceId);
00060         TELLSTICK_API int WINAPI tdMethods(int id, int methodsSupported);
00061         TELLSTICK_API int WINAPI tdLastSentCommand( int intDeviceId, int methodsSupported );
00062         TELLSTICK_API char *WINAPI tdLastSentValue( int intDeviceId );
00063
00064         TELLSTICK_API int WINAPI tdGetNumberOfDevices();
00065         TELLSTICK_API int WINAPI tdGetDeviceId(int intDeviceIndex);
00066         TELLSTICK_API int WINAPI tdGetDeviceType(int intDeviceId);
00067
00068         TELLSTICK_API char * WINAPI tdGetErrorString(int intErrorNo);
00069
00070         TELLSTICK_API char * WINAPI tdGetName(int intDeviceId);
00071         TELLSTICK_API bool WINAPI tdSetName(int intDeviceId, const char* chNewName);
00072         TELLSTICK_API char * WINAPI tdGetProtocol(int intDeviceId);
00073         TELLSTICK_API bool WINAPI tdSetProtocol(int intDeviceId, const char* strProtocol);
00074         TELLSTICK_API char * WINAPI tdGetModel(int intDeviceId);
00075         TELLSTICK_API bool WINAPI tdSetModel(int intDeviceId, const char *intModel);
00076
00077         TELLSTICK_API char * WINAPI tdGetDeviceParameter(int intDeviceId, const char *strName, const char *defaultValue);
00078         TELLSTICK_API bool WINAPI tdSetDeviceParameter(int intDeviceId, const char *strName, const char* strValue);
00079
00080         TELLSTICK_API int WINAPI tdAddDevice();
00081         TELLSTICK_API bool WINAPI tdRemoveDevice(int intDeviceId);
00082
00083         TELLSTICK_API int WINAPI tdSendRawCommand(const char *command, int reserved);
00084
00085         TELLSTICK_API void WINAPI tdConnectTellStickController(int vid, int pid, const char *serial);
00086         TELLSTICK_API void WINAPI tdDisconnectTellStickController(int vid, int pid, const char *serial);
00087
00088         TELLSTICK_API int WINAPI tdSensor(char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes);
00089         TELLSTICK_API int WINAPI tdSensorValue(const char *protocol, const char *model, int id, int dataType, char *value, int len, int *timestamp);
00090
00091         TELLSTICK_API int WINAPI tdController(int *controllerId, int *controllerType, char *name, int nameLen, int *available);
00092         TELLSTICK_API int WINAPI tdControllerValue(int controllerId, const char *name, char *value, int valueLen);
00093         TELLSTICK_API int WINAPI tdSetControllerValue(int controllerId, const char *name, const char *value);
00094         TELLSTICK_API int WINAPI tdRemoveController(int controllerId);
00095
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 
00100 //Device methods
00101 #define TELLSTICK_TURNON        1
00102 #define TELLSTICK_TURNOFF       2
00103 #define TELLSTICK_BELL          4
00104 #define TELLSTICK_TOGGLE        8
00105 #define TELLSTICK_DIM           16
00106 #define TELLSTICK_LEARN         32
00107 #define TELLSTICK_EXECUTE       64
00108 #define TELLSTICK_UP            128
00109 #define TELLSTICK_DOWN          256
00110 #define TELLSTICK_STOP          512
00111 
00112 //Sensor value types
00113 #define TELLSTICK_TEMPERATURE   1
00114 #define TELLSTICK_HUMIDITY              2
00115 
00116 //Error codes
00117 #define TELLSTICK_SUCCESS 0
00118 #define TELLSTICK_ERROR_NOT_FOUND -1
00119 #define TELLSTICK_ERROR_PERMISSION_DENIED -2
00120 #define TELLSTICK_ERROR_DEVICE_NOT_FOUND -3
00121 #define TELLSTICK_ERROR_METHOD_NOT_SUPPORTED -4
00122 #define TELLSTICK_ERROR_COMMUNICATION -5
00123 #define TELLSTICK_ERROR_CONNECTING_SERVICE -6
00124 #define TELLSTICK_ERROR_UNKNOWN_RESPONSE -7
00125 #define TELLSTICK_ERROR_SYNTAX -8
00126 #define TELLSTICK_ERROR_BROKEN_PIPE -9
00127 #define TELLSTICK_ERROR_COMMUNICATING_SERVICE -10
00128 #define TELLSTICK_ERROR_CONFIG_SYNTAX -11
00129 #define TELLSTICK_ERROR_UNKNOWN -99
00130 
00131 //Device typedef
00132 #define TELLSTICK_TYPE_DEVICE   1
00133 #define TELLSTICK_TYPE_GROUP    2
00134 #define TELLSTICK_TYPE_SCENE    3
00135 
00136 //Controller typedef
00137 #define TELLSTICK_CONTROLLER_TELLSTICK      1
00138 #define TELLSTICK_CONTROLLER_TELLSTICK_DUO  2
00139 #define TELLSTICK_CONTROLLER_TELLSTICK_NET  3
00140 
00141 //Device changes
00142 #define TELLSTICK_DEVICE_ADDED                  1
00143 #define TELLSTICK_DEVICE_CHANGED                2
00144 #define TELLSTICK_DEVICE_REMOVED                3
00145 #define TELLSTICK_DEVICE_STATE_CHANGED  4
00146 
00147 //Change types
00148 #define TELLSTICK_CHANGE_NAME                   1
00149 #define TELLSTICK_CHANGE_PROTOCOL               2
00150 #define TELLSTICK_CHANGE_MODEL                  3
00151 #define TELLSTICK_CHANGE_METHOD                 4
00152 #define TELLSTICK_CHANGE_AVAILABLE              5
00153 #define TELLSTICK_CHANGE_FIRMWARE               6
00154 
00155 #endif

Trac Powered

Powered by Trac 0.12.2
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/