extern PyTypeObject BlockDeviceType;
-void BlockDevice_dealloc(BlockDevice* self);
-int BlockDevice_get_identity(BlockDevice* device);
-int BlockDevice_smart_is_available(BlockDevice* device);
-int BlockDevice_check_sleep_mode(BlockDevice* device);
-PyObject * BlockDevice_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
-int BlockDevice_init(BlockDevice* self, PyObject* args, PyObject* kwds);
-PyObject* BlockDevice_get_path(PyObject* self);
-PyObject* BlockDevice_get_model(PyObject* self);
-PyObject* BlockDevice_get_serial(PyObject* self);
-PyObject* BlockDevice_is_smart_supported(PyObject* self);
-PyObject* BlockDevice_is_awake(PyObject* self);
-PyObject* BlockDevice_get_bad_sectors(PyObject* self);
-PyObject* BlockDevice_get_temperature(PyObject* self);
-
/* ping */
extern PyObject* PyExc_PingError;
extern PyObject* PyExc_PingAddHostError;
extern PyTypeObject PingType;
-void Ping_dealloc(PingObject* self);
-void Ping_init_stats(PingObject* self);
-PyObject* Ping_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
-int Ping_init(PingObject* self, PyObject* args, PyObject* kwds);
-double Ping_compute_average(PingObject* self);
-double Ping_compute_stddev(PingObject* self, double mean);
-PyObject* Ping_ping(PingObject* self, PyObject* args, PyObject* kwds);
-PyObject* Ping_get_packets_sent(PingObject* self);
-PyObject* Ping_get_packets_rcvd(PingObject* self);
-PyObject* Ping_get_average(PingObject* self);
-PyObject* Ping_get_stddev(PingObject* self);
-PyObject* Ping_get_loss(PingObject* self);
-
/* sensors */
typedef struct {
PyObject_HEAD
extern PyTypeObject SensorType;
-void Sensor_dealloc(SensorObject* self);
-PyObject* Sensor_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
-int Sensor_init(SensorObject* self, PyObject* args, PyObject* kwds);
-PyObject* Sensor_get_label(SensorObject* self);
-PyObject* Sensor_get_name(SensorObject* self);
-PyObject* Sensor_get_type(SensorObject* self);
-PyObject* Sensor_get_bus(SensorObject* self);
-PyObject* Sensor_return_value(SensorObject* sensor, sensors_subfeature_type subfeature_type);
-PyObject* Sensor_get_value(SensorObject* self);
-PyObject* Sensor_get_critical(SensorObject* self);
-PyObject* Sensor_get_maximum(SensorObject* self);
-PyObject* Sensor_get_minimum(SensorObject* self);
-PyObject* Sensor_get_high(SensorObject* self);
-
PyObject* _collecty_sensors_init();
PyObject* _collecty_sensors_cleanup();
PyObject* _collecty_get_detected_sensors(PyObject* o, PyObject* args);
#include "_collectymodule.h"
-static PyGetSetDef BlockDevice_getsetters[] = {
- {"path", (getter)BlockDevice_get_path, NULL, NULL, NULL},
- {"model", (getter)BlockDevice_get_model, NULL, NULL, NULL},
- {"serial", (getter)BlockDevice_get_serial, NULL, NULL, NULL},
-};
-
-static PyMethodDef BlockDevice_methods[] = {
- {"get_bad_sectors", (PyCFunction)BlockDevice_get_bad_sectors, METH_NOARGS, NULL},
- {"get_temperature", (PyCFunction)BlockDevice_get_temperature, METH_NOARGS, NULL},
- {"is_smart_supported", (PyCFunction)BlockDevice_is_smart_supported, METH_NOARGS, NULL},
- {"is_awake", (PyCFunction)BlockDevice_is_awake, METH_NOARGS, NULL},
- {NULL}
-};
-
-PyTypeObject BlockDeviceType = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "_collecty.BlockDevice", /*tp_name*/
- sizeof(BlockDevice), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)BlockDevice_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "BlockDevice objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- BlockDevice_methods, /* tp_methods */
- 0, /* tp_members */
- BlockDevice_getsetters, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)BlockDevice_init, /* tp_init */
- 0, /* tp_alloc */
- BlockDevice_new, /* tp_new */
-};
-
-void BlockDevice_dealloc(BlockDevice* self) {
+static void BlockDevice_dealloc(BlockDevice* self) {
if (self->disk)
sk_disk_free(self->disk);
Py_TYPE(self)->tp_free((PyObject*)self);
}
-int BlockDevice_get_identity(BlockDevice* device) {
+static int BlockDevice_get_identity(BlockDevice* device) {
int fd;
if ((fd = open(device->path, O_RDONLY | O_NONBLOCK)) < 0) {
return 0;
}
-int BlockDevice_smart_is_available(BlockDevice* device) {
+static int BlockDevice_smart_is_available(BlockDevice* device) {
SkBool available = FALSE;
int r = sk_disk_smart_is_available(device->disk, &available);
return 1;
}
-int BlockDevice_check_sleep_mode(BlockDevice* device) {
+static int BlockDevice_check_sleep_mode(BlockDevice* device) {
SkBool awake = FALSE;
int r = sk_disk_check_sleep_mode(device->disk, &awake);
return 1;
}
-PyObject * BlockDevice_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
+static PyObject * BlockDevice_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
BlockDevice* self = (BlockDevice*)type->tp_alloc(type, 0);
if (self) {
return (PyObject *)self;
}
-int BlockDevice_init(BlockDevice* self, PyObject* args, PyObject* kwds) {
+static int BlockDevice_init(BlockDevice* self, PyObject* args, PyObject* kwds) {
const char* path = NULL;
if (!PyArg_ParseTuple(args, "s", &path))
return 0;
}
-PyObject* BlockDevice_get_path(PyObject* self) {
+static PyObject* BlockDevice_get_path(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
return PyUnicode_FromString(device->path);
drop_spaces(d);
}
-PyObject* BlockDevice_get_model(PyObject* self) {
+static PyObject* BlockDevice_get_model(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
char model[MODEL_SIZE + 1];
return PyUnicode_FromString(model);
}
-PyObject* BlockDevice_get_serial(PyObject* self) {
+static PyObject* BlockDevice_get_serial(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
char serial[SERIAL_SIZE + 1];
return PyUnicode_FromString(serial);
}
-PyObject* BlockDevice_is_smart_supported(PyObject* self) {
+static PyObject* BlockDevice_is_smart_supported(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
if (BlockDevice_smart_is_available(device) == 0)
Py_RETURN_FALSE;
}
-PyObject* BlockDevice_is_awake(PyObject* self) {
+static PyObject* BlockDevice_is_awake(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
if (BlockDevice_check_sleep_mode(device) == 0)
Py_RETURN_FALSE;
}
-PyObject* BlockDevice_get_bad_sectors(PyObject* self) {
+static PyObject* BlockDevice_get_bad_sectors(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
if (BlockDevice_smart_is_available(device)) {
return PyLong_FromUnsignedLongLong((unsigned long long)bad_sectors);
}
-PyObject* BlockDevice_get_temperature(PyObject* self) {
+static PyObject* BlockDevice_get_temperature(PyObject* self) {
BlockDevice* device = (BlockDevice*)self;
if (BlockDevice_smart_is_available(device)) {
// Convert the temperature to Kelvin
return PyFloat_FromDouble((double)mkelvin / 1000.0);
}
+
+static PyGetSetDef BlockDevice_getsetters[] = {
+ {"path", (getter)BlockDevice_get_path, NULL, NULL, NULL},
+ {"model", (getter)BlockDevice_get_model, NULL, NULL, NULL},
+ {"serial", (getter)BlockDevice_get_serial, NULL, NULL, NULL},
+ { NULL },
+};
+
+static PyMethodDef BlockDevice_methods[] = {
+ {"get_bad_sectors", (PyCFunction)BlockDevice_get_bad_sectors, METH_NOARGS, NULL},
+ {"get_temperature", (PyCFunction)BlockDevice_get_temperature, METH_NOARGS, NULL},
+ {"is_smart_supported", (PyCFunction)BlockDevice_is_smart_supported, METH_NOARGS, NULL},
+ {"is_awake", (PyCFunction)BlockDevice_is_awake, METH_NOARGS, NULL},
+ { NULL },
+};
+
+PyTypeObject BlockDeviceType = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "_collecty.BlockDevice", /*tp_name*/
+ sizeof(BlockDevice), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)BlockDevice_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "BlockDevice objects", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ BlockDevice_methods, /* tp_methods */
+ 0, /* tp_members */
+ BlockDevice_getsetters, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)BlockDevice_init, /* tp_init */
+ 0, /* tp_alloc */
+ BlockDevice_new, /* tp_new */
+};
#include "_collectymodule.h"
-static PyGetSetDef Ping_getsetters[] = {
- {"average", (getter)Ping_get_average, NULL, NULL, NULL},
- {"loss", (getter)Ping_get_loss, NULL, NULL, NULL},
- {"stddev", (getter)Ping_get_stddev, NULL, NULL, NULL},
- {"packets_sent", (getter)Ping_get_packets_sent, NULL, NULL, NULL},
- {"packets_rcvd", (getter)Ping_get_packets_rcvd, NULL, NULL, NULL},
- {NULL}
-};
-
-static PyMethodDef Ping_methods[] = {
- {"ping", (PyCFunction)Ping_ping, METH_VARARGS|METH_KEYWORDS, NULL},
- {NULL}
-};
-
-PyTypeObject PingType = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "_collecty.Ping", /*tp_name*/
- sizeof(PingObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)Ping_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "Ping object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- Ping_methods, /* tp_methods */
- 0, /* tp_members */
- Ping_getsetters, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)Ping_init, /* tp_init */
- 0, /* tp_alloc */
- Ping_new, /* tp_new */
-};
-
-void Ping_dealloc(PingObject* self) {
+static void Ping_dealloc(PingObject* self) {
if (self->ping)
ping_destroy(self->ping);
Py_TYPE(self)->tp_free((PyObject*)self);
}
-void Ping_init_stats(PingObject* self) {
+static void Ping_init_stats(PingObject* self) {
self->stats.history_index = 0;
self->stats.history_size = 0;
self->stats.packets_sent = 0;
self->stats.loss = 0.0;
}
-PyObject* Ping_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
+static PyObject* Ping_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
PingObject* self = (PingObject*)type->tp_alloc(type, 0);
if (self) {
return (PyObject*)self;
}
-int Ping_init(PingObject* self, PyObject* args, PyObject* kwds) {
+static int Ping_init(PingObject* self, PyObject* args, PyObject* kwds) {
char* kwlist[] = {"host", "family", "timeout", "ttl", NULL};
int family = PING_DEF_AF;
double timeout = PING_DEFAULT_TIMEOUT;
return 0;
}
-double Ping_compute_average(PingObject* self) {
+static double Ping_compute_average(PingObject* self) {
assert(self->stats.packets_rcvd > 0);
double total_latency = 0.0;
return total_latency / self->stats.packets_rcvd;
}
-double Ping_compute_stddev(PingObject* self, double mean) {
+static double Ping_compute_stddev(PingObject* self, double mean) {
assert(self->stats.packets_rcvd > 0);
double deviation = 0.0;
return r;
}
-PyObject* Ping_ping(PingObject* self, PyObject* args, PyObject* kwds) {
+static PyObject* Ping_ping(PingObject* self, PyObject* args, PyObject* kwds) {
char* kwlist[] = {"count", "deadline", NULL};
size_t count = PING_DEFAULT_COUNT;
double deadline = 0;
Py_RETURN_NONE;
}
-PyObject* Ping_get_packets_sent(PingObject* self) {
+static PyObject* Ping_get_packets_sent(PingObject* self) {
return PyLong_FromUnsignedLong(self->stats.packets_sent);
}
-PyObject* Ping_get_packets_rcvd(PingObject* self) {
+static PyObject* Ping_get_packets_rcvd(PingObject* self) {
return PyLong_FromUnsignedLong(self->stats.packets_rcvd);
}
-PyObject* Ping_get_average(PingObject* self) {
+static PyObject* Ping_get_average(PingObject* self) {
return PyFloat_FromDouble(self->stats.average);
}
-PyObject* Ping_get_stddev(PingObject* self) {
+static PyObject* Ping_get_stddev(PingObject* self) {
return PyFloat_FromDouble(self->stats.stddev);
}
-PyObject* Ping_get_loss(PingObject* self) {
+static PyObject* Ping_get_loss(PingObject* self) {
return PyFloat_FromDouble(self->stats.loss);
}
+
+static PyGetSetDef Ping_getsetters[] = {
+ {"average", (getter)Ping_get_average, NULL, NULL, NULL},
+ {"loss", (getter)Ping_get_loss, NULL, NULL, NULL},
+ {"stddev", (getter)Ping_get_stddev, NULL, NULL, NULL},
+ {"packets_sent", (getter)Ping_get_packets_sent, NULL, NULL, NULL},
+ {"packets_rcvd", (getter)Ping_get_packets_rcvd, NULL, NULL, NULL},
+ { NULL },
+};
+
+static PyMethodDef Ping_methods[] = {
+ {"ping", (PyCFunction)Ping_ping, METH_VARARGS|METH_KEYWORDS, NULL},
+ { NULL },
+};
+
+PyTypeObject PingType = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "_collecty.Ping", /*tp_name*/
+ sizeof(PingObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)Ping_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "Ping object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ Ping_methods, /* tp_methods */
+ 0, /* tp_members */
+ Ping_getsetters, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)Ping_init, /* tp_init */
+ 0, /* tp_alloc */
+ Ping_new, /* tp_new */
+};
#include "_collectymodule.h"
-static PyGetSetDef Sensor_getsetters[] = {
- {"bus", (getter)Sensor_get_bus, NULL, NULL, NULL},
- {"critical", (getter)Sensor_get_critical, NULL, NULL, NULL},
- {"high", (getter)Sensor_get_high, NULL, NULL, NULL},
- {"label", (getter)Sensor_get_label, NULL, NULL, NULL},
- {"maximum", (getter)Sensor_get_maximum, NULL, NULL, NULL},
- {"minumum", (getter)Sensor_get_minimum, NULL, NULL, NULL},
- {"name", (getter)Sensor_get_name, NULL, NULL, NULL},
- {"type", (getter)Sensor_get_type, NULL, NULL, NULL},
- {"value", (getter)Sensor_get_value, NULL, NULL, NULL},
- {NULL},
-};
-
-PyTypeObject SensorType = {
- PyObject_HEAD_INIT(NULL)
- "_collecty.Sensor", /*tp_name*/
- sizeof(SensorObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- (destructor)Sensor_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "Sensor objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- Sensor_getsetters, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)Sensor_init, /* tp_init */
- 0, /* tp_alloc */
- Sensor_new, /* tp_new */
-};
-
-void Sensor_dealloc(SensorObject* self) {
+static void Sensor_dealloc(SensorObject* self) {
Py_TYPE(self)->tp_free((PyObject*)self);
}
-PyObject* Sensor_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
+static PyObject* Sensor_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
SensorObject* self = (SensorObject*)type->tp_alloc(type, 0);
return (PyObject *)self;
}
-int Sensor_init(SensorObject* self, PyObject* args, PyObject* kwds) {
+static int Sensor_init(SensorObject* self, PyObject* args, PyObject* kwds) {
return 0;
}
-PyObject* Sensor_get_label(SensorObject* self) {
+static PyObject* Sensor_get_label(SensorObject* self) {
char* label = sensors_get_label(self->chip, self->feature);
if (label) {
Py_RETURN_NONE;
}
-PyObject* Sensor_get_name(SensorObject* self) {
+static PyObject* Sensor_get_name(SensorObject* self) {
char chip_name[512];
int r = sensors_snprintf_chip_name(chip_name, sizeof(chip_name), self->chip);
return PyUnicode_FromString(chip_name);
}
-PyObject* Sensor_get_type(SensorObject* self) {
+static PyObject* Sensor_get_type(SensorObject* self) {
const char* type = NULL;
switch (self->feature->type) {
Py_RETURN_NONE;
}
-PyObject* Sensor_get_bus(SensorObject* self) {
+static PyObject* Sensor_get_bus(SensorObject* self) {
const char* type = NULL;
switch (self->chip->bus.type) {
return subfeature;
}
-PyObject* Sensor_return_value(SensorObject* sensor, sensors_subfeature_type subfeature_type) {
+static PyObject* Sensor_return_value(SensorObject* sensor, sensors_subfeature_type subfeature_type) {
double value;
const sensors_subfeature* subfeature = Sensor_get_subfeature(sensor, subfeature_type);
return NULL;
}
-PyObject* Sensor_get_value(SensorObject* self) {
+static PyObject* Sensor_get_value(SensorObject* self) {
sensors_subfeature_type subfeature_type;
switch (self->feature->type) {
return Sensor_return_value(self, subfeature_type);
}
-PyObject* Sensor_get_critical(SensorObject* self) {
+static PyObject* Sensor_get_critical(SensorObject* self) {
sensors_subfeature_type subfeature_type;
switch (self->feature->type) {
return Sensor_return_value(self, subfeature_type);
}
-PyObject* Sensor_get_maximum(SensorObject* self) {
+static PyObject* Sensor_get_maximum(SensorObject* self) {
sensors_subfeature_type subfeature_type;
switch (self->feature->type) {
return Sensor_return_value(self, subfeature_type);
}
-PyObject* Sensor_get_minimum(SensorObject* self) {
+static PyObject* Sensor_get_minimum(SensorObject* self) {
sensors_subfeature_type subfeature_type;
switch (self->feature->type) {
return Sensor_return_value(self, subfeature_type);
}
-PyObject* Sensor_get_high(SensorObject* self) {
+static PyObject* Sensor_get_high(SensorObject* self) {
sensors_subfeature_type subfeature_type;
switch (self->feature->type) {
return list;
}
+
+static PyGetSetDef Sensor_getsetters[] = {
+ {"bus", (getter)Sensor_get_bus, NULL, NULL, NULL},
+ {"critical", (getter)Sensor_get_critical, NULL, NULL, NULL},
+ {"high", (getter)Sensor_get_high, NULL, NULL, NULL},
+ {"label", (getter)Sensor_get_label, NULL, NULL, NULL},
+ {"maximum", (getter)Sensor_get_maximum, NULL, NULL, NULL},
+ {"minumum", (getter)Sensor_get_minimum, NULL, NULL, NULL},
+ {"name", (getter)Sensor_get_name, NULL, NULL, NULL},
+ {"type", (getter)Sensor_get_type, NULL, NULL, NULL},
+ {"value", (getter)Sensor_get_value, NULL, NULL, NULL},
+ { NULL },
+};
+
+PyTypeObject SensorType = {
+ PyObject_HEAD_INIT(NULL)
+ "_collecty.Sensor", /*tp_name*/
+ sizeof(SensorObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ (destructor)Sensor_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "Sensor objects", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ Sensor_getsetters, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)Sensor_init, /* tp_init */
+ 0, /* tp_alloc */
+ Sensor_new, /* tp_new */
+};