Hi Fred,
On 03/12/2013 08:01 AM, Frédéric Danis wrote:
This patch adds initial implementation of the D-Bus Profile1
interface and methods responsible for handling Bluetooth connections.
The DUN GW profile interface is registered as soon as a GPRS capable
modem is registered in oFono.
---
Makefile.am | 3 +
plugins/bluez5.h | 1 +
plugins/dun_gw_bluez5.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 239 insertions(+)
create mode 100644 plugins/dun_gw_bluez5.c
I applied this patch, but I had to fix a minor issue afterwards:
+static DBusMessage *profile_new_connection(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessageIter entry;
+ const char *device;
+ int fd;
+ struct ofono_emulator *em;
+ struct ofono_modem *modem;
+
+ DBG("Profile handler NewConnection");
+
+ if (dbus_message_iter_init(msg,&entry) == FALSE)
+ goto invalid;
+
+ if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_OBJECT_PATH)
+ goto invalid;
+
+ dbus_message_iter_get_basic(&entry,&device);
+ dbus_message_iter_next(&entry);
+
+ if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_UNIX_FD)
+ goto invalid;
+
+ dbus_message_iter_get_basic(&entry,&fd);
+ dbus_message_iter_next(&entry);
+
+ if (fd< 0)
+ goto invalid;
+
+ DBG("%s", device);
+
+ /* Pick the first powered modem */
+ modem = modems->data;
+ if (modem == NULL) {
We should be checking for modems == NULL, not modems->data
+ close(fd);
+ return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
+ ".Rejected",
+ "No voice call capable modem");
This was changed to read '...GPRS capable modem'.
+ }
+
+ DBG("Picked modem %p for emulator", modem);
+
+ em = ofono_emulator_create(modem, OFONO_EMULATOR_TYPE_DUN);
+ if (em == NULL) {
+ close(fd);
+ return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
+ ".Rejected",
+ "Not enough resources");
+ }
+
+ ofono_emulator_register(em, fd);
+
+ return dbus_message_new_method_return(msg);
+
+invalid:
+ return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE ".Rejected",
+ "Invalid arguments in method call");
+}
+
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono