<div dir="ltr"><div>Hey Aleksander, <br></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)"><span style=""><span style="font-family:arial,sans-serif"><font size="2">They have similar data but not in the same order for example +CTZE URC is<span style=""> <tz>,<dst>,<time>, so like this</span><span style=""> "+32",0,"2018/03/23,06:51:13" but for CTZU it's like this <span style=""><span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><span><span><span><span><span class="gmail-markedContent"><span style="left: 239.761px; top: 1054.37px;" role="presentation" dir="ltr"></span><span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><tz>,<time>,</span></font></span></span></span></span></span></span></span></span></span></font></span></span></span><span style=""><span style=""><span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><span><span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><span><span><span><span><span class="gmail-markedContent"><span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><dst> </span></font></span></span></span></span></span></span></span></span></span></font></span></span></span></span></span></font></span></span></span> <span style="">"+32","2018/03/23,06:51:13"<span style="color:rgb(0,0,0)"><span><span style="font-family:arial,sans-serif"><font size="2"><span><span><span><span><span>,0 and for Cinterion the dst is optional</span></span></span></span></span></font></span></span></span> <br></span></span></span></span></span></font></span></span></span></div><div><span style="color:rgb(0,0,0)"><span style=""><span style="font-family:arial,sans-serif"><font size="2"><span style=""><span style=""><span style=""><span style=""><span style=""><span class="gmail-markedContent"><span style="left: 359.801px; top: 1054.37px; transform: scaleX(1.00027);" role="presentation" dir="ltr"><br></span></span></span></span></span></span></span></font></span></span></span></div><div><span style="color:rgb(0,0,0)"><span style=""><span style="font-family:arial,sans-serif"><font size="2"><span style=""><span style=""><span style=""><span style=""><span style=""><span class="gmail-markedContent"><span style="left: 359.801px; top: 1054.37px; transform: scaleX(1.00027);" role="presentation" dir="ltr">Thanks for the advice to get the signal, you are right I should use libmm-glib shipped with ModemManager. I changed to this<br><br></span></span></span></span></span></span></span></font></span></span></span><div style="color:rgb(187,187,187);background-color:rgb(40,44,52);font-family:"Fira Code","Droid Sans Mono","monospace",monospace,"Droid Sans Fallback","Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(97,175,239)">GList</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">*</span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">NULL</span><span style="color:rgb(187,187,187)">;</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(86,182,194)">int</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(171,178,191)">ret</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(198,120,221)">0</span><span style="color:rgb(187,187,187)">;</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(97,175,239)">GList</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">*</span><span style="color:rgb(171,178,191)">modem_list</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">g_dbus_object_manager_get_objects</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(152,195,121)">G_DBUS_OBJECT_MANAGER</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(97,175,239)">manager</span><span style="color:rgb(187,187,187)">));</span></div><br><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">for</span><span style="color:rgb(187,187,187)"> (</span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(171,178,191)">modem_list</span><span style="color:rgb(187,187,187)">; </span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(187,187,187)">; </span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">g_list_next</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(187,187,187)">))</span></div><div><span style="color:rgb(187,187,187)"> {</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(97,175,239)">MMObject</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">*</span><span style="color:rgb(171,178,191)">obj</span><span style="color:rgb(187,187,187)">;</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(97,175,239)">MMModemTime</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">*</span><span style="color:rgb(171,178,191)">modem_time</span><span style="color:rgb(187,187,187)">;</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(171,178,191)">obj</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">MM_OBJECT</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(171,178,191)">l</span><span style="color:rgb(171,178,191)">-></span><span style="color:rgb(171,178,191)">data</span><span style="color:rgb(187,187,187)">);</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(171,178,191)">modem_time</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">MM_MODEM_TIME</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(152,195,121)">mm_object_peek_modem_time</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(171,178,191)">obj</span><span style="color:rgb(187,187,187)">));</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">if</span><span style="color:rgb(187,187,187)"> (</span><span style="color:rgb(171,178,191)">ret</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(224,108,117)">=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">g_signal_connect</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(171,178,191)">modem_time</span><span style="color:rgb(171,178,191)">,</span><span style="color:rgb(187,187,187)"> NETWORK_TIME_CHANGED_DBUS_SIGNAL</span><span style="color:rgb(171,178,191)">,</span><span style="color:rgb(187,187,187)"> </span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">G_CALLBACK</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(152,195,121)">update_local_modem_time</span><span style="color:rgb(187,187,187)">)</span><span style="color:rgb(171,178,191)">,</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">NULL</span><span style="color:rgb(187,187,187)">) </span><span style="color:rgb(224,108,117)"><=</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(198,120,221)">0</span><span style="color:rgb(187,187,187)">)</span></div><div><span style="color:rgb(187,187,187)"> {</span></div><div><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(152,195,121)">DBG_PRINT</span><span style="color:rgb(187,187,187)">(</span><span style="color:rgb(229,192,123)">"Failed to connect signal </span><span style="color:rgb(86,182,194)">%s</span><span style="color:rgb(229,192,123)"> to modem </span><span style="color:rgb(86,182,194)">%d\n</span><span style="color:rgb(229,192,123)">"</span><span style="color:rgb(171,178,191)">,</span><span style="color:rgb(187,187,187)"> "network-time-changed</span><span style="color:rgb(171,178,191)">",</span><span style="color:rgb(187,187,187)"> </span><span style="color:rgb(171,178,191)">ret</span><span style="color:rgb(187,187,187)">);</span></div><div><span style="color:rgb(187,187,187)"> }</span></div><div><span style="color:rgb(187,187,187)"> }</span></div></div></div><div><span style="color:rgb(0,0,0)"><span style=""><span style="font-family:arial,sans-serif"><font size="2"><span style=""><span style=""><span style=""><span style=""><span style=""><span class="gmail-markedContent"><span style="left: 359.801px; top: 1054.37px; transform: scaleX(1.00027);" role="presentation" dir="ltr"><br></span></span></span></span></span></span></span></font></span></span></span></div><div><span style="color:rgb(0,0,0)"><span style=""><span style="font-family:arial,sans-serif"><font size="2"><span style=""><span style=""><span style=""><span style=""><span style=""><span class="gmail-markedContent"><span style="left: 359.801px; top: 1054.37px; transform: scaleX(1.00027);" role="presentation" dir="ltr">Best regards,<br></span></span></span></span></span></span></span></font></span></span></span></div><div><span style="color:rgb(103,111,125)"></span><span style="color:rgb(103,111,125)"></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 3 mai 2023 à 15:12, Aleksander Morgado <<a href="mailto:aleksandermj@chromium.org">aleksandermj@chromium.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey Thomas,<br>
<br>
> 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.<br>
<br>
What is the format of the +CTZE URC? is it similar to +CTZU? how are<br>
they different?<br>
<br>
> For my use case, I would like to update my local time automatically on a linux environment using modemmanager with quectel modules.<br>
> So right now I manage to change cinterion's function to process +CTZE events and I receive the signal like this<br>
> GDBusProxy *proxy = g_dbus_proxy_new_sync(connection,<br>
> G_DBUS_PROXY_FLAGS_NONE,<br>
> NULL,<br>
> "org.freedesktop.ModemManager1",<br>
> modemPath,<br>
> "org.freedesktop.ModemManager1.Modem.Time",<br>
> NULL,<br>
> &error);<br>
> if (error != NULL) {<br>
> g_printerr("Error creating ModemManager1.Modem proxy: %s\n", error->message);<br>
> g_error_free(error);<br>
> return 1;<br>
> }<br>
><br>
> g_signal_connect(proxy, "g-properties-changed", G_CALLBACK(update_local_time), NULL);<br>
> }<br>
> But I'm not sure it's the best way to process the signal<br>
<br>
Wondering, why not use the libmm-glib we ship with ModemManager<br>
instead of manually creating the proxies and parsing the list of<br>
updated properties?<br>
E.g. you could:<br>
* create a new MMManager with mm_manager_new()<br>
* list the MMObjects it handles with g_dbus_object_manager_get_objects()<br>
* get a MMModemTime interface object with mm_object_get_modem_time()<br>
* listen to the "network-time-changed" signal<br>
<br>
-- <br>
Aleksander<br>
</blockquote></div>