Skip to content

Commit

Permalink
Added SdBus.emit_object_added
Browse files Browse the repository at this point in the history
  • Loading branch information
igo95862 committed Feb 22, 2021
1 parent bede440 commit 1e01338
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/sdbus/sd_bus_internals.c
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,24 @@ SdBus_add_object_manager(SdBusObject *self,
return new_slot_object;
}

static PyObject *
SdBus_emit_object_added(SdBusObject *self,
PyObject *const *args,
Py_ssize_t nargs)
{
SD_BUS_PY_CHECK_ARGS_NUMBER(1);
SD_BUS_PY_CHECK_ARG_TYPE(0, PyUnicode_Type);

const char *added_object_path = SD_BUS_PY_UNICODE_AS_CHAR_PTR(args[0]);

CALL_SD_BUS_AND_CHECK(
sd_bus_emit_object_added(
self->sd_bus_ref,
added_object_path));

Py_RETURN_NONE;
}

static PyMethodDef SdBus_methods[] = {
{"call", (void *)SdBus_call, METH_FASTCALL, "Send message and get reply"},
{"call_async", (void *)SdBus_call_async, METH_FASTCALL, "Async send message, returns awaitable future"},
Expand All @@ -2351,6 +2369,7 @@ static PyMethodDef SdBus_methods[] = {
{"request_name_async", (void *)SdBus_request_name_async, METH_FASTCALL, "Request dbus name async"},
{"request_name", (void *)SdBus_request_name, METH_FASTCALL, "Request dbus name blocking"},
{"add_object_manager", (void *)SdBus_add_object_manager, METH_FASTCALL, "Add object manager at the path"},
{"emit_object_added", (void *)SdBus_emit_object_added, METH_FASTCALL, "Emit signal that object was added"},
{NULL, NULL, 0, NULL},
};

Expand Down
5 changes: 4 additions & 1 deletion src/sdbus/sd_bus_internals.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ class SdBus:
def request_name(self, name: str, flags: int, /) -> None:
...

def add_object_manager(self, path: str) -> SdBusSlot:
def add_object_manager(self, path: str, /) -> SdBusSlot:
...

def emit_object_added(self, path: str, /) -> None:
...


Expand Down

0 comments on commit 1e01338

Please sign in to comment.