added telldus python bindings

This commit is contained in:
Øyvind Saltvik 2012-08-04 18:42:00 +02:00
parent 84330f8518
commit 9d11cfb07f
5 changed files with 673 additions and 0 deletions

View file

@ -0,0 +1,3 @@
include telldus.c
include telldus-core.h
recursive-include example/*

View file

@ -0,0 +1,42 @@
import telldus
import time
telldus.tdInit()
devices = telldus.tdGetNumberOfDevices();
print "Devices: %d\n" % devices
allMethods = telldus.TELLDUS_TURNON | telldus.TELLDUS_TURNOFF | telldus.TELLDUS_BELL | telldus.TELLDUS_DIM
for i in xrange(devices):
deviceid = telldus.tdGetDeviceId(i);
name = tdGetName(id)
print "%s - %s\n" % (deviceid, name)
methods = telldus.tdMethods(deviceid, allMethods)
if methods & telldus.TELLDUS_TURNON:
print " * TurnOn\n"
telldus.tdTurnOn(deviceid)
time.sleep(1)
if methods & telldus.TELLDUS_TURNOFF:
print " * TurnOff\n"
telldus.tdTurnOff(deviceid)
time.sleep(1)
if methods & telldus.TELLDUS_BELL:
echo " * Bell\n"
telldus.tdBell(deviceid)
time.sleep(1)
if methods & telldus.TELLDUS_TOGGLE
print " * Toggle\n"
if methods & telldus.TELLDUS_DIM:
print " * Dim\n"
telldus.tdDim(deviceid, 128)
time.sleep(1)
telldus.tdClose()

19
bindings/python/setup.py Normal file
View file

@ -0,0 +1,19 @@
from distutils.core import setup, Extension
telldus = Extension(
'telldus',
include_dirs = ['/usr/local/include'],
libraries = ['telldus-core'],
library_dirs = ['/usr/lib'],
sources = ['telldus.c']
)
setup(
name = 'telldus',
version = '1.0',
description = 'Python bindings for telldus',
author='Oyvind Saltvik',
author_email='oyvind.saltvik@gmail.com',
url='http://github.com/fivethreeo/telldus/',
ext_modules = [telldus]
)

View file

@ -0,0 +1,161 @@
//
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_
#define TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_
// The following ifdef block is the standard way of creating macros
// which make exporting from a DLL simpler. All files within this DLL
// are compiled with the TELLDUSCORE_EXPORTS symbol defined on the command line.
// This symbol should not be defined on any project that uses this DLL.
// This way any other project whose source files include this file see
// TELLSTICK_API functions as being imported from a DLL, whereas this DLL
// sees symbols defined with this macro as being exported.
#ifdef _WINDOWS
#if defined(TELLDUSCORE_EXPORTS)
#if defined(_CL64)
#define TELLSTICK_API
#else
#define TELLSTICK_API __declspec(dllexport)
#endif
#else
#define TELLSTICK_API __declspec(dllimport)
#endif
#define WINAPI __stdcall
#else
#define WINAPI
#define TELLSTICK_API __attribute__ ((visibility("default")))
#endif
typedef void (WINAPI *TDDeviceEvent)(int deviceId, int method, const char *data, int callbackId, void *context);
typedef void (WINAPI *TDDeviceChangeEvent)(int deviceId, int changeEvent, int changeType, int callbackId, void *context);
typedef void (WINAPI *TDRawDeviceEvent)(const char *data, int controllerId, int callbackId, void *context);
typedef void (WINAPI *TDSensorEvent)(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *context);
typedef void (WINAPI *TDControllerEvent)(int controllerId, int changeEvent, int changeType, const char *newValue, int callbackId, void *context);
#ifndef __cplusplus
#define bool char
#endif
#ifdef __cplusplus
extern "C" {
#endif
TELLSTICK_API void WINAPI tdInit(void);
TELLSTICK_API int WINAPI tdRegisterDeviceEvent( TDDeviceEvent eventFunction, void *context );
TELLSTICK_API int WINAPI tdRegisterDeviceChangeEvent( TDDeviceChangeEvent eventFunction, void *context);
TELLSTICK_API int WINAPI tdRegisterRawDeviceEvent( TDRawDeviceEvent eventFunction, void *context );
TELLSTICK_API int WINAPI tdRegisterSensorEvent( TDSensorEvent eventFunction, void *context );
TELLSTICK_API int WINAPI tdRegisterControllerEvent( TDControllerEvent eventFunction, void *context);
TELLSTICK_API int WINAPI tdUnregisterCallback( int callbackId );
TELLSTICK_API void WINAPI tdClose(void);
TELLSTICK_API void WINAPI tdReleaseString(char *thestring);
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 tdExecute(int intDeviceId);
TELLSTICK_API int WINAPI tdUp(int intDeviceId);
TELLSTICK_API int WINAPI tdDown(int intDeviceId);
TELLSTICK_API int WINAPI tdStop(int intDeviceId);
TELLSTICK_API int WINAPI tdLearn(int intDeviceId);
TELLSTICK_API int WINAPI tdMethods(int id, int methodsSupported);
TELLSTICK_API int WINAPI tdLastSentCommand( int intDeviceId, int methodsSupported );
TELLSTICK_API char *WINAPI tdLastSentValue( int intDeviceId );
TELLSTICK_API int WINAPI tdGetNumberOfDevices();
TELLSTICK_API int WINAPI tdGetDeviceId(int intDeviceIndex);
TELLSTICK_API int WINAPI tdGetDeviceType(int intDeviceId);
TELLSTICK_API char * WINAPI tdGetErrorString(int intErrorNo);
TELLSTICK_API char * WINAPI tdGetName(int intDeviceId);
TELLSTICK_API bool WINAPI tdSetName(int intDeviceId, const char* chNewName);
TELLSTICK_API char * WINAPI tdGetProtocol(int intDeviceId);
TELLSTICK_API bool WINAPI tdSetProtocol(int intDeviceId, const char* strProtocol);
TELLSTICK_API char * WINAPI tdGetModel(int intDeviceId);
TELLSTICK_API bool WINAPI tdSetModel(int intDeviceId, const char *intModel);
TELLSTICK_API char * WINAPI tdGetDeviceParameter(int intDeviceId, const char *strName, const char *defaultValue);
TELLSTICK_API bool WINAPI tdSetDeviceParameter(int intDeviceId, const char *strName, const char* strValue);
TELLSTICK_API int WINAPI tdAddDevice();
TELLSTICK_API bool WINAPI tdRemoveDevice(int intDeviceId);
TELLSTICK_API int WINAPI tdSendRawCommand(const char *command, int reserved);
TELLSTICK_API void WINAPI tdConnectTellStickController(int vid, int pid, const char *serial);
TELLSTICK_API void WINAPI tdDisconnectTellStickController(int vid, int pid, const char *serial);
TELLSTICK_API int WINAPI tdSensor(char *protocol, int protocolLen, char *model, int modelLen, int *id, int *dataTypes);
TELLSTICK_API int WINAPI tdSensorValue(const char *protocol, const char *model, int id, int dataType, char *value, int len, int *timestamp);
TELLSTICK_API int WINAPI tdController(int *controllerId, int *controllerType, char *name, int nameLen, int *available);
TELLSTICK_API int WINAPI tdControllerValue(int controllerId, const char *name, char *value, int valueLen);
TELLSTICK_API int WINAPI tdSetControllerValue(int controllerId, const char *name, const char *value);
TELLSTICK_API int WINAPI tdRemoveController(int controllerId);
#ifdef __cplusplus
}
#endif
// Device methods
#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
// Sensor value types
#define TELLSTICK_TEMPERATURE 1
#define TELLSTICK_HUMIDITY 2
// Error codes
#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_CONFIG_SYNTAX -11
#define TELLSTICK_ERROR_UNKNOWN -99
// Device typedef
#define TELLSTICK_TYPE_DEVICE 1
#define TELLSTICK_TYPE_GROUP 2
#define TELLSTICK_TYPE_SCENE 3
// Controller typedef
#define TELLSTICK_CONTROLLER_TELLSTICK 1
#define TELLSTICK_CONTROLLER_TELLSTICK_DUO 2
#define TELLSTICK_CONTROLLER_TELLSTICK_NET 3
// Device changes
#define TELLSTICK_DEVICE_ADDED 1
#define TELLSTICK_DEVICE_CHANGED 2
#define TELLSTICK_DEVICE_REMOVED 3
#define TELLSTICK_DEVICE_STATE_CHANGED 4
// Change types
#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
#endif // TELLDUS_CORE_CLIENT_TELLDUS_CORE_H_

448
bindings/python/telldus.c Normal file
View file

@ -0,0 +1,448 @@
#include "Python.h"
#include <telldus-core.h>
#include <stdio.h>
/* estrdup.c -- duplicate a string, die if error
*
* char *string;
* char *newstring;
* newstring = estrdup(string);
*
* estrdup returns a copy of its argument, located in memory
* allocated from the heap. If it is unable to allocate the
* necessary memory, estrdup executes error("no memory").
* (Generally, the routine error is not expected to return,
* but if it does, estrdup will return NULL.)
*/
char *
estrdup(char *s)
{
register char *t;
if (NULL == (t = malloc(strlen(s)+1))) {
return NULL;
}
strcpy(t, s);
return(t);
}
static PyObject *
telldus_tdInit(PyObject *self)
{
tdInit();
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
telldus_tdClose(PyObject *self)
{
tdClose();
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
telldus_tdTurnOn(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyBool_FromLong((long) tdTurnOn(id));
}
static PyObject *
telldus_tdTurnOff(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyBool_FromLong((long) tdTurnOff(id));
}
static PyObject *
telldus_tdBell(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyBool_FromLong((long) tdBell(id));
}
static PyObject *
telldus_tdDim(PyObject *self, PyObject *args)
{
long id;
long level;
if (!PyArg_ParseTuple(args, "ll", &id, &level))
return NULL;
if (level < 0 || level > 255)
return NULL;
return PyBool_FromLong((long) tdDim(id, level));
}
static PyObject *
telldus_tdLearn(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyBool_FromLong((long) tdLearn(id));
}
static PyObject *
telldus_tdMethods(PyObject *self, PyObject *args)
{
long id;
long supportedmethods;
if (!PyArg_ParseTuple(args, "ll", &id, &supportedmethods))
return NULL;
return PyLong_FromLong((long) tdMethods(id, supportedmethods));
}
static PyObject *
telldus_tdLastSentCommand(PyObject *self, PyObject *args)
{
long id;
long supportedmethods;
if (!PyArg_ParseTuple(args, "ll", &id, &supportedmethods))
return NULL;
return PyLong_FromLong((long) tdLastSentCommand(id, supportedmethods));
}
static PyObject *
telldus_tdLastSentValue(PyObject *self, PyObject *args)
{
long id;
char* value;
char* retval;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
value = tdLastSentValue(id);
retval = estrdup(value);
tdReleaseString(value);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdGetNumberOfDevices(PyObject *self)
{
return PyLong_FromLong((long) tdGetNumberOfDevices());
}
static PyObject *
telldus_tdGetDeviceId(PyObject *self, PyObject *args)
{
long index;
if (!PyArg_ParseTuple(args, "l", &index))
return NULL;
return PyLong_FromLong((long) tdGetDeviceId(index));
}
static PyObject *
telldus_tdGetDeviceType(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyLong_FromLong((long) tdGetDeviceType(id));
}
static PyObject *
telldus_tdGetErrorString(PyObject *self, PyObject *args)
{
long errorno;
char* errorString;
char* retval;
if (!PyArg_ParseTuple(args, "l", &errorno))
return NULL;
errorString = tdGetErrorString(errorno);
retval = estrdup(errorString);
tdReleaseString(errorString);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdGetName(PyObject *self, PyObject *args)
{
long id;
char* name;
char* retval;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
name = tdGetName(id);
retval = estrdup(name);
tdReleaseString(name);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdSetName(PyObject *self, PyObject *args)
{
long id;
char* name;
if (!PyArg_ParseTuple(args, "ls", &id, &name))
return NULL;
return PyBool_FromLong((long) tdSetName(id, name));
}
static PyObject *
telldus_tdGetProtocol(PyObject *self, PyObject *args)
{
long id;
char* protocol;
char* retval;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
protocol = tdGetProtocol(id);
retval = estrdup(protocol);
tdReleaseString(protocol);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdSetProtocol(PyObject *self, PyObject *args)
{
long id;
char* protocol;
if (!PyArg_ParseTuple(args, "ls", &id, &protocol))
return NULL;
return PyBool_FromLong((long) tdSetProtocol(id, protocol));
}
static PyObject *
telldus_tdGetModel(PyObject *self, PyObject *args)
{
long id;
char* model;
char* retval;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
model = tdGetModel(id);
retval = estrdup(model);
tdReleaseString(model);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdSetModel(PyObject *self, PyObject *args)
{
long id;
char* model;
if (!PyArg_ParseTuple(args, "ls", &id, &model))
return NULL;
return PyBool_FromLong((long) tdSetProtocol(id, model));
}
static PyObject *
telldus_tdGetDeviceParameter(PyObject *self, PyObject *args)
{
long id;
char* name;
char* defaultValue;
char* param;
char* retval;
if (!PyArg_ParseTuple(args, "lss", &id, &name, &defaultValue))
return NULL;
param = tdGetDeviceParameter(id, name, defaultValue);
retval = estrdup(param);
tdReleaseString(param);
return PyString_FromString(retval);
}
static PyObject *
telldus_tdSetDeviceParameter(PyObject *self, PyObject *args)
{
long id;
char* name;
char* value;
if (!PyArg_ParseTuple(args, "lss", &id, &name, &value))
return NULL;
return PyBool_FromLong((long) tdSetDeviceParameter(id, name, value));
}
static PyObject *
telldus_tdAddDevice(PyObject *self)
{
return PyLong_FromLong((long) tdAddDevice());
}
static PyObject *
telldus_tdRemoveDevice(PyObject *self, PyObject *args)
{
long id;
if (!PyArg_ParseTuple(args, "l", &id))
return NULL;
return PyBool_FromLong((long) tdRemoveDevice(id));
}
static PyObject *
telldus_tdSendRawCommand(PyObject *self, PyObject *args)
{
char *command;
long reserved = 0;
if (!PyArg_ParseTuple(args, "s|l", &command, &reserved));
return NULL;
return PyLong_FromLong((long) tdSendRawCommand(command, reserved));
}
static PyMethodDef telldus_methods[] = {
/* The cast of the function is necessary since PyCFunction values
* only take two PyObject* parameters, and keywdarg_parrot() takes
* three.
*/
{"tdInit", (PyCFunction) telldus_tdInit, METH_NOARGS, "Initiate telldus."},
{"tdClose", (PyCFunction) telldus_tdClose, METH_NOARGS, "Close telldus."},
{"tdTurnOn", (PyCFunction) telldus_tdTurnOn, METH_VARARGS, "Turn on device."},
{"tdTurnOff", (PyCFunction) telldus_tdTurnOff, METH_VARARGS, "Turn off device."},
{"tdBell", (PyCFunction) telldus_tdBell, METH_VARARGS, "Bell device."},
{"tdDim", (PyCFunction) telldus_tdDim, METH_VARARGS, "Dim device."},
{"tdLearn", (PyCFunction) telldus_tdLearn, METH_VARARGS, "Learn device."},
{"tdMethods", (PyCFunction) telldus_tdMethods, METH_VARARGS, "Methods comment."},
{"tdLastSentCommand", (PyCFunction) telldus_tdLastSentCommand, METH_VARARGS, "LastSentCommand comment."},
{"tdLastSentValue", (PyCFunction) telldus_tdLastSentValue, METH_VARARGS, "LastSentValue comment."},
{"tdGetNumberOfDevices", (PyCFunction) telldus_tdGetNumberOfDevices, METH_VARARGS, "GetNumberOfDevices comment."},
{"tdGetDeviceId", (PyCFunction) telldus_tdGetDeviceId, METH_VARARGS, "GetDeviceId comment."},
{"tdGetDeviceType", (PyCFunction) telldus_tdGetDeviceType, METH_VARARGS, "GetDeviceType comment."},
{"tdGetErrorString", (PyCFunction) telldus_tdGetErrorString, METH_VARARGS, "GetErrorString comment."},
{"tdGetName", (PyCFunction) telldus_tdGetName, METH_VARARGS, "GetName comment."},
{"tdSetName", (PyCFunction) telldus_tdSetName, METH_VARARGS, "SetName comment."},
{"tdGetProtocol", (PyCFunction) telldus_tdGetProtocol, METH_VARARGS, "GetProtocol comment."},
{"tdSetProtocol", (PyCFunction) telldus_tdSetProtocol, METH_VARARGS, "SetProtocol comment."},
{"tdGetModel", (PyCFunction) telldus_tdGetModel, METH_VARARGS, "GetModel comment."},
{"tdSetModel", (PyCFunction) telldus_tdSetModel, METH_VARARGS, "SetModel comment."},
{"tdGetDeviceParameter", (PyCFunction) telldus_tdGetDeviceParameter, METH_VARARGS, "GetDeviceParameter comment."},
{"tdSetDeviceParameter", (PyCFunction) telldus_tdSetDeviceParameter, METH_VARARGS, "SetDeviceParameter comment."},
{"tdAddDevice", (PyCFunction) telldus_tdAddDevice, METH_NOARGS, "AddDevice comment."},
{"tdRemoveDevice", (PyCFunction) telldus_tdRemoveDevice, METH_VARARGS, "RemoveDevice comment."},
{"tdSendRawCommand", (PyCFunction) telldus_tdSendRawCommand, METH_VARARGS, "SendRawCommand comment."},
{NULL, NULL, 0, NULL} /* sentinel */
};
void
inittelldus(void)
{
/* Create the module and add the functions */
PyObject *module = Py_InitModule("telldus", telldus_methods);
PyObject *TELLSTICK_TURNON_GLUE = PyLong_FromLong((long) TELLSTICK_TURNON);
PyObject_SetAttrString(module, "TELLSTICK_TURNON", TELLSTICK_TURNON_GLUE);
Py_DECREF(TELLSTICK_TURNON_GLUE);
PyObject *TELLSTICK_TURNOFF_GLUE = PyLong_FromLong((long) TELLSTICK_TURNOFF);
PyObject_SetAttrString(module, "TELLSTICK_TURNOFF", TELLSTICK_TURNOFF_GLUE);
Py_DECREF(TELLSTICK_TURNOFF_GLUE);
PyObject *TELLSTICK_BELL_GLUE = PyLong_FromLong((long) TELLSTICK_BELL);
PyObject_SetAttrString(module, "TELLSTICK_BELL", TELLSTICK_BELL_GLUE);
Py_DECREF(TELLSTICK_BELL_GLUE);
PyObject *TELLSTICK_TOGGLE_GLUE = PyLong_FromLong((long) TELLSTICK_TOGGLE);
PyObject_SetAttrString(module, "TELLSTICK_TOGGLE", TELLSTICK_TOGGLE_GLUE);
Py_DECREF(TELLSTICK_TOGGLE_GLUE);
PyObject *TELLSTICK_DIM_GLUE = PyLong_FromLong((long) TELLSTICK_DIM);
PyObject_SetAttrString(module, "TELLSTICK_DIM", TELLSTICK_DIM_GLUE);
Py_DECREF(TELLSTICK_DIM_GLUE);
PyObject *TELLSTICK_LEARN_GLUE = PyLong_FromLong((long) TELLSTICK_LEARN);
PyObject_SetAttrString(module, "TELLSTICK_LEARN", TELLSTICK_LEARN_GLUE);
Py_DECREF(TELLSTICK_LEARN_GLUE);
PyObject *TELLSTICK_SUCCESS_GLUE = PyLong_FromLong((long) TELLSTICK_SUCCESS);
PyObject_SetAttrString(module, "TELLSTICK_SUCCESS", TELLSTICK_SUCCESS_GLUE);
Py_DECREF(TELLSTICK_SUCCESS_GLUE);
PyObject *TELLSTICK_ERROR_NOT_FOUND_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_NOT_FOUND);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_NOT_FOUND", TELLSTICK_ERROR_NOT_FOUND_GLUE);
Py_DECREF(TELLSTICK_ERROR_NOT_FOUND_GLUE);
PyObject *TELLSTICK_ERROR_PERMISSION_DENIED_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_PERMISSION_DENIED);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_PERMISSION_DENIED", TELLSTICK_ERROR_PERMISSION_DENIED_GLUE);
Py_DECREF(TELLSTICK_ERROR_PERMISSION_DENIED_GLUE);
PyObject *TELLSTICK_ERROR_DEVICE_NOT_FOUND_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_DEVICE_NOT_FOUND);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_DEVICE_NOT_FOUND", TELLSTICK_ERROR_DEVICE_NOT_FOUND_GLUE);
Py_DECREF(TELLSTICK_ERROR_DEVICE_NOT_FOUND_GLUE);
PyObject *TELLSTICK_ERROR_METHOD_NOT_SUPPORTED_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_METHOD_NOT_SUPPORTED);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_METHOD_NOT_SUPPORTED", TELLSTICK_ERROR_METHOD_NOT_SUPPORTED_GLUE);
Py_DECREF(TELLSTICK_ERROR_METHOD_NOT_SUPPORTED_GLUE);
PyObject *TELLSTICK_ERROR_COMMUNICATION_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_COMMUNICATION);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_COMMUNICATION", TELLSTICK_ERROR_COMMUNICATION_GLUE);
Py_DECREF(TELLSTICK_ERROR_COMMUNICATION_GLUE);
PyObject *TELLSTICK_ERROR_UNKNOWN_GLUE = PyLong_FromLong((long) TELLSTICK_ERROR_UNKNOWN);
PyObject_SetAttrString(module, "TELLSTICK_ERROR_UNKNOWN", TELLSTICK_ERROR_UNKNOWN_GLUE);
Py_DECREF(TELLSTICK_ERROR_UNKNOWN_GLUE);
PyObject *TELLSTICK_TYPE_DEVICE_GLUE = PyLong_FromLong((long) TELLSTICK_TYPE_DEVICE);
PyObject_SetAttrString(module, "TELLSTICK_TYPE_DEVICE", TELLSTICK_TYPE_DEVICE_GLUE);
Py_DECREF(TELLSTICK_TYPE_DEVICE_GLUE);
PyObject *TELLSTICK_TYPE_GROUP_GLUE = PyLong_FromLong((long) TELLSTICK_TYPE_GROUP);
PyObject_SetAttrString(module, "TELLSTICK_TYPE_GROUP", TELLSTICK_TYPE_GROUP_GLUE);
Py_DECREF(TELLSTICK_TYPE_GROUP_GLUE);
}