Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cgbinder.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ cdef extern from "gbinder/gbinder_types.h":
ctypedef struct GBinderWriter:
pass

ctypedef enum GBINDER_STABILITY_LEVEL:
GBINDER_STABILITY_UNDECLARED = 0
GBINDER_STABILITY_VENDOR = 0x03
GBINDER_STABILITY_SYSTEM = 0x0c
GBINDER_STABILITY_VINTF = 0x3f

ctypedef GBinderLocalReply* (*GBinderLocalTransactFunc)(GBinderLocalObject* obj, GBinderRemoteRequest* req, unsigned int code, unsigned int flags, int* status, void* user_data)

from libc.stdint cimport int64_t, uint64_t
Expand Down Expand Up @@ -119,6 +125,7 @@ cdef extern from "gbinder/gbinder_local_object.h":

void gbinder_local_object_drop(GBinderLocalObject* obj)
GBinderLocalReply* gbinder_local_object_new_reply(GBinderLocalObject* obj)
void gbinder_local_object_set_stability(GBinderLocalObject* obj, GBINDER_STABILITY_LEVEL stability)

cdef extern from "gbinder/gbinder_local_reply.h":
GBinderLocalReply* gbinder_local_reply_ref(GBinderLocalReply* reply)
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 9),
python3-all-dev (>= 3.2),
python3-setuptools,
cython3,
libgbinder-dev (>= 1.1.20),
libgbinder-dev (>= 1.1.40),
libglibutil-dev,
libglib2.0-dev,
pkgconf,
Expand Down
10 changes: 10 additions & 0 deletions gbinder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ def ensure_binary(s):
return s.encode()
raise TypeError("not expecting type '%s'" % type(s))

# Stability levels for local objects (since libgbinder 1.1.40)
STABILITY_UNDECLARED = 0x00
STABILITY_VENDOR = 0x03
STABILITY_SYSTEM = 0x0c
STABILITY_VINTF = 0x3f

cdef class Bridge:
cdef cgbinder.GBinderBridge* _bridge

Expand Down Expand Up @@ -518,6 +524,10 @@ cdef class LocalObject:
reply.set_c_reply(c_reply)
return reply

def set_stability(self, stability):
if self._object is not NULL:
cgbinder.gbinder_local_object_set_stability(self._object, <cgbinder.GBINDER_STABILITY_LEVEL>stability)

cdef cgbinder.GBinderLocalReply* local_transact_callback(cgbinder.GBinderLocalObject* obj, cgbinder.GBinderRemoteRequest* c_req, unsigned int code, unsigned int flags, int* status, void* user_data) noexcept with gil:
req = RemoteRequest()
req.set_c_req(c_req)
Expand Down