All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/6] emulator: Add ofono_emulator framework
Date: Tue, 13 Jul 2010 12:56:14 -0500	[thread overview]
Message-ID: <4C3CA8BE.4010403@gmail.com> (raw)
In-Reply-To: <1278308709-13908-2-git-send-email-zhenhua.zhang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]

Hi Zhenhua,

> +#define OFONO_EMULATOR_INTERFACE "org.ofono.Emulator"

So my suggestion is to keep it simple and not include the D-Bus
interface for the emulator at all for now.

> +
> +#include <ofono/types.h>
> +
> +struct ofono_emulator;
> +
> +enum ofono_emulator_type {
> +	OFONO_EMULATOR_TYPE_NONE,

Type NONE seems to be useless :)

> +	OFONO_EMULATOR_TYPE_DUN,
> +};
> +
> +struct ofono_emulator_driver {
> +	const char *name;
> +	enum ofono_emulator_type type;
> +	int (*probe)(struct ofono_emulator *e);
> +	void (*remove)(struct ofono_emulator *e);
> +	int (*enable)(struct ofono_emulator *e, int fd);
> +	int (*disable)(struct ofono_emulator *e);
> +};

For the emulator we really don't need a driver, see below...

> +
> +const char *ofono_emulator_get_path(struct ofono_emulator *e);
> +void ofono_emulator_set_data(struct ofono_emulator *e, void *user_data);
> +void *ofono_emulator_get_data(struct ofono_emulator *e);
> +

If there's no driver, then these are not required...

> +struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
> +					struct ofono_emulator_driver *driver);

So I think we should simply do it like this:

struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
enum ofono_emulator_type type, int fd);

Once we have the fd we really don't need anything else.  If the fd goes
away we can safely remove the atom.  If the modem is powered down, we
can safely shut down the connection.

> +void ofono_emulator_remove(struct ofono_emulator *e);
> +

This might or might not be necessary...

> +int ofono_emulator_driver_register(const struct ofono_emulator_driver *driver);
> +void ofono_emulator_driver_unregister(
> +				const struct ofono_emulator_driver *driver);
> +

These won't be necessary...

We then treat the emulator atom the same as any atom.  When the modem is
powered off the atom is removed.  The bluetooth dun plugin can create
look at the list of modems, establish the state watch (e.g. off/on
pre_sim/offline/online) and register the DUN atom appropriately (most
likely when the modem is turned on)

It will be up to the plugin to figure out which Bluetooth adapter to
register on (perhaps always the default one) and which modems to expose
(maybe a configuration file?)

Regards,
-Denis

  parent reply	other threads:[~2010-07-13 17:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  5:45 [PATCH 0/6] Add oFono DUN emulator Zhenhua Zhang
2010-07-05  5:45 ` [PATCH 1/6] emulator: Add ofono_emulator framework Zhenhua Zhang
2010-07-05  5:45   ` [PATCH 2/6] bluetooth: Add register service for bluetooth Zhenhua Zhang
2010-07-05  5:45     ` [PATCH 3/6] dun_gw: Add DUN emulator plugin Zhenhua Zhang
2010-07-05  5:45       ` [PATCH 4/6] emulator: Add Enable/Disable for oFono emulator Zhenhua Zhang
2010-07-05  5:45         ` [PATCH 5/6] emulator: Add test case for ofono emulator Zhenhua Zhang
2010-07-05  5:45           ` [PATCH 6/6] dun_gw: Probe emulator when we have new adapter Zhenhua Zhang
2010-07-09 14:20     ` [PATCH 2/6] bluetooth: Add register service for bluetooth Gustavo F. Padovan
2010-07-12  3:27       ` Zhang, Zhenhua
2010-07-12 13:03         ` Gustavo F. Padovan
2010-07-13 17:56   ` Denis Kenzior [this message]
2010-07-14  1:10     ` [PATCH 1/6] emulator: Add ofono_emulator framework Zhang, Zhenhua
2010-07-14  1:46       ` Denis Kenzior
2010-07-14  1:50         ` Zhang, Zhenhua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C3CA8BE.4010403@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.