Open Source Telephony
 help / color / mirror / Atom feed
From: Gustavo Padovan <padovan@profusion.mobi>
To: ofono@ofono.org
Subject: Re: [RFC 3/3] dun_dt: Add baseline for dun_dt plug-in.
Date: Thu, 07 Jul 2011 13:59:32 -0300	[thread overview]
Message-ID: <20110707165932.GA16322@joana> (raw)
In-Reply-To: <1310028323-29180-4-git-send-email-mario@tokarz.eu>

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

Hi Mario,

* Mario Tokarz <mario@tokarz.eu> [2011-07-07 10:45:23 +0200]:

> From: Mario Tokarz <mario.tokarz@bmw-carit.de>
> 
> ---
>  Makefile.am      |    3 +
>  plugins/dun_dt.c |  337 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 340 insertions(+), 0 deletions(-)
>  create mode 100644 plugins/dun_dt.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index c77a793..97698df 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -351,6 +351,9 @@ builtin_sources += plugins/hfp_ag.c plugins/bluetooth.h
>  builtin_modules += dun_gw
>  builtin_sources += plugins/dun_gw.c plugins/bluetooth.h
>  
> +builtin_modules += dun_dt
> +builtin_sources += plugins/dun_dt.c plugins/bluetooth.h
> +
>  builtin_sources += $(btio_sources)
>  builtin_cflags += @BLUEZ_CFLAGS@
>  builtin_libadd += @BLUEZ_LIBS@
> diff --git a/plugins/dun_dt.c b/plugins/dun_dt.c
> new file mode 100644
> index 0000000..98e2214
> --- /dev/null
> +++ b/plugins/dun_dt.c
> @@ -0,0 +1,337 @@
> +/*
> + *
> + *  oFono - Open Source Telephony
> + *
> + *  Copyright (C) 2008-2010  Intel Corporation. All rights reserved.
> + *  Copyright (C) 2010  ProFUSION embedded systems

So this is mine as in the original code I wrote. Not from ProFUSION.
It was part of a Google Summer of Code project.

	Copyright (C) 2010 Gustavo Padovan <gustavo@padovan.org>

> + *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License version 2 as
> + *  published by the Free Software Foundation.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +#include <string.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <errno.h>
> +#include <glib.h>
> +#include <gatchat.h>
> +#include <gattty.h>
> +#include <gdbus.h>
> +#include <ofono.h>
> +
> +#define OFONO_API_SUBJECT_TO_CHANGE
> +#include <ofono/plugin.h>
> +#include <ofono/log.h>
> +#include <ofono/modem.h>
> +#include <ofono/netreg.h>
> +#include <ofono/voicecall.h>
> +#include <ofono/gprs.h>
> +#include <ofono/gprs-context.h>
> +#include <ofono/call-volume.h>

call-volume.h?

> +
> +#include <drivers/dunmodem/dunmodem.h>
> +
> +#include <ofono/dbus.h>
> +
> +#include "bluetooth.h"
> +
> +#define BLUEZ_SERIAL_INTERFACE BLUEZ_SERVICE ".Serial"
> +
> +#ifndef DBUS_TYPE_UNIX_FD
> +#define DBUS_TYPE_UNIX_FD -1
> +#endif
> +
> +static DBusConnection *connection;
> +static GHashTable *modem_hash;
> +
> +static int dun_dt_bt_probe(const char *device, const char *dev_addr,
> +				const char *adapter_addr, const char *alias)
> +{
> +	struct ofono_modem *modem;
> +	struct dun_data *data;
> +	char buf[256];
> +	char alias_buf[256];
> +
> +	DBG("");
> +
> +	/* We already have this device in our hash, ignore */
> +	if (g_hash_table_lookup(modem_hash, device) != NULL)
> +		return -EALREADY;
> +
> +	ofono_info("Using device: %s, devaddr: %s, adapter: %s",
> +			device, dev_addr, adapter_addr);
> +
> +	strcpy(buf, "dun/");
> +	bluetooth_create_path(dev_addr, adapter_addr, buf + 4, sizeof(buf) - 4);
> +
> +	modem = ofono_modem_create(buf, "dun_dt");
> +	if (modem == NULL) {
> +		DBG("Failed to create modem");
> +		return -ENOMEM;
> +	}
> +
> +	DBG("Modem %p", modem);
> +
> +	data = g_try_new0(struct dun_data, 1);
> +	if (data == NULL)
> +		goto free;
> +
> +	data->dun_path = g_strdup(device);
> +	if (data->dun_path == NULL)
> +		goto free;
> +
> +	ofono_modem_set_data(modem, data);
> +
> +	strcpy(alias_buf, "DUN ");
> +	strcat(alias_buf, alias);

Do you really need tell the user this is a DUN modem? It doesn't care.

	Gustavo

  reply	other threads:[~2011-07-07 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07  8:45 [RFC 0/3] Adding DUN support Mario Tokarz
2011-07-07  8:45 ` [RFC 1/3] dunmodem: Add baseline for DUN modem driver Mario Tokarz
2011-07-07  8:16   ` Denis Kenzior
2011-07-07  8:45 ` [RFC 2/3] bluetooth: Add UUID for DUN Mario Tokarz
2011-07-07  8:00   ` Denis Kenzior
2011-07-07  8:45 ` [RFC 3/3] dun_dt: Add baseline for dun_dt plug-in Mario Tokarz
2011-07-07 16:59   ` Gustavo Padovan [this message]
2011-07-10 21:07     ` Mario Tokarz

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=20110707165932.GA16322@joana \
    --to=padovan@profusion.mobi \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox