removed stray spaces
This commit is contained in:
parent
384c81d85a
commit
6496e71026
1 changed files with 98 additions and 105 deletions
|
@ -347,11 +347,8 @@ telldus_deviceEventCallback(int deviceId, int method, const char *data, int call
|
||||||
|
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
|
||||||
// prepare the arg list to pass into the Python callback function
|
|
||||||
arglist = Py_BuildValue("llsl", deviceId, method, data, callbackId);
|
|
||||||
|
|
||||||
// now call the Python callback function
|
// now call the Python callback function
|
||||||
result = PyEval_CallObject(pyfunc, arglist);
|
result = PyObject_CallFunction(pyfunc, "llsl", deviceId, method, data, callbackId);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
// something went wrong so print to stderr
|
// something went wrong so print to stderr
|
||||||
|
@ -359,7 +356,6 @@ telldus_deviceEventCallback(int deviceId, int method, const char *data, int call
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of reference handling
|
// take care of reference handling
|
||||||
Py_DECREF(arglist);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
|
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
@ -370,17 +366,13 @@ telldus_deviceEventCallback(int deviceId, int method, const char *data, int call
|
||||||
void
|
void
|
||||||
telldus_deviceChangeEventCallback(int deviceId, int changeEvent, int changeType, int callbackId, void *pyfunc)
|
telldus_deviceChangeEventCallback(int deviceId, int changeEvent, int changeType, int callbackId, void *pyfunc)
|
||||||
{
|
{
|
||||||
PyObject * arglist;
|
|
||||||
PyObject * result;
|
PyObject * result;
|
||||||
PyGILState_STATE gstate;
|
PyGILState_STATE gstate;
|
||||||
|
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
|
||||||
// prepare the arg list to pass into the Python callback function
|
|
||||||
arglist = Py_BuildValue("llll", deviceId, changeEvent, changeType, callbackId);
|
|
||||||
|
|
||||||
// now call the Python callback function
|
// now call the Python callback function
|
||||||
result = PyEval_CallObject(pyfunc, arglist);
|
result = PyObject_CallFunction(pyfunc, "llll", deviceId, changeEvent, changeType, callbackId);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
// something went wrong so print to stderr
|
// something went wrong so print to stderr
|
||||||
|
@ -388,7 +380,6 @@ telldus_deviceChangeEventCallback(int deviceId, int changeEvent, int changeType,
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of reference handling
|
// take care of reference handling
|
||||||
Py_DECREF(arglist);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
|
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
@ -399,17 +390,13 @@ telldus_deviceChangeEventCallback(int deviceId, int changeEvent, int changeType,
|
||||||
void
|
void
|
||||||
telldus_rawDeviceEventCallback(const char *data, int controllerId, int callbackId, void *pyfunc)
|
telldus_rawDeviceEventCallback(const char *data, int controllerId, int callbackId, void *pyfunc)
|
||||||
{
|
{
|
||||||
PyObject * arglist;
|
|
||||||
PyObject * result;
|
PyObject * result;
|
||||||
PyGILState_STATE gstate;
|
PyGILState_STATE gstate;
|
||||||
|
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
|
||||||
// prepare the arg list to pass into the Python callback function
|
|
||||||
arglist = Py_BuildValue("sll", data, controllerId, callbackId);
|
|
||||||
|
|
||||||
// now call the Python callback function
|
// now call the Python callback function
|
||||||
result = PyEval_CallObject(pyfunc, arglist);
|
result = PyObject_CallFunction(pyfunc, "sll", data, controllerId, callbackId);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
// something went wrong so print to stderr
|
// something went wrong so print to stderr
|
||||||
|
@ -417,7 +404,6 @@ telldus_rawDeviceEventCallback(const char *data, int controllerId, int callbackI
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of reference handling
|
// take care of reference handling
|
||||||
Py_DECREF(arglist);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
|
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
@ -428,17 +414,13 @@ telldus_rawDeviceEventCallback(const char *data, int controllerId, int callbackI
|
||||||
void
|
void
|
||||||
telldus_sensorEventCallback(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *pyfunc)
|
telldus_sensorEventCallback(const char *protocol, const char *model, int id, int dataType, const char *value, int timestamp, int callbackId, void *pyfunc)
|
||||||
{
|
{
|
||||||
PyObject * arglist;
|
|
||||||
PyObject * result;
|
PyObject * result;
|
||||||
PyGILState_STATE gstate;
|
PyGILState_STATE gstate;
|
||||||
|
|
||||||
gstate = PyGILState_Ensure();
|
gstate = PyGILState_Ensure();
|
||||||
|
|
||||||
// prepare the arg list to pass into the Python callback function
|
|
||||||
arglist = Py_BuildValue("ssllsll", protocol, model, id, dataType, value, timestamp, callbackId);
|
|
||||||
|
|
||||||
// now call the Python callback function
|
// now call the Python callback function
|
||||||
result = PyEval_CallObject(pyfunc, arglist);
|
result = PyObject_CallFunction(pyfunc, "ssllsll", protocol, model, id, dataType, value, timestamp, callbackId);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
// something went wrong so print to stderr
|
// something went wrong so print to stderr
|
||||||
|
@ -446,7 +428,6 @@ telldus_sensorEventCallback(const char *protocol, const char *model, int id, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// take care of reference handling
|
// take care of reference handling
|
||||||
Py_DECREF(arglist);
|
|
||||||
Py_XDECREF(result);
|
Py_XDECREF(result);
|
||||||
|
|
||||||
PyGILState_Release(gstate);
|
PyGILState_Release(gstate);
|
||||||
|
@ -462,6 +443,9 @@ telldus_tdRegisterDeviceEvent(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "O", &func));
|
if (!PyArg_ParseTuple(args, "O", &func));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// stick around till we need you
|
||||||
|
Py_INCREF(func);
|
||||||
|
|
||||||
return PyLong_FromLong((long) tdRegisterDeviceEvent((TDDeviceEvent) telldus_deviceEventCallback, &func));
|
return PyLong_FromLong((long) tdRegisterDeviceEvent((TDDeviceEvent) telldus_deviceEventCallback, &func));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,6 +457,9 @@ telldus_tdRegisterDeviceChangeEvent(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "O", &func));
|
if (!PyArg_ParseTuple(args, "O", &func));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// stick around till we need you
|
||||||
|
Py_INCREF(func);
|
||||||
|
|
||||||
return PyLong_FromLong((long) tdRegisterDeviceChangeEvent((TDDeviceChangeEvent) telldus_deviceChangeEventCallback, &func));
|
return PyLong_FromLong((long) tdRegisterDeviceChangeEvent((TDDeviceChangeEvent) telldus_deviceChangeEventCallback, &func));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +471,9 @@ telldus_tdRegisterRawDeviceEvent(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "O", &func));
|
if (!PyArg_ParseTuple(args, "O", &func));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// stick around till we need you
|
||||||
|
Py_INCREF(func);
|
||||||
|
|
||||||
return PyLong_FromLong((long) tdRegisterRawDeviceEvent((TDRawDeviceEvent) telldus_rawDeviceEventCallback, &func));
|
return PyLong_FromLong((long) tdRegisterRawDeviceEvent((TDRawDeviceEvent) telldus_rawDeviceEventCallback, &func));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,6 +485,9 @@ telldus_tdRegisterSensorEvent(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "O", &func));
|
if (!PyArg_ParseTuple(args, "O", &func));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// stick around till we need you
|
||||||
|
Py_INCREF(func);
|
||||||
|
|
||||||
return PyLong_FromLong((long) tdRegisterSensorEvent((TDSensorEvent) telldus_sensorEventCallback, &func));
|
return PyLong_FromLong((long) tdRegisterSensorEvent((TDSensorEvent) telldus_sensorEventCallback, &func));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue