telldus-core

Functions

void WINAPI tdInit (void)
int WINAPI tdRegisterDeviceEvent (TDDeviceEvent eventFunction, void *context)
int WINAPI tdRegisterRawDeviceEvent (TDRawDeviceEvent eventFunction, void *context)
int WINAPI tdRegisterDeviceChangeEvent (TDDeviceChangeEvent eventFunction, void *context)
int WINAPI tdRegisterSensorEvent (TDSensorEvent eventFunction, void *context)
int WINAPI tdRegisterControllerEvent (TDControllerEvent eventFunction, void *context)
int WINAPI tdUnregisterCallback (int callbackId)
void WINAPI tdClose (void)
void WINAPI tdReleaseString (char *thestring)
int WINAPI tdTurnOn (int intDeviceId)
int WINAPI tdTurnOff (int intDeviceId)
int WINAPI tdBell (int intDeviceId)
int WINAPI tdDim (int intDeviceId, unsigned char level)
int WINAPI tdExecute (int intDeviceId)
int WINAPI tdUp (int intDeviceId)
int WINAPI tdDown (int intDeviceId)
int WINAPI tdStop (int intDeviceId)
int WINAPI tdLearn (int intDeviceId)
int WINAPI tdLastSentCommand (int intDeviceId, int methodsSupported)
char *WINAPI tdLastSentValue (int intDeviceId)
int WINAPI tdGetNumberOfDevices (void)
int WINAPI tdGetDeviceId (int intDeviceIndex)
int WINAPI tdGetDeviceType (int intDeviceId)
char *WINAPI tdGetName (int intDeviceId)
bool WINAPI tdSetName (int intDeviceId, const char *strNewName)
char *WINAPI tdGetProtocol (int intDeviceId)
bool WINAPI tdSetProtocol (int intDeviceId, const char *strProtocol)
char *WINAPI tdGetModel (int intDeviceId)
bool WINAPI tdSetModel (int intDeviceId, const char *strModel)
bool WINAPI tdSetDeviceParameter (int intDeviceId, const char *strName, const char *strValue)
char *WINAPI tdGetDeviceParameter (int intDeviceId, const char *strName, const char *defaultValue)
int WINAPI tdAddDevice ()
bool WINAPI tdRemoveDevice (int intDeviceId)
int WINAPI tdMethods (int id, int methodsSupported)
char *WINAPI tdGetErrorString (int intErrorNo)
int WINAPI tdSendRawCommand (const char *command, int reserved)
void WINAPI tdConnectTellStickController (int vid, int pid, const char *serial)
void WINAPI tdDisconnectTellStickController (int vid, int pid, const char *serial)
int WINAPI tdSensor (char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes)
int WINAPI tdSensorValue (const char *protocol, const char *model, int id, int dataType, char *value, int len, int *timestamp)
int WINAPI tdController (int *controllerId, int *controllerType, char *name, int nameLen, int *available)
int WINAPI tdControllerValue (int controllerId, const char *name, char *value, int valueLen)
int WINAPI tdSetControllerValue (int controllerId, const char *name, const char *value)
int WINAPI tdRemoveController (int controllerId)

Device method flags

Flags for the different methods/commands a device can support. Can be used as bit flags in e.g. tdMethods().

#define TELLSTICK_TURNON   1
#define TELLSTICK_TURNOFF   2
#define TELLSTICK_BELL   4
#define TELLSTICK_TOGGLE   8
#define TELLSTICK_DIM   16
#define TELLSTICK_LEARN   32
#define TELLSTICK_EXECUTE   64
#define TELLSTICK_UP   128
#define TELLSTICK_DOWN   256
#define TELLSTICK_STOP   512

Device types

The device type as returned from tdGetDeviceType().

#define TELLSTICK_TYPE_DEVICE   1
#define TELLSTICK_TYPE_GROUP   2
#define TELLSTICK_TYPE_SCENE   3

Sensor value types

The supported sensor value types are returned from tdSensor() and used when querying a sensor for a specific value in tdSensorValue().

#define TELLSTICK_TEMPERATURE   1
#define TELLSTICK_HUMIDITY   2
#define TELLSTICK_RAINRATE   4
#define TELLSTICK_RAINTOTAL   8
#define TELLSTICK_WINDDIRECTION   16
#define TELLSTICK_WINDAVERAGE   32
#define TELLSTICK_WINDGUST   64

Controller type

The controller type as returned from tdController().

#define TELLSTICK_CONTROLLER_TELLSTICK   1
#define TELLSTICK_CONTROLLER_TELLSTICK_DUO   2
#define TELLSTICK_CONTROLLER_TELLSTICK_NET   3

Device changes

Flags used in event callbacks.

#define TELLSTICK_DEVICE_ADDED   1
#define TELLSTICK_DEVICE_CHANGED   2
#define TELLSTICK_DEVICE_REMOVED   3
#define TELLSTICK_DEVICE_STATE_CHANGED   4

Change types

Flags used in event callbacks.

#define TELLSTICK_CHANGE_NAME   1
#define TELLSTICK_CHANGE_PROTOCOL   2
#define TELLSTICK_CHANGE_MODEL   3
#define TELLSTICK_CHANGE_METHOD   4
#define TELLSTICK_CHANGE_AVAILABLE   5
#define TELLSTICK_CHANGE_FIRMWARE   6

Error codes

The error codes returned from some API functions.

#define TELLSTICK_SUCCESS   0
#define TELLSTICK_ERROR_NOT_FOUND   -1
#define TELLSTICK_ERROR_PERMISSION_DENIED   -2
#define TELLSTICK_ERROR_DEVICE_NOT_FOUND   -3
#define TELLSTICK_ERROR_METHOD_NOT_SUPPORTED   -4
#define TELLSTICK_ERROR_COMMUNICATION   -5
#define TELLSTICK_ERROR_CONNECTING_SERVICE   -6
#define TELLSTICK_ERROR_UNKNOWN_RESPONSE   -7
#define TELLSTICK_ERROR_SYNTAX   -8
#define TELLSTICK_ERROR_BROKEN_PIPE   -9
#define TELLSTICK_ERROR_COMMUNICATING_SERVICE   -10
#define TELLSTICK_ERROR_UNKNOWN   -99

Callback typedefs

typedef void(* TDDeviceEvent )(int deviceId, int method, const char *data, int callbackId, void *context)
typedef void(* TDDeviceChangeEvent )(int deviceId, int changeEvent, int changeType, int callbackId, void *context)
typedef void(* TDRawDeviceEvent )(const char *data, int controllerId, int callbackId, void *context)
typedef void(* TDSensorEvent )(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *context)
typedef void(* TDControllerEvent )(int controllerId, int changeEvent, int changeType, const char *newValue, int callbackId, void *context)

Detailed Description

Telldus Core is the base module used to interface a Telldus TellStick.


Define Documentation

#define TELLSTICK_BELL   4

Device-flag for devices supporting the tdBell() call.

The controller is now available or unavailable.

#define TELLSTICK_CHANGE_FIRMWARE   6

The firmware has changed.

#define TELLSTICK_CHANGE_METHOD   4

The method has changed.

#define TELLSTICK_CHANGE_MODEL   3

The model has changed.

#define TELLSTICK_CHANGE_NAME   1

The name has changed.

#define TELLSTICK_CHANGE_PROTOCOL   2

The protocol has changed.

The controller is a TellStick.

The controller is a TellStick Duo.

The controller is a TellStick Net.

#define TELLSTICK_DEVICE_ADDED   1

A new device was added.

#define TELLSTICK_DEVICE_CHANGED   2

A device was changed.

#define TELLSTICK_DEVICE_REMOVED   3

A device was removed.

The state changed for a device.

#define TELLSTICK_DIM   16

Device-flag for devices supporting the tdDim() call.

#define TELLSTICK_DOWN   256

Device-flag for devices supporting the tdDown() call.

#define TELLSTICK_ERROR_BROKEN_PIPE   -9

Error code. Pipe broken during communication.

Error code. Timeout waiting for response from the Telldus Service.

Error code. An error occurred when communicating with TellStick.

Error code. The client library could not connect to the service. Maybe it is not running?

Error code. The supplied device id was not found.

Error code. The requested method is not supported by the device. This should be avoided by a call to tdMethods().

Referenced by tdControllerValue(), and tdSensorValue().

#define TELLSTICK_ERROR_NOT_FOUND   -1

Error code. Returned if a TellStick was not found on the system.

Error code. Returned if the user doesn't have privileges to open the TellStick device.

#define TELLSTICK_ERROR_SYNTAX   -8

Error code. Input/command could not be parsed or didn't follow input rules.

#define TELLSTICK_ERROR_UNKNOWN   -99

Error code. An unknown error has occurred.

Error code. The client library received a response from the service it did not understand.

#define TELLSTICK_EXECUTE   64

Device-flag for devices (scenes) supporting the tdExecute() call.

#define TELLSTICK_HUMIDITY   2

The sensor can report the humidity.

#define TELLSTICK_LEARN   32

Device-flag for devices supporting the tdLearn() call.

#define TELLSTICK_RAINRATE   4

The sensor can report rain fall rate.

#define TELLSTICK_RAINTOTAL   8

The sensor can report total rain fall.

#define TELLSTICK_STOP   512

Device-flag for devices supporting the tdStop() call.

#define TELLSTICK_SUCCESS   0

Error code. Returned when the command succeeded.

Referenced by tdControllerValue(), and tdSensorValue().

#define TELLSTICK_TEMPERATURE   1

The sensor can report the temperature.

#define TELLSTICK_TOGGLE   8

This method is currently unimplemented.

#define TELLSTICK_TURNOFF   2

Device-flag for devices supporting the tdTurnOff() call.

#define TELLSTICK_TURNON   1

Device-flag for devices supporting the tdTurnOn() call.

#define TELLSTICK_TYPE_DEVICE   1

Device type of a single device.

#define TELLSTICK_TYPE_GROUP   2

Device type of a device which contains other devices.

#define TELLSTICK_TYPE_SCENE   3

Device type of a device which contains other devices that are sent different commands when executed (i.e. one device turns on, another turns off).

#define TELLSTICK_UP   128

Device-flag for devices supporting the tdUp() call.

#define TELLSTICK_WINDAVERAGE   32

The sensor can report average wind speed.

#define TELLSTICK_WINDDIRECTION   16

The sensor can report wind direction.

#define TELLSTICK_WINDGUST   64

The sensor can report gust wind speed.


Typedef Documentation

The callback type for controller events.

Attention:
The callback will be called by another thread than the thread used by the application and some measures must be taken to synchronize it with the main thread.
Parameters:
controllerIdThe id of the controller that was added, changed or removed.
changeEventOne of the constants TELLSTICK_DEVICE_ADDED, TELLSTICK_DEVICE_CHANGED, TELLSTICK_DEVICE_STATE_CHANGED or TELLSTICK_DEVICE_REMOVED.
changeTypeIf changeEvent is:
newValueIf changeEvent is:
callbackIdThe id of the callback.
contextThe pointer passed when registering for the event.
See also:
tdRegisterControllerEvent

The callback type for device change events.

Attention:
The callback will be called by another thread than the thread used by the application and some measures must be taken to synchronize it with the main thread.
Parameters:
deviceIdThe id of the device that was added, changed or removed.
changeEventOne of the constants TELLSTICK_DEVICE_ADDED, TELLSTICK_DEVICE_CHANGED or TELLSTICK_DEVICE_REMOVED.
changeTypeIf changeEvent is TELLSTICK_DEVICE_CHANGED, this parameter indicates what has changed (e.g TELLSTICK_CHANGE_NAME, TELLSTICK_CHANGE_PROTOCOL, TELLSTICK_CHANGE_MODEL or TELLSTICK_CHANGE_METHOD).
callbackIdThe id of the callback.
contextThe pointer passed when registering for the event.
See also:
tdRegisterDeviceChangeEvent

The callback type for device events.

Attention:
The callback will be called by another thread than the thread used by the application and some measures must be taken to synchronize it with the main thread.
Parameters:
deviceIdThe id of the device that changed.
methodThe new device state. Can be TELLSTICK_TURNON, TELLSTICK_TURNOFF, etc.
dataIf method is TELLSTICK_DIM this holds the current value as a human readable string, example "128" for 50%.
callbackIdThe id of the callback.
contextThe pointer passed when registering for the event.
See also:
tdRegisterDeviceEvent

The callback type for raw events.

Attention:
The callback will be called by another thread than the thread used by the application and some measures must be taken to synchronize it with the main thread.
Parameters:
dataRaw device data.
controllerIdId of receiving controller.
callbackIdThe id of the callback.
contextThe pointer passed when registering for the event.
See also:
tdRegisterRawDeviceEvent

The callback type for sensor events.

Attention:
The callback will be called by another thread than the thread used by the application and some measures must be taken to synchronize it with the main thread.
Parameters:
protocolThe sensor's protocol.
modelThe model of the sensor.
idThe unique id for the sensor.
dataTypeThe type that value is. Can be one of TELLSTICK_TEMPERATURE, TELLSTICK_HUMIDITY, TELLSTICK_RAINTOTAL, TELLSTICK_RAINRATE, TELLSTICK_WINDDIRECTION, TELLSTICK_WINDAVERAGE or TELLSTICK_WINDGUST.
valueA human readable string of the data.
timestampThe time (as returned by the time() system call) when the value was received.
callbackIdThe id of the callback.
contextThe pointer passed when registering for the event.
See also:
tdRegisterSensorEvent

Function Documentation

int WINAPI tdAddDevice ( )

Add a new device to the global database of devices. This function must be called first before any call to tdSetName(), tdSetProtocol() and similar functions.

Returns:
The new device id for the newly created device. If the creation fails it returns an error (i.e. negative) value.
Since:
Version 2.0.0
int WINAPI tdBell ( int  intDeviceId)

Sends bell command to devices supporting this. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to send bell to.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.0.0
void WINAPI tdClose ( void  )

Close the library and clean up the cache it uses. This should be called when the library is not supposed to be used anymore.

Since:
Version 2.0.0
void WINAPI tdConnectTellStickController ( int  vid,
int  pid,
const char *  serial 
)

Connect a TellStick controller.

Parameters:
vidThe vendor id.
pidThe product id.
serialThe serial.
Since:
Version 2.1.0
int WINAPI tdController ( int *  controllerId,
int *  controllerType,
char *  name,
int  nameLen,
int *  available 
)

Use this function to iterate over all controllers. Iterate until TELLSTICK_SUCCESS is not returned

Parameters:
[out]controllerIdA by ref int where the id of the controller will be placed.
[out]controllerTypeA by ref int where the type of the controller will be placed.
[out]nameA by ref string where the name of the controller will be placed.
[in]nameLenThe length of the name parameter.
[out]availableA by ref int if the controller is currently available or maybe disconnected.
Returns:
TELLSTICK_SUCCESS if there is more sensors to be fetched.
See also:
TELLSTICK_CONTROLLER_TELLSTICK
TELLSTICK_CONTROLLER_TELLSTICK_DUO
TELLSTICK_CONTROLLER_TELLSTICK_NET
Since:
Version 2.1.2
int WINAPI tdControllerValue ( int  controllerId,
const char *  name,
char *  value,
int  valueLen 
)

This function gets a parameter on a controller. Valid parameters are: serial, name, available and firmware

Parameters:
[in]controllerIdThe controller to change.
[in]nameThe parameter to get.
[out]valueA by ref string where the value of the parameter will be placed.
[in]valueLenThe length of the value parameter.
Returns:
TELLSTICK_SUCCESS on success, or an error code on failure.
Since:
Version 2.1.2

References TELLSTICK_ERROR_METHOD_NOT_SUPPORTED, and TELLSTICK_SUCCESS.

int WINAPI tdDim ( int  intDeviceId,
unsigned char  level 
)

Dims a device. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to dim.
levelThe level the device should dim to. This value should be 0 - 255.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.0.0
void WINAPI tdDisconnectTellStickController ( int  vid,
int  pid,
const char *  serial 
)

Disconnect a TellStick controller.

Parameters:
vidThe vendor id.
pidThe product id.
serialThe serial.
Since:
Version 2.1.0
int WINAPI tdDown ( int  intDeviceId)

Send "down" command to device. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to send the command to.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.1.0
int WINAPI tdExecute ( int  intDeviceId)

Execute a scene action. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe id to execute.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.1.0
int WINAPI tdGetDeviceId ( int  intDeviceIndex)

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:

 int intNumberOfDevices = tdGetNumberOfDevices();
 for (int i = 0; i < intNumberOfDevices; i++) {
   int id = tdGetDeviceId( i );
   // id now contains the id number of the device with index of i
 }
Parameters:
intDeviceIndexThe device index to query. The index starts from 0.
Returns:
The unique id for the device or -1 if the device is not found.
Since:
Version 2.0.0
char* WINAPI tdGetDeviceParameter ( int  intDeviceId,
const char *  strName,
const char *  defaultValue 
)

Get a protocol specific parameter for a device.

Parameters:
intDeviceIdThe device to query.
strNameThe name of the parameter to query.
defaultValueA default value to return if the current parameter hasn't previously been set.
Returns:
The protocol specific parameter specified by strName. The returned string must be freed by calling tdReleaseString().
Since:
Version 2.0.0
int WINAPI tdGetDeviceType ( int  intDeviceId)

Get the device type.

Parameters:
intDeviceIdThe unique id of the device to query.
Returns:
Which type the device is. The device could be either TELLSTICK_TYPE_DEVICE, TELLSTICK_TYPE_GROUP or TELLSTICK_TYPE_SCENE
Since:
Version 2.0.0
char* WINAPI tdGetErrorString ( int  intErrorNo)

Get a human readable string from an error code returned from a function in telldus-core.

Parameters:
intErrorNoThe error code to translate.
Returns:
A string ready to show to the user. The returned string must be freed by calling tdReleaseString().
See also:
TELLSTICK_SUCCESS
TELLSTICK_ERROR_NOT_FOUND
TELLSTICK_ERROR_PERMISSION_DENIED
TELLSTICK_ERROR_DEVICE_NOT_FOUND
TELLSTICK_ERROR_METHOD_NOT_SUPPORTED
TELLSTICK_ERROR_COMMUNICATION
TELLSTICK_ERROR_CONNECTING_SERVICE
TELLSTICK_ERROR_UNKNOWN_RESPONSE
TELLSTICK_ERROR_SYNTAX
TELLSTICK_ERROR_BROKEN_PIPE
TELLSTICK_ERROR_COMMUNICATING_SERVICE
TELLSTICK_ERROR_UNKNOWN
Since:
Version 2.0.0
char* WINAPI tdGetModel ( int  intDeviceId)

Get the device model.

Parameters:
intDeviceIdThe device to query.
Returns:
The model for a device. Not all protocols uses this. The returned string must be freed by calling tdReleaseString().
Since:
Version 2.0.0
char* WINAPI tdGetName ( int  intDeviceId)

Query a device for it's name.

Parameters:
intDeviceIdThe unique id of the device to query.
Returns:
The name of the device or an empty string if the device is not found. The returned string must be freed by calling tdReleaseString().
Since:
Version 2.0.0
int WINAPI tdGetNumberOfDevices ( void  )

This function returns the number of devices configured.

Returns:
An integer of the total number of devices configured.
Since:
Version 2.0.0
char* WINAPI tdGetProtocol ( int  intDeviceId)

Get the device protocol.

Parameters:
intDeviceIdThe device id to query.
Returns:
The protocol used by a specific device. The returned string must be freed by calling tdReleaseString().
Since:
Version 2.0.0
void WINAPI tdInit ( void  )

This function initiates the library. Call this function before any other call to a function in telldus-core.

Since:
Version 2.0.0
int WINAPI tdLastSentCommand ( int  intDeviceId,
int  methodsSupported 
)

Returns the last sent command to a specific device

Parameters:
intDeviceIdThe device id to query.
methodsSupportedThe methods supported by the client. See tdMethods() for more information.
Returns:
The last sent command as integer, example TELLSTICK_TURNON or TELLSTICK_TURNOFF
Since:
Version 2.0.0
char* WINAPI tdLastSentValue ( int  intDeviceId)

If the last sent command it TELLSTICK_DIM this returns the dimmed value.

Parameters:
intDeviceIdThe device id to query.
Returns:
The the value as a human readable string, example "128" for 50%. The returned string must be freed by calling tdReleaseString().
Since:
Version 2.0.0
int WINAPI tdLearn ( int  intDeviceId)

Sends a special learn command to some devices that need a special learn-command to be used from TellStick. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to learn.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.0.0
int WINAPI tdMethods ( int  id,
int  methodsSupported 
)

Query a device for which methods it supports. By supplying the methods you support the library could remap the methods a device support for better fit the application.

Example of querying a device supporting TELLSTICK_BELL:

 int methods = tdMethods(
   id, TELLSTICK_TURNON | TELLSTICK_TURNOFF | TELLSTICK_BELL);
 // methods is now TELLSTICK_BELL
 int methods = tdMethods(id, TELLSTICK_TURNON | TELLSTICK_TURNOFF);
 // methods is now TELLSTICK_TURNON because the client application doesn't
 // support TELLSTICK_BELL
