[PATCH 3/4] Add Powered property to CbsManager.
Denis Kenzior
denkenz at gmail.com
Wed Dec 16 10:59:01 PST 2009
Hi Andrew,
> static void cbs_set_topics_cb(const struct ofono_error *error, void *data)
> {
> struct ofono_cbs *cbs = data;
> @@ -320,9 +354,8 @@ static DBusMessage *cbs_set_topics(struct ofono_cbs
> *cbs, const char *value, DBusMessage *msg)
> {
> GSList *topics;
> - GSList *etws_topics = NULL;
> char *topic_str;
> - struct cbs_topic_range etws_range = { 4352, 4356 };
> + struct ofono_error error;
>
> topics = cbs_extract_topic_ranges(value);
>
> @@ -334,20 +367,112 @@ static DBusMessage *cbs_set_topics(struct ofono_cbs
> *cbs, const char *value,
>
> cbs->new_topics = topics;
>
> - if (topics != NULL)
> - etws_topics = g_slist_copy(topics);
> + cbs->pending = dbus_message_ref(msg);
>
> - etws_topics = g_slist_append(etws_topics, &etws_range);
> - topic_str = cbs_topic_ranges_to_string(etws_topics);
> - g_slist_free(etws_topics);
> + if (!cbs->powered) {
> + error.type = OFONO_ERROR_TYPE_NO_ERROR;
> + cbs_set_topics_cb(&error, cbs);
> + return NULL;
> + }
You should still be able to set the topics even if powered=false. Simply
store the new list and send it to the modem if powered==true.
>
> - cbs->pending = dbus_message_ref(msg);
> + topic_str = cbs_topics_to_str(cbs, topics);
> cbs->driver->set_topics(cbs, topic_str, cbs_set_topics_cb, cbs);
> g_free(topic_str);
>
> return NULL;
> }
>
> +static void cbs_power_off_cb(const struct ofono_error *error, void *data)
> +{
> +}
> +
Lets return the reply once the operation has succeeded at the driver to be
consistent with other parts of the system.
Regards,
-Denis
More information about the ofono
mailing list