Exporting an Interface

Florence Chan florencewchan at google.com
Thu Nov 11 22:01:50 UTC 2021


Hi,

Ah, I see, thanks for the explanation! However the command below still
returns FALSE for me unfortunately...
 g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton),
                                   connection,
                                   path,
                                   &error))
As mentioned before the skeleton is the MmGdbusSimEap* created by the
command mm_gdbus_sim_eap_skeleton_new () command. I have checked that
G_DBUS_INTERFACE_SKELETON
(skeleton) correctly returns a GDBusInterfaceSkeleton type as well.

Thanks,
- Florence


On Thu, Nov 11, 2021 at 1:31 PM Aleksander Morgado <aleksander at aleksander.es>
wrote:

> Hey,
>
> >
> >> Is that "self" in the g_object_get() the same as in the
> >> g_dbus_interface_skeleton_export()?
> >
> >
> > 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
> (skeleton));
>
> --
> Aleksander
> https://aleksander.es
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20211111/4e6fede4/attachment.htm>


More information about the ModemManager-devel mailing list