Re: NetworkTimeChanged signal doesn't seems to be working for Quectel

2023-05-05 Thread Toto Titi
Hey Aleksander,

They have similar data but not in the same order for example +CTZE URC is
,,, so like this "+32",0,"2018/03/23,06:51:13" but for CTZU
it's like this ,,  "+32","2018/03/23,06:51:13",0 and for
Cinterion the dst is optional

Thanks for the advice to get the signal, you are right I should use
libmm-glib shipped with ModemManager. I changed to this

GList *l = NULL;
int ret = 0;
GList *modem_list = g_dbus_object_manager_get_objects(G_DBUS_OBJECT_MANAGER(
manager));

for (l = modem_list; l; l = g_list_next(l))
{
MMObject *obj;
MMModemTime *modem_time;
obj = MM_OBJECT(l->data);
modem_time = MM_MODEM_TIME(mm_object_peek_modem_time(obj));
if (ret = g_signal_connect(modem_time, NETWORK_TIME_CHANGED_DBUS_SIGNAL,
G_CALLBACK(update_local_modem_time), NULL) <= 0)
{
DBG_PRINT("Failed to connect signal %s to modem %d\n", "network-time-changed
", ret);
}
}

Best regards,

Le mer. 3 mai 2023 à 15:12, Aleksander Morgado 
a écrit :

> Hey Thomas,
>
> > I do get the +CTZU notification, but it worked differently for quectel
> because it doesn't receive the new time we need to check for +CTZE that's
> the URC that we get when we receive notification that the time has been
> changed.
>
> What is the format of the +CTZE URC? is it similar to +CTZU? how are
> they different?
>
> > For my use case, I would like to update my local time automatically on a
> linux environment using modemmanager with quectel modules.
> > So right now I manage to change cinterion's function to process +CTZE
> events and I receive the signal like this
> > GDBusProxy *proxy = g_dbus_proxy_new_sync(connection,
> > G_DBUS_PROXY_FLAGS_NONE,
> > NULL,
> > "org.freedesktop.ModemManager1",
> > modemPath,
> > "org.freedesktop.ModemManager1.Modem.Time",
> > NULL,
> > );
> > if (error != NULL) {
> > g_printerr("Error creating ModemManager1.Modem proxy: %s\n",
> error->message);
> > g_error_free(error);
> > return 1;
> > }
> >
> > g_signal_connect(proxy, "g-properties-changed",
> G_CALLBACK(update_local_time), NULL);
> > }
> > But I'm not sure it's the best way to process the signal
>
> Wondering, why not use the libmm-glib  we ship with ModemManager
> instead of manually creating the proxies and parsing the list of
> updated properties?
> E.g. you could:
>  * create a new MMManager with mm_manager_new()
>  * list the MMObjects it handles with g_dbus_object_manager_get_objects()
>  * get a MMModemTime interface object with mm_object_get_modem_time()
>  * listen to the "network-time-changed" signal
>
> --
> Aleksander
>


Re: NetworkTimeChanged signal doesn't seems to be working for Quectel

2023-05-03 Thread Aleksander Morgado
Hey Thomas,

> I do get the +CTZU notification, but it worked differently for quectel 
> because it doesn't receive the new time we need to check for +CTZE that's the 
> URC that we get when we receive notification that the time has been changed.

What is the format of the +CTZE URC? is it similar to +CTZU? how are
they different?

> For my use case, I would like to update my local time automatically on a 
> linux environment using modemmanager with quectel modules.
> So right now I manage to change cinterion's function to process +CTZE events 
> and I receive the signal like this
> GDBusProxy *proxy = g_dbus_proxy_new_sync(connection,
> G_DBUS_PROXY_FLAGS_NONE,
> NULL,
> "org.freedesktop.ModemManager1",
> modemPath,
> "org.freedesktop.ModemManager1.Modem.Time",
> NULL,
> );
> if (error != NULL) {
> g_printerr("Error creating ModemManager1.Modem proxy: %s\n", error->message);
> g_error_free(error);
> return 1;
> }
>
> g_signal_connect(proxy, "g-properties-changed", 
> G_CALLBACK(update_local_time), NULL);
> }
> But I'm not sure it's the best way to process the signal

Wondering, why not use the libmm-glib  we ship with ModemManager
instead of manually creating the proxies and parsing the list of
updated properties?
E.g. you could:
 * create a new MMManager with mm_manager_new()
 * list the MMObjects it handles with g_dbus_object_manager_get_objects()
 * get a MMModemTime interface object with mm_object_get_modem_time()
 * listen to the "network-time-changed" signal

-- 
Aleksander


Re: NetworkTimeChanged signal doesn't seems to be working for Quectel

2023-04-24 Thread Toto Titi
Hey Aleksander,
I do get the +CTZU notification, but it worked differently for quectel
because it doesn't receive the new time we need to check for +CTZE that's
the URC that we get when we receive notification that the time has been
changed.
For my use case, I would like to update my local time automatically on a
linux environment using modemmanager with quectel modules.
So right now I manage to change cinterion's function to process +CTZE
events and I receive the signal like this
GDBusProxy *proxy = g_dbus_proxy_new_sync(connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.ModemManager1",
modemPath,
"org.freedesktop.ModemManager1.Modem.Time",
NULL,
);
if (error != NULL) {
g_printerr("Error creating ModemManager1.Modem proxy: %s\n", error->message
);
g_error_free(error);
return 1;
}

g_signal_connect(proxy, "g-properties-changed", G_CALLBACK(update_local_time
), NULL);
}
But I'm not sure it's the best way to process the signal

Thomas,

Le lun. 24 avr. 2023 à 12:43, Aleksander Morgado 
a écrit :

> Hey,
>
> >
> > I am trying to get notification from Quectel when there is a time
> change, I see that there is a signal NetworkTimeChanged for this but when I
> looked at the code, I see that the signal is not being emitted for Quectel
> modules.
> >
>
> True; we're not emitting those for all modem types. Do you get +CTZU
> notifications in your modem? Right now I think we're processing these
> only for cinterion modules.
>
> Also, what is your usecase? I assume you're interested on the timezone
> information exclusively, right?
>
> --
> Aleksander
>


Re: NetworkTimeChanged signal doesn't seems to be working for Quectel

2023-04-24 Thread Aleksander Morgado
Hey,

>
> I am trying to get notification from Quectel when there is a time change, I 
> see that there is a signal NetworkTimeChanged for this but when I looked at 
> the code, I see that the signal is not being emitted for Quectel modules.
>

True; we're not emitting those for all modem types. Do you get +CTZU
notifications in your modem? Right now I think we're processing these
only for cinterion modules.

Also, what is your usecase? I assume you're interested on the timezone
information exclusively, right?

-- 
Aleksander


NetworkTimeChanged signal doesn't seems to be working for Quectel

2023-04-18 Thread Toto Titi
Hello,

I am trying to get notification from Quectel when there is a time change, I
see that there is a signal NetworkTimeChanged for this but when I looked at
the code, I see that the signal is not being emitted for Quectel modules.

Best regards,