Re: [PATCH 5/7] time: implement ModemTime in ModemBase



On Sat, Jan 21, 2012 at 04:58, Aleksander Morgado <aleksander lanedo com> wrote:
> If you just need to store a signed integer as the value of an entry in
> the hash table, you can better use GINT_TO_POINTER (integer) and
> GPOINTER_TO_INT (pointer), instead of packing the integer into a GValue.

I need it in a format that DBus will be okay with -- NetworkTimezone
is defined as a{sv}, and the glib datatype for a variant (v) is
GValue, right?

>> +
>>  /*************************************************************************/
>>  static void
>>  card_info_simple_invoke (MMCallbackInfo *info)
>> @@ -693,6 +744,36 @@ modem_auth_finish (MMModem *modem, MMAuthRequest *req, GError **error)
>>  /*****************************************************************************/
>>
>>  static void
>> +get_network_time_invoke (MMCallbackInfo *info)
>> +{
>> +    MMModemTimeGetNetworkTimeFn callback = (MMModemTimeGetNetworkTimeFn) info->callback;
>> +    MMModemTime *modem = MM_MODEM_TIME (info->modem);
>> +    char *network_time = (char *) mm_callback_info_get_result (info);
>> +
>> +    callback (modem, network_time, info->error, info->user_data);
>> +}
>> +
>> +static void
>> +get_network_time (MMModemTime *modem,
>> +                  MMModemTimeGetNetworkTimeFn callback,
>> +                  gpointer user_data)
>> +{
>> +    MMModemBase *self = MM_MODEM_BASE (modem);
>> +    MMCallbackInfo *info;
>> +
>> +    char *network_time = g_strdup("");
>> +
>> +    info = mm_callback_info_new_full (MM_MODEM (self),
>> +                                      get_network_time_invoke,
>> +                                      G_CALLBACK (callback),
>> +                                      user_data);
>> +    mm_callback_info_set_result (info, network_time, g_free);
>> +    mm_callback_info_schedule (info);
>> +}
>
> Given that the network time will be reported upon request, I would
> really just return a "not implemented" error instead of the empty string
> when the network time query is not implemented.

That's a good point.  I'll just drop this implementation and let
modems that support it fill it in?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]