platform/upstream/neard.git
11 years agogdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL
Luiz Augusto von Dentz [Fri, 28 Dec 2012 12:50:59 +0000 (14:50 +0200)]
gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL

This flag can be used to mark methods as experimental, marked
methods are disable by default and can be enabled by setting
G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.

11 years agogdbus: Include changed properties only once per signal
Marcel Holtmann [Sun, 30 Dec 2012 08:58:04 +0000 (00:58 -0800)]
gdbus: Include changed properties only once per signal

11 years agogdbus: Update properties on D-Bus client re-connections
Marcel Holtmann [Sat, 29 Dec 2012 21:42:51 +0000 (13:42 -0800)]
gdbus: Update properties on D-Bus client re-connections

11 years agogdbus: Add function to manually refresh properties
Marcel Holtmann [Sat, 29 Dec 2012 21:24:17 +0000 (13:24 -0800)]
gdbus: Add function to manually refresh properties

11 years agogdbus: Add support for proxy property change notifications
Marcel Holtmann [Sat, 29 Dec 2012 20:29:50 +0000 (12:29 -0800)]
gdbus: Add support for proxy property change notifications

11 years agogdbus: Fix handling of client connect/disconnect signals
Marcel Holtmann [Sat, 29 Dec 2012 20:27:33 +0000 (12:27 -0800)]
gdbus: Fix handling of client connect/disconnect signals

11 years agogdbus: Protect standalone proxy creation with client reference
Marcel Holtmann [Sat, 29 Dec 2012 19:57:05 +0000 (11:57 -0800)]
gdbus: Protect standalone proxy creation with client reference

11 years agogdbus: Use object manager only if callback functions are set
Marcel Holtmann [Fri, 28 Dec 2012 05:30:06 +0000 (21:30 -0800)]
gdbus: Use object manager only if callback functions are set

11 years agogdbus: Use client service name and not hardcoded org.bluez
Marcel Holtmann [Fri, 28 Dec 2012 05:21:16 +0000 (21:21 -0800)]
gdbus: Use client service name and not hardcoded org.bluez

11 years agogdbus: Add support for creating D-Bus proxies without object manager
Marcel Holtmann [Fri, 28 Dec 2012 05:19:31 +0000 (21:19 -0800)]
gdbus: Add support for creating D-Bus proxies without object manager

11 years agogdbus: Avoid using g_ptr_array_new_full convenience function
Marcel Holtmann [Sat, 22 Dec 2012 20:05:59 +0000 (12:05 -0800)]
gdbus: Avoid using g_ptr_array_new_full convenience function

The g_ptr_array_new_full function only got introduced with GLib 2.30
and to avoid requiring a newer GLib use g_ptr_array_set_free_func instead.

11 years agobuild: Compile support for new D-Bus client helpers
Marcel Holtmann [Wed, 19 Dec 2012 02:46:18 +0000 (03:46 +0100)]
build: Compile support for new D-Bus client helpers

11 years agogdbus: Increase the method call timeout to 5 minutes
Marcel Holtmann [Tue, 18 Dec 2012 04:27:09 +0000 (05:27 +0100)]
gdbus: Increase the method call timeout to 5 minutes

11 years agogdbus: Add helper for sending async error replies
Marcel Holtmann [Tue, 18 Dec 2012 04:09:59 +0000 (05:09 +0100)]
gdbus: Add helper for sending async error replies

11 years agogdbus: Fix race condition with creating duplicate client proxies
Marcel Holtmann [Sun, 16 Dec 2012 00:16:28 +0000 (01:16 +0100)]
gdbus: Fix race condition with creating duplicate client proxies

11 years agogdbus: Fix issue with unref of client while parsing interfaces
Marcel Holtmann [Sun, 16 Dec 2012 00:06:33 +0000 (01:06 +0100)]
gdbus: Fix issue with unref of client while parsing interfaces

11 years agogdbus: Fix issue with unref of client in connect handler
Marcel Holtmann [Sat, 15 Dec 2012 22:34:51 +0000 (23:34 +0100)]
gdbus: Fix issue with unref of client in connect handler