Parameters:
idThe device id to query.
methodsSupportedThe methods the client application supports.
Returns:
The method-flags OR'ed into an integer.
See also:
TELLSTICK_TURNON
TELLSTICK_TURNOFF
TELLSTICK_BELL
TELLSTICK_TOGGLE
TELLSTICK_DIM
TELLSTICK_EXECUTE
TELLSTICK_UP
TELLSTICK_DOWN
TELLSTICK_STOP
Since:
Version 2.0.0
int WINAPI tdRegisterControllerEvent ( TDControllerEvent  eventFunction,
void *  context 
)

Register a callback that will receive controller events.

Parameters:
eventFunctionCallback function.
contextPointer that will be passed back in the callback.
Returns:
An id identifying the callback. Pass this id to tdUnregisterCallback() to stop receiving callbacks.
See also:
Registering for callbacks
Since:
Version 2.1.2
int WINAPI tdRegisterDeviceChangeEvent ( TDDeviceChangeEvent  eventFunction,
void *  context 
)

Register a callback that will receive device change events. This includes addition of new devices, changes of device properties (e.g. name) and removal of existing devices.

Parameters:
eventFunctionCallback function.
contextPointer that will be passed back in the callback.
Returns:
An id identifying the callback. Pass this id to tdUnregisterCallback() to stop receiving callbacks.
See also:
Registering for callbacks
Since:
Version 2.1.0
int WINAPI tdRegisterDeviceEvent ( TDDeviceEvent  eventFunction,
void *  context 
)

Register a callback that will receive device events.

Parameters:
eventFunctionCallback function.
contextPointer that will be passed back in the callback.
Returns:
An id identifying the callback. Pass this id to tdUnregisterCallback() to stop receiving callbacks.
See also:
Registering for callbacks
Since:
Version 2.0.0
int WINAPI tdRegisterRawDeviceEvent ( TDRawDeviceEvent  eventFunction,
void *  context 
)

Register a callback that will receive raw (i.e. all) events.

Parameters:
eventFunctionCallback function.
contextPointer that will be passed back in the callback.
Returns:
An id identifying the callback. Pass this id to tdUnregisterCallback() to stop receiving callbacks.
See also:
Registering for callbacks
Since:
Version 2.0.0
int WINAPI tdRegisterSensorEvent ( TDSensorEvent  eventFunction,
void *  context 
)

Register a callback that will receive sensor events.

Parameters:
eventFunctionCallback function.
contextPointer that will be passed back in the callback.
Returns:
An id identifying the callback. Pass this id to tdUnregisterCallback() to stop receiving callbacks.
See also:
Registering for callbacks
Since:
Version 2.1.0
void WINAPI tdReleaseString ( char *  thestring)

This method releases resources allocated by telldus-core. It should be called on the returned value from all functions returning char *.

Parameters:
thestringA string returned from a td* function.
Since:
Version 2.0.1
int WINAPI tdRemoveController ( int  controllerId)

This function removes a controller from the list of controllers. The controller must not be available (disconnected) for this to work.

Parameters:
controllerIdThe controller to remove.
Returns:
TELLSTICK_SUCCESS if the controller was removed, TELLSTICK_ERROR_NOT_FOUND if the controller was not found, and TELLSTICK_ERROR_PERMISSION_DENIED if the controller is still connected.
Since:
Version 2.1.2
bool WINAPI tdRemoveDevice ( int  intDeviceId)

Removes a device.

Parameters:
intDeviceIdThe device to query.
Returns:
true on success, false otherwise.
Since:
Version 2.0.0
int WINAPI tdSendRawCommand ( const char *  command,
int  reserved 
)

Send a raw command to TellStick. Please read the TellStick protocol definition on how the command should be constructed.

Parameters:
commandThe command for TellStick in its native format.
reservedReserved for future use.
Returns:
TELLSTICK_SUCCESS on success or one of the error codes on failure
Since:
Version 2.0.0
int WINAPI tdSensor ( char *  protocol,
int  protocolLen,
char *  model,
int  modelLen,
int *  id,
int *  dataTypes 
)

Use this function to iterate over all sensors. Iterate until TELLSTICK_SUCCESS is not returned.

Parameters:
[out]protocolA by ref string where the protocol of the sensor will be placed.
[in]protocolLenThe length of the protocol parameter.
[out]modelA by ref string where the model of the sensor will be placed.
[in]modelLenThe length of the model parameter.
[out]idA by ref int where the id of the sensor will be placed.
[out]dataTypesA by ref int with flags for the supported sensor values.
Returns:
TELLSTICK_SUCCESS if there is more sensors to be fetched.
Since:
Version 2.1.0
int WINAPI tdSensorValue ( const char *  protocol,
const char *  model,
int  id,
int  dataType,
char *  value,
int  len,
int *  timestamp 
)

Get one of the supported sensor values from a sensor. Make sure it support the value type first by calling tdSensor(). The triplet protocol, model and id together identifies a sensor.

Parameters:
[in]protocolThe protocol for the sensor.
[in]modelThe model for the sensor.
[in]idThe id of the sensor.
[in]dataTypeWhich sensor value to retrive (one of TELLSTICK_TEMPERATURE, TELLSTICK_HUMIDITY, TELLSTICK_RAINTOTAL, TELLSTICK_RAINRATE, TELLSTICK_WINDDIRECTION, TELLSTICK_WINDAVERAGE or TELLSTICK_WINDGUST.
[out]valueA by ref string where the value will be placed.
[in]lenThe length of the value parameter.
[out]timestampA by ref int where the timestamp of the value will be placed.
Returns:
TELLSTICK_SUCCESS if the value could be fetched or one of the error codes on failure.
Since:
Version 2.1.0

References TELLSTICK_ERROR_METHOD_NOT_SUPPORTED, and TELLSTICK_SUCCESS.

int WINAPI tdSetControllerValue ( int  controllerId,
const char *  name,
const char *  value 
)

This function sets a parameter on a controller. Valid parameters are: name.

Parameters:
controllerIdThe controller to change.
nameThe parameter to change.
valueThe new value for the parameter.
Returns:
TELLSTICK_SUCCESS on success, or an error code on failure.
Since:
Version 2.1.2
bool WINAPI tdSetDeviceParameter ( int  intDeviceId,
const char *  strName,
const char *  strValue 
)

Sets a new protocol specific parameter. Please see the documentation of the protocols before setting any parameter.

Parameters:
intDeviceIdThe device to change.
strNameThe parameter to change.
strValueThe new value for the parameter.
Returns:
true on success, false otherwise.
Since:
Version 2.0.0
bool WINAPI tdSetModel ( int  intDeviceId,
const char *  strModel 
)

Sets a new model for a device. Which model to set depends on the current protocol.

Parameters:
intDeviceIdThe device to change.
strModelThe new model.
Returns:
true on success, false otherwise.
Since:
Version 2.0.0
bool WINAPI tdSetName ( int  intDeviceId,
const char *  strNewName 
)

Sets a new name for a device. The devices are global for all application, changing this will change the name for other applications as well.

Parameters:
intDeviceIdThe device id to change the name for.
strNewNameThe new name for the devices.
Returns:
true on success, false otherwise.
Since:
Version 2.0.0
bool WINAPI tdSetProtocol ( int  intDeviceId,
const char *  strProtocol 
)

This changes the current protocol used by a device. After changing the protocol, setting new parameters is required.

Parameters:
intDeviceIdThe device to change.
strProtocolThe new protocol to use.
Returns:
true on success, false otherwise.
See also:
tdSetModel()
tdSetDeviceParameter()
Since:
Version 2.0.0
int WINAPI tdStop ( int  intDeviceId)

Send "stop" command to device. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to stop.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.1.0
int WINAPI tdTurnOff ( int  intDeviceId)

Turns a device off. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to turn off.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.0.0
int WINAPI tdTurnOn ( int  intDeviceId)

Turns a device on. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to turn on.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.0.0
int WINAPI tdUnregisterCallback ( int  callbackId)

Unregister a callback.

Parameters:
callbackIdThe returned id from one of the tdRegister* functions.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
See also:
Registering for callbacks
Since:
Version 2.1.0
int WINAPI tdUp ( int  intDeviceId)

Send "up" command to device. Make sure the device supports this by calling tdMethods() before any call to this function.

Parameters:
intDeviceIdThe device id to send the command to.
Returns:
TELLSTICK_SUCCESS on success or appropriate error code on failure.
Since:
Version 2.1.0