{
this->throw_if_noref();
- return ::std::string(::gpiod_chip_name(this->_m_chip.get()));
+ return ::std::string(::gpiod_chip_get_name(this->_m_chip.get()));
}
GPIOD_CXX_API ::std::string chip::label(void) const
{
this->throw_if_noref();
- return ::std::string(::gpiod_chip_label(this->_m_chip.get()));
+ return ::std::string(::gpiod_chip_get_label(this->_m_chip.get()));
}
GPIOD_CXX_API unsigned int chip::num_lines(void) const
{
this->throw_if_noref();
- return ::gpiod_chip_num_lines(this->_m_chip.get());
+ return ::gpiod_chip_get_num_lines(this->_m_chip.get());
}
GPIOD_CXX_API line chip::get_line(unsigned int offset) const
return NULL;
return PyUnicode_FromFormat("'%s /%s/ %u lines'",
- gpiod_chip_name(self->chip),
- gpiod_chip_label(self->chip),
- gpiod_chip_num_lines(self->chip));
+ gpiod_chip_get_name(self->chip),
+ gpiod_chip_get_label(self->chip),
+ gpiod_chip_get_num_lines(self->chip));
}
PyDoc_STRVAR(gpiod_Chip_close_doc,
if (gpiod_ChipIsClosed(self))
return NULL;
- return PyUnicode_FromFormat("%s", gpiod_chip_name(self->chip));
+ return PyUnicode_FromFormat("%s", gpiod_chip_get_name(self->chip));
}
PyDoc_STRVAR(gpiod_Chip_label_doc,
if (gpiod_ChipIsClosed(self))
return NULL;
- return PyUnicode_FromFormat("%s", gpiod_chip_label(self->chip));
+ return PyUnicode_FromFormat("%s", gpiod_chip_get_label(self->chip));
}
PyDoc_STRVAR(gpiod_Chip_num_lines_doc,
if (gpiod_ChipIsClosed(self))
return NULL;
- return Py_BuildValue("I", gpiod_chip_num_lines(self->chip));
+ return Py_BuildValue("I", gpiod_chip_get_num_lines(self->chip));
}
static gpiod_LineObject *
{
struct gpiod_line *line;
- if (self->offset == gpiod_chip_num_lines(self->owner->chip))
+ if (self->offset == gpiod_chip_get_num_lines(self->owner->chip))
return NULL; /* Last element. */
line = gpiod_chip_get_line(self->owner->chip, self->offset++);
* @param chip The GPIO chip object.
* @return Pointer to a human-readable string containing the chip name.
*/
-const char *gpiod_chip_name(struct gpiod_chip *chip);
+const char *gpiod_chip_get_name(struct gpiod_chip *chip);
/**
* @brief Get the GPIO chip label as represented in the kernel.
* @param chip The GPIO chip object.
* @return Pointer to a human-readable string containing the chip label.
*/
-const char *gpiod_chip_label(struct gpiod_chip *chip);
+const char *gpiod_chip_get_label(struct gpiod_chip *chip);
/**
* @brief Get the number of GPIO lines exposed by this chip.
* @param chip The GPIO chip object.
* @return Number of GPIO lines.
*/
-unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip);
+unsigned int gpiod_chip_get_num_lines(struct gpiod_chip *chip);
/**
* @brief Get the handle to the GPIO line at given offset.
free(chip);
}
-GPIOD_API const char *gpiod_chip_name(struct gpiod_chip *chip)
+GPIOD_API const char *gpiod_chip_get_name(struct gpiod_chip *chip)
{
return chip->name;
}
-GPIOD_API const char *gpiod_chip_label(struct gpiod_chip *chip)
+GPIOD_API const char *gpiod_chip_get_label(struct gpiod_chip *chip)
{
return chip->label;
}
-GPIOD_API unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip)
+GPIOD_API unsigned int gpiod_chip_get_num_lines(struct gpiod_chip *chip)
{
return chip->num_lines;
}
struct gpiod_line *line;
unsigned int offset;
- bulk = gpiod_line_bulk_new(gpiod_chip_num_lines(chip));
+ bulk = gpiod_line_bulk_new(gpiod_chip_get_num_lines(chip));
if (!bulk)
return NULL;
- for (offset = 0; offset < gpiod_chip_num_lines(chip); offset++) {
+ for (offset = 0; offset < gpiod_chip_get_num_lines(chip); offset++) {
line = gpiod_chip_get_line(chip, offset);
if (!line) {
gpiod_line_bulk_free(bulk);
struct gpiod_line *line;
const char *tmp;
- num_lines = gpiod_chip_num_lines(chip);
+ num_lines = gpiod_chip_get_num_lines(chip);
for (offset = 0; offset < num_lines; offset++) {
line = gpiod_chip_get_line(chip, offset);
g_assert_nonnull(chip2);
gpiod_test_return_if_failed();
- g_assert_cmpstr(gpiod_chip_name(chip0), ==, gpiod_test_chip_name(0));
- g_assert_cmpstr(gpiod_chip_name(chip1), ==, gpiod_test_chip_name(1));
- g_assert_cmpstr(gpiod_chip_name(chip2), ==, gpiod_test_chip_name(2));
+ g_assert_cmpstr(gpiod_chip_get_name(chip0), ==,
+ gpiod_test_chip_name(0));
+ g_assert_cmpstr(gpiod_chip_get_name(chip1), ==,
+ gpiod_test_chip_name(1));
+ g_assert_cmpstr(gpiod_chip_get_name(chip2), ==,
+ gpiod_test_chip_name(2));
}
GPIOD_TEST_CASE(get_label, 0, { 8, 8, 8})
g_assert_nonnull(chip2);
gpiod_test_return_if_failed();
- g_assert_cmpstr(gpiod_chip_label(chip0), ==, "gpio-mockup-A");
- g_assert_cmpstr(gpiod_chip_label(chip1), ==, "gpio-mockup-B");
- g_assert_cmpstr(gpiod_chip_label(chip2), ==, "gpio-mockup-C");
+ g_assert_cmpstr(gpiod_chip_get_label(chip0), ==, "gpio-mockup-A");
+ g_assert_cmpstr(gpiod_chip_get_label(chip1), ==, "gpio-mockup-B");
+ g_assert_cmpstr(gpiod_chip_get_label(chip2), ==, "gpio-mockup-C");
}
GPIOD_TEST_CASE(num_lines, 0, { 1, 4, 8, 16, 32 })
g_assert_nonnull(chip4);
gpiod_test_return_if_failed();
- g_assert_cmpuint(gpiod_chip_num_lines(chip0), ==, 1);
- g_assert_cmpuint(gpiod_chip_num_lines(chip1), ==, 4);
- g_assert_cmpuint(gpiod_chip_num_lines(chip2), ==, 8);
- g_assert_cmpuint(gpiod_chip_num_lines(chip3), ==, 16);
- g_assert_cmpuint(gpiod_chip_num_lines(chip4), ==, 32);
+ g_assert_cmpuint(gpiod_chip_get_num_lines(chip0), ==, 1);
+ g_assert_cmpuint(gpiod_chip_get_num_lines(chip1), ==, 4);
+ g_assert_cmpuint(gpiod_chip_get_num_lines(chip2), ==, 8);
+ g_assert_cmpuint(gpiod_chip_get_num_lines(chip3), ==, 16);
+ g_assert_cmpuint(gpiod_chip_get_num_lines(chip4), ==, 32);
}
GPIOD_TEST_CASE(get_line, 0, { 16 })
}
printf("%s [%s] (%u lines)\n",
- gpiod_chip_name(chip),
- gpiod_chip_label(chip),
- gpiod_chip_num_lines(chip));
+ gpiod_chip_get_name(chip),
+ gpiod_chip_get_label(chip),
+ gpiod_chip_get_num_lines(chip));
gpiod_chip_unref(chip);
free(entries[i]);
offset = gpiod_chip_find_line(chip, argv[0]);
if (offset >= 0) {
printf("%s %u\n",
- gpiod_chip_name(chip), offset);
+ gpiod_chip_get_name(chip), offset);
gpiod_chip_unref(chip);
return EXIT_SUCCESS;
}
int direction;
printf("%s - %u lines:\n",
- gpiod_chip_name(chip), gpiod_chip_num_lines(chip));
+ gpiod_chip_get_name(chip), gpiod_chip_get_num_lines(chip));
- for (offset = 0; offset < gpiod_chip_num_lines(chip); offset++) {
+ for (offset = 0; offset < gpiod_chip_get_num_lines(chip); offset++) {
line = gpiod_chip_get_line(chip, offset);
if (!line)
die_perror("unable to retrieve the line object from chip");