11 years agogdbus: Add support for D-Bus client method calls
Marcel Holtmann [Sat, 15 Dec 2012 00:50:58 +0000 (01:50 +0100)]
gdbus: Add support for D-Bus client method calls

11 years agogdbus: Add callback support for handling property changes
Marcel Holtmann [Fri, 14 Dec 2012 18:48:06 +0000 (19:48 +0100)]
gdbus: Add callback support for handling property changes

11 years agogdbus: Handle property changed signals and update property
Marcel Holtmann [Fri, 14 Dec 2012 18:16:59 +0000 (19:16 +0100)]
gdbus: Handle property changed signals and update property

11 years agogdbus: Set property changed filter match rule for each proxy
Marcel Holtmann [Fri, 14 Dec 2012 17:48:18 +0000 (18:48 +0100)]
gdbus: Set property changed filter match rule for each proxy

11 years agogdbus: Use a GPtrArray for the match rules
Marcel Holtmann [Fri, 14 Dec 2012 17:23:39 +0000 (18:23 +0100)]
gdbus: Use a GPtrArray for the match rules

11 years agogdbus: Add support for setting D-Bus client basic properties
Marcel Holtmann [Fri, 14 Dec 2012 14:19:53 +0000 (15:19 +0100)]
gdbus: Add support for setting D-Bus client basic properties

11 years agogdbus: Deep copy of variants also requires a signature
Marcel Holtmann [Fri, 14 Dec 2012 14:07:36 +0000 (15:07 +0100)]
gdbus: Deep copy of variants also requires a signature

11 years agogdbus: Add support for complex D-Bus client properties
Marcel Holtmann [Thu, 13 Dec 2012 16:14:33 +0000 (17:14 +0100)]
gdbus: Add support for complex D-Bus client properties

11 years agogdbus: Add support for D-Bus client properties
Marcel Holtmann [Thu, 13 Dec 2012 13:06:25 +0000 (14:06 +0100)]
gdbus: Add support for D-Bus client properties

11 years agogdbus: Add support for D-Bus client proxies
Marcel Holtmann [Thu, 13 Dec 2012 01:38:53 +0000 (02:38 +0100)]
gdbus: Add support for D-Bus client proxies

11 years agogdbus: Add helper functions for simple D-Bus clients
Marcel Holtmann [Wed, 12 Dec 2012 20:58:57 +0000 (21:58 +0100)]
gdbus: Add helper functions for simple D-Bus clients

11 years agop2p: Make p2p_push more robust
Samuel Ortiz [Mon, 10 Dec 2012 16:46:18 +0000 (17:46 +0100)]
p2p: Make p2p_push more robust

Some devices do not provide neither SNEP nor NPP, or only NPP.
For those we need to check the fallback service name and the push op
existence.

11 years agobluetooth: Remove not needed forward declaration
Szymon Janc [Wed, 28 Nov 2012 14:08:42 +0000 (15:08 +0100)]
bluetooth: Remove not needed forward declaration

bt_do_pairing is not used before it is defined so there is no need to
forward declare it.

11 years agotest: Add handover_agent for testing
Szymon Janc [Wed, 28 Nov 2012 13:57:46 +0000 (14:57 +0100)]
test: Add handover_agent for testing

This is a very simple implementation of handover agent useful for
testing (especially if not willing to run BlueZ 5.x). Currently
received data in PushOOB/RequestOOB is printed and reply to RequestOOB
is generated from static data.

In future this might be extended to accept some user input and more
flexible reply generation.

11 years agondef: Remove not needed NULL assignments
Szymon Janc [Wed, 28 Nov 2012 13:57:45 +0000 (14:57 +0100)]
ndef: Remove not needed NULL assignments

There is no need to NULL parameters pointers to free_*_payload functions
as those are local copies.

11 years agoFix coding style errors through the code
Szymon Janc [Wed, 28 Nov 2012 13:57:44 +0000 (14:57 +0100)]
Fix coding style errors through the code

This fix some style errors reported by checkpatch and found while
working with code.

11 years agoTODO: Update
Samuel Ortiz [Wed, 5 Dec 2012 17:26:56 +0000 (18:26 +0100)]
TODO: Update

11 years agogdbus: Add g_dbus_add_properties_watch function
Luiz Augusto von Dentz [Tue, 27 Nov 2012 12:51:20 +0000 (14:51 +0200)]
gdbus: Add g_dbus_add_properties_watch function

Convenient function to create watches for D-Bus properties.

11 years agogdbus: Don't automatically attach ObjectManager
Lucas De Marchi [Thu, 29 Nov 2012 13:19:32 +0000 (11:19 -0200)]
gdbus: Don't automatically attach ObjectManager

Let each project attach the object manager interface instead of
registering it automatically.

11 years agogdbus: Don't register DBus.Properties with no properties
Lucas De Marchi [Thu, 29 Nov 2012 13:19:31 +0000 (11:19 -0200)]
gdbus: Don't register DBus.Properties with no properties

Delay registering DBus.Properties interface until the moment there are
properties on that path. This is needed for objects that currently don't
expose any property to not export the interface.

11 years agoadapter: Update the Devices array before emitting the D-Bus signal
Samuel Ortiz [Thu, 29 Nov 2012 15:21:20 +0000 (16:21 +0100)]
adapter: Update the Devices array before emitting the D-Bus signal

11 years agoagent: Provide DBUS_TIMEOUT_USE_DEFAULT if not available
Marcel Holtmann [Mon, 26 Nov 2012 13:50:42 +0000 (14:50 +0100)]
agent: Provide DBUS_TIMEOUT_USE_DEFAULT if not available

11 years agogdbus: Remove not needed NULL pointer checks
Szymon Janc [Wed, 21 Nov 2012 10:21:03 +0000 (11:21 +0100)]
gdbus: Remove not needed NULL pointer checks

g_strdup returns NULL if argument passed is NULL and there is no need
to double check that.

11 years agogdbus: Replace leading spaces with tabs
Syam Sidhardhan [Tue, 23 Oct 2012 13:57:06 +0000 (19:27 +0530)]
gdbus: Replace leading spaces with tabs

Trivial formatting fix.

11 years agogdbus: Fix compilation error due to missing #defines
Syam Sidhardhan [Wed, 14 Nov 2012 13:07:10 +0000 (18:37 +0530)]
gdbus: Fix compilation error due to missing #defines

Since these are simple #define strings, we are defining it here
instead of upgrading to D-Bus 1.5 or later.

Log:
  CC     gdbus/object.o
gdbus/object.c: In function ‘properties_set’:
gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared
 (first use in this function)
gdbus/object.c:876:7: note: each undeclared identifier is reported
 only once for each function it appears in
gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’
 undeclared (first use in this function)
make[1]: *** [gdbus/object.o] Error 1
make: *** [all] Error 2

11 years agogdbus: Remove connection from pending_property functions
Lucas De Marchi [Wed, 17 Oct 2012 15:14:28 +0000 (12:14 -0300)]
gdbus: Remove connection from pending_property functions

The reply to a DBus.Properties.Set() method call should go through the
same D-Bus connection. Thus remove the DBusConnection parameter from the
following functions:

    - g_dbus_pending_property_success()
    - g_dbus_pending_property_error_valist()
    - g_dbus_pending_property_error()

11 years agogdbus: Fix invalid memory access during interface removal
Johan Hedberg [Mon, 15 Oct 2012 10:21:11 +0000 (13:21 +0300)]
gdbus: Fix invalid memory access during interface removal

If an interface is removed from the root path during the same mainloop
iteration that it was added we need to check for data->added before
doing the check for data->parent == NULL in the remove_interface()
function. Otherwise the added interface doesn't get removed from the
data->added list and will result in accessing freed memory:

==337== Invalid read of size 8
==337==    at 0x4F65AFA: dbus_message_iter_append_basic (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x1247B5: append_interface (object.c:556)
==337==    by 0x4C8DC5C: g_slist_foreach (gslist.c:840)
==337==    by 0x1261F7: process_changes (object.c:594)
==337==    by 0x126372: generic_unregister (object.c:997)
==337==    by 0x4F69669: ??? (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x4F5CE51: dbus_connection_unregister_object_path (in /usr/lib64/libdbus-1.so.3.7.1)
==337==    by 0x125E81: object_path_unref (object.c:1236)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)
==337==  Address 0x5bc1550 is 0 bytes inside a block of size 56 free'd
==337==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==337==    by 0x4C7850E: g_free (gmem.c:252)
==337==    by 0x125DB0: remove_interface (object.c:671)
==337==    by 0x125E3B: object_path_unref (object.c:1230)
==337==    by 0x126136: g_dbus_unregister_interface (object.c:1361)
==337==    by 0x14CDF0: service_exit (service.c:581)
==337==    by 0x177556: plugin_cleanup (plugin.c:242)
==337==    by 0x12221F: main (main.c:559)

11 years agogdbus: Add g_dbus_get_properties function
Johan Hedberg [Fri, 12 Oct 2012 08:55:37 +0000 (10:55 +0200)]
gdbus: Add g_dbus_get_properties function

This function can be used to construct custom D-Bus messages containing
the properties for a specific interface on a given path.

11 years agogdbus: Add support for invalidated properties
Johan Hedberg [Thu, 11 Oct 2012 09:53:27 +0000 (11:53 +0200)]
gdbus: Add support for invalidated properties

If there's a pending property but its exists() callback returns false
the property should be considered invalidated and included in the
relevant list of the PropertiesChanged signal.

11 years agogdbus: Fix processing pending properties in remove_interface()
Johan Hedberg [Mon, 8 Oct 2012 12:36:12 +0000 (14:36 +0200)]
gdbus: Fix processing pending properties in remove_interface()

11 years agogdbus: Fix up Properties.Set() code path
Lucas De Marchi [Sat, 6 Oct 2012 07:02:35 +0000 (04:02 -0300)]
gdbus: Fix up Properties.Set() code path

Minor fixes to make setter actually work:

- Add propdata in pending_property_set
- Break loop when we are removing propdata from list and we
  found it
- in_args and out_args were swapped
- interface and method name arguments were swapped

11 years agogdbus: Fix invalid memory access while unregistering
Lucas De Marchi [Thu, 4 Oct 2012 20:42:33 +0000 (17:42 -0300)]
gdbus: Fix invalid memory access while unregistering

If an interface is added and removed on the same mailoop iteration,
ObjectManager would try to send InterfacesAdded signal while running the
idler because the interface was added to data->added list.

This is easily reproduced by forcing an error path in a plugin
registration, like on sap_server_register(), resulting in the following
error:

==11795== Invalid read of size 4
==11795==    at 0x496F592: dbus_message_iter_append_basic (dbus-message.c:2598)
==11795==    by 0x117B39: append_interface (object.c:554)
==11795==    by 0x48955E7: g_slist_foreach (gslist.c:840)
==11795==    by 0x11923B: process_changes (object.c:592)
==11795==    by 0x11956D: generic_unregister (object.c:980)
==11795==    by 0x4973BAC: _dbus_object_tree_unregister_and_unlock (dbus-object-tree.c:516)
==11795==    by 0x4965240: dbus_connection_unregister_object_path (dbus-connection.c:5776)
==11795==    by 0x1178A5: object_path_unref (object.c:1219)
==11795==    by 0x118517: g_dbus_unregister_interface (object.c:1344)
==11795==    by 0x19AF5B: sap_exit (sap.c:385)
==11795==    by 0x13E9E2: sap_server_register (server.c:1428)
==11795==    by 0x13C092: sap_server_probe (manager.c:44)

With this patch we don't send the InterfacesAdded signal, removing it
from data->added while unregistering.

11 years agogdbus: Implement PropertiesChanged signal
Lucas De Marchi [Thu, 4 Oct 2012 07:26:37 +0000 (04:26 -0300)]
gdbus: Implement PropertiesChanged signal

11 years agogdbus: Simplify code for appending properties
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:36 +0000 (04:26 -0300)]
gdbus: Simplify code for appending properties

This reuse append_properties for GetAll and GetManagedObjects

11 years agogdbus: Integrates ObjectManager with Properties interface
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:35 +0000 (04:26 -0300)]
gdbus: Integrates ObjectManager with Properties interface

This appends the properties and its values when using ObjectManager.

11 years agogdbus: Only export ObjectManager interface on root path
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:34 +0000 (04:26 -0300)]
gdbus: Only export ObjectManager interface on root path

ObjectManager should be exported only in the root path and list all
the children paths.

11 years agogdbus: Group interface changes to reduce the amount of signals emitted
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:33 +0000 (04:26 -0300)]
gdbus: Group interface changes to reduce the amount of signals emitted

InterfacesAdded and InterfacesRemoved can group all the interfaces
changes together in one message.

11 years agogdbus: Add support for org.freedesktop.DBus.ObjectManager interface
Luiz Augusto von Dentz [Thu, 4 Oct 2012 07:26:32 +0000 (04:26 -0300)]
gdbus: Add support for org.freedesktop.DBus.ObjectManager interface

This implements initial support for ObjectManager, it automatically adds
objects to its parents so no action is needed by daemons to get their
objects managed by this interface.

ObjectManager is part of D-Bus spec since revision 0.17:
http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager

11 years agogdbus: Add properties into Introspectable interface
Lucas De Marchi [Thu, 4 Oct 2012 07:26:31 +0000 (04:26 -0300)]
gdbus: Add properties into Introspectable interface

11 years agogdbus: Implement DBus.Properties.Set method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:30 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Set method

Contrary to Get() and GetAll(), Set() is asynchronous so we pass an id
to the setter so later it can declare the Set() as successful or
otherwise.

11 years agogdbus: Implement DBus.Properties.GetAll method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:29 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.GetAll method

11 years agogdbus: Implement DBus.Properties.Get method
Lucas De Marchi [Thu, 4 Oct 2012 07:26:28 +0000 (04:26 -0300)]
gdbus: Implement DBus.Properties.Get method

11 years agogdbus: Add skeleton of DBus.Properties interface
Lucas De Marchi [Thu, 4 Oct 2012 07:26:27 +0000 (04:26 -0300)]
gdbus: Add skeleton of DBus.Properties interface

This interface is responsible for handling properties of all objects in
a given path. Right now it only registers itself, doing nothing useful.
A conversion to this new layout will be done by subsequent patches.

org.freedesktop.org.DBus.Properties spec can be found at
http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

11 years agogdbus: Use macros to add annotations
Lucas De Marchi [Thu, 4 Oct 2012 07:26:26 +0000 (04:26 -0300)]
gdbus: Use macros to add annotations

Besides being more readable this way it avoids going over 80 chars.

11 years agogdbus: Move typedefs up
Lucas De Marchi [Thu, 4 Oct 2012 07:26:25 +0000 (04:26 -0300)]
gdbus: Move typedefs up

Move the typedefs up so they can be used by functions and callbacks.

11 years agogdbus: Fix not freeing list node by using g_slist_delete_link
Luiz Augusto von Dentz [Wed, 3 Oct 2012 11:57:06 +0000 (14:57 +0300)]
gdbus: Fix not freeing list node by using g_slist_delete_link

g_slist_remove_link does not free the node which can cause leaks so
replace that with g_slist_delete_link which does free memory properly.

11 years agogdbus: Refactor filter_data_find()
Lucas De Marchi [Thu, 27 Sep 2012 11:58:59 +0000 (08:58 -0300)]
gdbus: Refactor filter_data_find()

Now this function is only used for searching the listeners of a
connection and the other parameters are not needed anymore.

11 years agogdbus: Fix wrong signal handler match
Lucas De Marchi [Thu, 27 Sep 2012 11:58:58 +0000 (08:58 -0300)]
gdbus: Fix wrong signal handler match

When we add a signal handler with g_dbus_add_signal_watch(), this
function tries to multiplex the matches added in libdbus by checking
if there's a previous filter_data with the same fields. However, if the
field is NULL it accepts as being the same. The result is that the
following watches will use the same filter data:

watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

The result is that when a signal arrives with path == "/path2", all 3
callbacks above will be called, with the same signal delivered to all of
them.

Another problem is that, if we invert the calls like below, only signals
to cb1 will never be trigerred, nonetheless it used path == NULL.

watch2 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path2", iface, member,
cb2, data2, NULL);
watch1 = g_dbus_add_signal_watch(conn, BUS_NAME, NULL, iface, member,
cb1, data1, NULL);
watch3 = g_dbus_add_signal_watch(conn, BUS_NAME, "/path3", iface, member,
cb3, data3, NULL);

This is fixed by not multiplexing the matchs with filter data if any of
the fields are different, including being NULL. When a signal arrives,
if a field is NULL we accept it as a match, but not when adding the
signal handler.

11 years agogdbus: Fix crash when getting disconnected from the bus
Johan Hedberg [Thu, 27 Sep 2012 11:58:57 +0000 (08:58 -0300)]
gdbus: Fix crash when getting disconnected from the bus

When getting disconnected from the bus sometimes (maybe always?)
dbus_watch_handle() can cause the "info" context to be free'd meaning
that we should not try to access it after the call. The only member we
need access to is the connection pointer and as the code already has a
ref() call for it it's only natural to solve the issue by adding a local
variable not dependent on "info".

The backtrace of the crash fixed looks as follows:

 Invalid read of size 8
   at 0x121085: watch_func (mainloop.c:105)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)
 Address 0x5bbcd90 is 16 bytes inside a block of size 24 free'd
   at 0x4A079AE: free (vg_replace_malloc.c:427)
   by 0x4C7837E: g_free (gmem.c:252)
   by 0x4F708BF: dbus_watch_set_data (dbus-watch.c:614)
   by 0x4F70938: _dbus_watch_unref (dbus-watch.c:132)
   by 0x4F6E9A7: _dbus_transport_handle_watch (dbus-transport.c:884)
   by 0x4F59AFB: _dbus_connection_handle_watch (dbus-connection.c:1497)
   by 0x4F70AF9: dbus_watch_handle (dbus-watch.c:683)
   by 0x121084: watch_func (mainloop.c:103)
   by 0x4C72694: g_main_context_dispatch (gmain.c:2539)
   by 0x4C729C7: g_main_context_iterate.isra.23 (gmain.c:3146)
   by 0x4C72DC1: g_main_loop_run (gmain.c:3340)
   by 0x120541: main (main.c:551)

11 years agoadapter: Update the RF mode D-Bus property
Samuel Ortiz [Mon, 26 Nov 2012 10:41:57 +0000 (11:41 +0100)]
adapter: Update the RF mode D-Bus property

When detecting a tag, or a device, the RF mode changes.
When the link is down, RF mode goes to Idle.

11 years agoadapter: Expose the adapter radio mode through D-Bus
Samuel Ortiz [Mon, 26 Nov 2012 10:12:12 +0000 (11:12 +0100)]
adapter: Expose the adapter radio mode through D-Bus

11 years agodoc: Some small issues cleanup
Szymon Janc [Mon, 12 Nov 2012 13:33:11 +0000 (14:33 +0100)]
doc: Some small issues cleanup

Fix some whitespace, line-over-80 and typos issues.

11 years agodoc: Clarify EIR blob format in handover agent API
Szymon Janc [Mon, 12 Nov 2012 13:33:09 +0000 (14:33 +0100)]
doc: Clarify EIR blob format in handover agent API

Clarify what EIR blob is and where to find how it is specified.

11 years agonfctype3: Sending the POLL command should be the default behaviour
Samuel Ortiz [Mon, 19 Nov 2012 23:24:07 +0000 (00:24 +0100)]
nfctype3: Sending the POLL command should be the default behaviour

commit bd285ab6 changed the default case to be the one for only a
couple of Felica tags.

11 years agoagent: Don't look for NULL record type on the NDEF agent hash
Samuel Ortiz [Wed, 31 Oct 2012 09:39:18 +0000 (10:39 +0100)]
agent: Don't look for NULL record type on the NDEF agent hash

11 years agondef: Cosmetic fix for action check in parse_mime_type
Szymon Janc [Thu, 15 Nov 2012 08:15:44 +0000 (09:15 +0100)]
ndef: Cosmetic fix for action check in parse_mime_type

Match action check with neard code style.

11 years agobluetooth: Always enable legacy BT when no HO agent is registered
Szymon Janc [Thu, 15 Nov 2012 08:15:43 +0000 (09:15 +0100)]
bluetooth: Always enable legacy BT when no HO agent is registered

If the timer expired, that basically means no agent got registered,
regardless of BlueZ being version 5 or 4. In such situation just go
with legacy implementation as there is nothing better that could be
done anyway.

11 years agondef: Select HO agent based on agent presence check
Szymon Janc [Thu, 15 Nov 2012 08:15:42 +0000 (09:15 +0100)]
ndef: Select HO agent based on agent presence check

Choose between HO Agent or legacy bluetooth implementation based on
HO agent presence and not on detected BlueZ version.

11 years agobluetooth: Cosmetic fix for handover registration check
Samuel Ortiz [Wed, 14 Nov 2012 11:25:07 +0000 (12:25 +0100)]
bluetooth: Cosmetic fix for handover registration check

11 years agoSupport only static handover with Nokia proprietary mime type
Szymon Janc [Wed, 31 Oct 2012 11:22:24 +0000 (12:22 +0100)]
Support only static handover with Nokia proprietary mime type

Parse nokia.com:bt mime type only if received in Handover Select
message.

11 years agondef: Workaround buggy Nokia BH-505 handover implementation
Szymon Janc [Wed, 31 Oct 2012 11:22:23 +0000 (12:22 +0100)]
ndef: Workaround buggy Nokia BH-505 handover implementation

According to BT Core Specification 4.0 length field in OOB EIR contains
the length of the entire OOB data block including the length field
itself.

Some Nokia BH-505 devices reports OOB EIR length without length field
size. Correct size before sending EIR to agent.

11 years agondef: Workaround buggy Android 4.1 BT handover implementation
Szymon Janc [Wed, 31 Oct 2012 11:22:22 +0000 (12:22 +0100)]
ndef: Workaround buggy Android 4.1 BT handover implementation

Some implementations (e.g. Android 4.1) stores the data_size in big
endian but NDEF forum spec (BT Secure Simple Pairing) requires a little
endian. At the same time, the NDEF forum NDEF spec define a payload
length as single byte (and the payload size IS the oob data size).
So we check the first byte to determine if we have a big or little
endian size.

11 years agoUse handover agent for Bluetooth data
Szymon Janc [Wed, 31 Oct 2012 11:22:21 +0000 (12:22 +0100)]
Use handover agent for Bluetooth data

If detected BlueZ is not version 4 handover agent is used for bluetooth
data handling.

11 years agobluetooth: Use bluetooth implementation only for BlueZ 4
Szymon Janc [Wed, 31 Oct 2012 11:22:20 +0000 (12:22 +0100)]
bluetooth: Use bluetooth implementation only for BlueZ 4

BlueZ 5 will break DBus API and will be able to act as Handover Agent.
If handover agent is not registered while initializing/starting legacy
bluetooth implementation delay setting up watchers to give handover
agent time to register. This reduces D-Bus calls in case when BlueZ
registers itself as handover agent.

If handover agent is registered legacy bluetooth is stopped. When agent
unregisters or vanishes legacy bluetooth is reinitialized.

11 years agobluetooth: Use struct bt_data in near_ndef_prepare_handover_record
Szymon Janc [Wed, 31 Oct 2012 11:22:19 +0000 (12:22 +0100)]
bluetooth: Use struct bt_data in near_ndef_prepare_handover_record

This also fix creating EIR with length field in host order instead of
little endian.

11 years agobluetooth: Move name at the end of EIR
Szymon Janc [Wed, 31 Oct 2012 11:22:18 +0000 (12:22 +0100)]
bluetooth: Move name at the end of EIR

This will make sure that hash and randomizer are send even when name is
long. Also limit name to not exceed maximum sensible EIR length of 255
bytes. If name would not fit use EIR_NAME_SHORT data type for it.

11 years agobluetooth: Make __near_bluetooth_parse_oob_record use struct bt_data
Szymon Janc [Wed, 31 Oct 2012 11:22:17 +0000 (12:22 +0100)]
bluetooth: Make __near_bluetooth_parse_oob_record use struct bt_data

This will make it similar to handover agent api and thus make switching
between those two interfaces easier.

11 years agoAdd __near_agent_handover_registered function
Szymon Janc [Wed, 31 Oct 2012 11:22:16 +0000 (12:22 +0100)]
Add __near_agent_handover_registered function

It will be used to check if handover agent is registered.

11 years agoagent: Add __near_agent_handover_request_data function
Szymon Janc [Wed, 31 Oct 2012 11:22:15 +0000 (12:22 +0100)]
agent: Add __near_agent_handover_request_data function

11 years agoagent: Add __near_agent_handover_push_data function
Szymon Janc [Wed, 31 Oct 2012 11:22:14 +0000 (12:22 +0100)]
agent: Add __near_agent_handover_push_data function

11 years agoRelease 0.8 0.8
Samuel Ortiz [Tue, 30 Oct 2012 17:22:08 +0000 (18:22 +0100)]
Release 0.8

11 years agonetlink: Add netlink event socket
Samuel Ortiz [Tue, 30 Oct 2012 15:48:40 +0000 (16:48 +0100)]
netlink: Add netlink event socket

Some netlink command can send multicast event before they're done.
To receive them the netlink_event function should be listening on
an event dedicated socket.

11 years agondef: Remove the cr record from Hs message
Olivier Guiter [Mon, 29 Oct 2012 10:30:50 +0000 (11:30 +0100)]
ndef: Remove the cr record from Hs message

NFC forum specs says that cr record should not be found on Hs messages.

As near_ndef_prepare_handover_record() is used to build Hs and Hr,
we have to remove the cr record only for Hs. To handle this case (and also
other cases where e.g. there's no ac record), the message begin/end flags
routines must be more granular (separate MB and ME setting routines).

11 years agondef: Fix handover version check
Olivier Guiter [Fri, 26 Oct 2012 10:14:55 +0000 (12:14 +0200)]
ndef: Fix handover version check

In Connection Handover, Version check should return an empty Hs (with
the supported version) when major part is different from the local
major version.

11 years agohandover: Fix to allow two handover requests
Olivier Guiter [Mon, 22 Oct 2012 13:52:57 +0000 (15:52 +0200)]
handover: Fix to allow two handover requests

Test case 7 verifies that the remote handover server does not close the data
link connection after the first handover request message.

11 years agohandover: Handle Handover frames without ac records
Olivier Guiter [Mon, 22 Oct 2012 13:52:55 +0000 (15:52 +0200)]
handover: Handle Handover frames without ac records

11 years agobluetooth: Extend mime_type with bluetooth properties
Olivier Guiter [Mon, 22 Oct 2012 13:52:54 +0000 (15:52 +0200)]
bluetooth: Extend mime_type with bluetooth properties

To comply with handover specs, if the incoming Hr OOB doesn't include
SP hash/randomizer keys, the reply (Hs) should not include such
information. So we store it to the cfg mime_type.

11 years agohandover: Change carriers type to bitfield
Olivier Guiter [Mon, 22 Oct 2012 13:52:53 +0000 (15:52 +0200)]
handover: Change carriers type to bitfield

This would allow multiple carriers at the same time (e.g. Bluetooth
and Wifi)

11 years agohandover: Change behavior for empty (no ac) frames
Olivier Guiter [Mon, 22 Oct 2012 13:52:52 +0000 (15:52 +0200)]
handover: Change behavior for empty (no ac) frames

Some frame may not have ac records, so we have to jump to the parsing code
right after checking the frame header.

11 years agondef: Skip record header when parsing handover records
Samuel Ortiz [Wed, 24 Oct 2012 15:42:20 +0000 (17:42 +0200)]
ndef: Skip record header when parsing handover records

11 years agondef: Fix offset check when parsing NDEF records
Olivier Guiter [Mon, 22 Oct 2012 13:52:50 +0000 (15:52 +0200)]
ndef: Fix offset check when parsing NDEF records

For each record header entry we need to check that the offest and the
payload length is not longer than the total record length.

11 years agoagent: Push raw NDEF along with the matching record
Samuel Ortiz [Tue, 23 Oct 2012 21:50:29 +0000 (23:50 +0200)]
agent: Push raw NDEF along with the matching record

11 years agondef: Add records raw data to a D-Bus iterator
Samuel Ortiz [Tue, 23 Oct 2012 17:53:18 +0000 (19:53 +0200)]
ndef: Add records raw data to a D-Bus iterator

This will be needed by the NDEF agent raw data export routines.