Exporting an Interface
aleksander at aleksander.es
Thu Nov 11 21:31:04 UTC 2021
>> Is that "self" in the g_object_get() the same as in the
> Yes, self refers to a a MMIfaceSimEap *. I have a MMsameGdbusSimEap* created by the command mm_gdbus_sim_eap_skeleton_new (). However is that not different from the GDBusInterfaceSkeleton* that is required? What do you mean that the self cannot be the same/why can't it?
MMBaseSim inherits from MMGdbusSimSkeleton (so it provides the generic
SIM interface), and that same object also implements your new
MMIfaceSimEap interface. All those 3 things are the same object; the
same "self" pointer can be casted as MM_BASE_SIM(),
MM_GDBUS_SIM_SKELETON() and MM_IFACE_SIM_EAP().
Inside the MMIfaceSimEap implementation you're creating a new skeleton
for the new interface with mm_gdbus_sim_eap_skeleton_new(). This
skeleton object is an object different to "self", they are 2 different
objects completely. You're then storing this skeleton as a property
that is defined by the interface (which is why you override it in the
base sim object, that is fine) and so at the end you're storing the
new skeleton object in self->priv (totally fine).
But then you're calling g_dbus_interface_skeleton_export
(G_DBUS_INTERFACE_SKELETON (self)) there; so you're attempting to
export again the same interface skeleton as the generic MMBaseSim
object does (MMGdbusSimSkeleton). What you need to export instead is
the new skeleton you just created (variable "skeleton", not "self"),
as this: g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON
More information about the ModemManager-devel