mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 00:34:39 +08:00
dbus: Rename to org.bluez.Adapter1
Trivially add the numbering suffix to org.bluez.Adapter according to the proposal for BlueZ 5.
This commit is contained in:
parent
88b483b154
commit
a163324e1a
@ -11,7 +11,7 @@ Adapter hierarchy
|
||||
=================
|
||||
|
||||
Service org.bluez
|
||||
Interface org.bluez.Adapter
|
||||
Interface org.bluez.Adapter1
|
||||
Object path [variable prefix]/{hci0,hci1,...}
|
||||
|
||||
Methods void RequestSession()
|
||||
|
@ -28,7 +28,7 @@ Methods dict ReadLocalData()
|
||||
16 bytes randomizer blob.
|
||||
|
||||
Other data that can be transmitted via OOB mechanism
|
||||
can be obtained from org.bluez.Adapter interface.
|
||||
can be obtained from org.bluez.Adapter1 interface.
|
||||
|
||||
Note: This method will generate and return new data
|
||||
every time it is called. Data received in previous
|
||||
|
@ -342,7 +342,7 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
|
||||
assert(adapter != NULL);
|
||||
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"FindDevice");
|
||||
dbus_message_iter_init_append(message, &iter);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &bdaddr);
|
||||
@ -357,7 +357,7 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
|
||||
|
||||
if (!reply) {
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"CreateDevice");
|
||||
dbus_message_iter_init_append(message, &iter);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &bdaddr);
|
||||
@ -417,7 +417,7 @@ static gboolean list_known_printers(const char *adapter)
|
||||
DBusMessage *message, *reply;
|
||||
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"ListDevices");
|
||||
if (message == NULL)
|
||||
return FALSE;
|
||||
@ -467,7 +467,7 @@ static gboolean list_known_printers(const char *adapter)
|
||||
static DBusHandlerResult filter_func(DBusConnection *connection,
|
||||
DBusMessage *message, void *user_data)
|
||||
{
|
||||
if (dbus_message_is_signal(message, "org.bluez.Adapter",
|
||||
if (dbus_message_is_signal(message, "org.bluez.Adapter1",
|
||||
"DeviceFound")) {
|
||||
const char *adapter, *bdaddr;
|
||||
char *name;
|
||||
@ -481,7 +481,7 @@ static DBusHandlerResult filter_func(DBusConnection *connection,
|
||||
if (parse_device_properties(&iter, &name, NULL))
|
||||
remote_device_found(adapter, bdaddr, name);
|
||||
g_free (name);
|
||||
} else if (dbus_message_is_signal(message, "org.bluez.Adapter",
|
||||
} else if (dbus_message_is_signal(message, "org.bluez.Adapter1",
|
||||
"DeviceDisappeared")) {
|
||||
const char *bdaddr;
|
||||
|
||||
@ -489,7 +489,7 @@ static DBusHandlerResult filter_func(DBusConnection *connection,
|
||||
DBUS_TYPE_STRING, &bdaddr,
|
||||
DBUS_TYPE_INVALID);
|
||||
remote_device_disappeared(bdaddr);
|
||||
} else if (dbus_message_is_signal(message, "org.bluez.Adapter",
|
||||
} else if (dbus_message_is_signal(message, "org.bluez.Adapter1",
|
||||
"PropertyChanged")) {
|
||||
DBusMessageIter iter, value_iter;
|
||||
const char *name;
|
||||
@ -582,7 +582,7 @@ static gboolean list_printers(void)
|
||||
|
||||
#define MATCH_FORMAT \
|
||||
"type='signal'," \
|
||||
"interface='org.bluez.Adapter'," \
|
||||
"interface='org.bluez.Adapter1'," \
|
||||
"sender='org.bluez'," \
|
||||
"path='%s'"
|
||||
|
||||
@ -595,7 +595,7 @@ static gboolean list_printers(void)
|
||||
|
||||
doing_disco = TRUE;
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"StartDiscovery");
|
||||
|
||||
if (!dbus_connection_send_with_reply(conn, message, NULL, -1)) {
|
||||
@ -649,7 +649,7 @@ static gboolean print_ieee1284(const char *bdaddr)
|
||||
}
|
||||
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"FindDevice");
|
||||
dbus_message_iter_init_append(message, &iter);
|
||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &bdaddr);
|
||||
@ -664,7 +664,7 @@ static gboolean print_ieee1284(const char *bdaddr)
|
||||
|
||||
if (!reply) {
|
||||
message = dbus_message_new_method_call("org.bluez", adapter,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"CreateDevice");
|
||||
dbus_message_iter_init_append(message, &iter);
|
||||
dbus_message_iter_append_basic(&iter,
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <glib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define ADAPTER_INTERFACE "org.bluez.Adapter"
|
||||
#define ADAPTER_INTERFACE "org.bluez.Adapter1"
|
||||
|
||||
#define MODE_OFF 0x00
|
||||
#define MODE_CONNECTABLE 0x01
|
||||
|
@ -346,7 +346,7 @@ static int register_agent(DBusConnection *conn, const char *adapter_path,
|
||||
DBusError err;
|
||||
|
||||
msg = dbus_message_new_method_call("org.bluez", adapter_path,
|
||||
"org.bluez.Adapter", "RegisterAgent");
|
||||
"org.bluez.Adapter1", "RegisterAgent");
|
||||
if (!msg) {
|
||||
fprintf(stderr, "Can't allocate new method call\n");
|
||||
return -1;
|
||||
@ -385,7 +385,8 @@ static int unregister_agent(DBusConnection *conn, const char *adapter_path,
|
||||
DBusError err;
|
||||
|
||||
msg = dbus_message_new_method_call("org.bluez", adapter_path,
|
||||
"org.bluez.Adapter", "UnregisterAgent");
|
||||
"org.bluez.Adapter1",
|
||||
"UnregisterAgent");
|
||||
if (!msg) {
|
||||
fprintf(stderr, "Can't allocate new method call\n");
|
||||
return -1;
|
||||
@ -435,7 +436,7 @@ static int create_paired_device(DBusConnection *conn, const char *adapter_path,
|
||||
DBusPendingCall *pending;
|
||||
|
||||
msg = dbus_message_new_method_call("org.bluez", adapter_path,
|
||||
"org.bluez.Adapter",
|
||||
"org.bluez.Adapter1",
|
||||
"CreatePairedDevice");
|
||||
if (!msg) {
|
||||
fprintf(stderr, "Can't allocate new method call\n");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import dbus
|
||||
|
||||
SERVICE_NAME = "org.bluez"
|
||||
ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter"
|
||||
ADAPTER_INTERFACE = SERVICE_NAME + ".Adapter1"
|
||||
DEVICE_INTERFACE = SERVICE_NAME + ".Device1"
|
||||
|
||||
def get_managed_objects():
|
||||
|
@ -35,12 +35,12 @@ all_devices = (str(path) for path, interfaces in objects.iteritems() if
|
||||
"org.bluez.Device1" in interfaces.keys())
|
||||
|
||||
for path, interfaces in objects.iteritems():
|
||||
if "org.bluez.Adapter" not in interfaces.keys():
|
||||
if "org.bluez.Adapter1" not in interfaces.keys():
|
||||
continue
|
||||
|
||||
print("[ " + path + " ]")
|
||||
|
||||
properties = interfaces["org.bluez.Adapter"]
|
||||
properties = interfaces["org.bluez.Adapter1"]
|
||||
for key in properties.keys():
|
||||
value = properties[key]
|
||||
if (key == "UUIDs"):
|
||||
|
@ -7,7 +7,7 @@ import gobject
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
|
||||
relevant_ifaces = [ "org.bluez.Adapter", "org.bluez.Device1" ]
|
||||
relevant_ifaces = [ "org.bluez.Adapter1", "org.bluez.Device1" ]
|
||||
|
||||
def property_changed(interface, changed, invalidated, path):
|
||||
iface = interface[interface.rfind(".") + 1:]
|
||||
|
@ -37,16 +37,16 @@ if (len(args) < 1):
|
||||
sys.exit(1)
|
||||
|
||||
if (args[0] == "address"):
|
||||
addr = adapter.Get("org.bluez.Adapter", "Address")
|
||||
addr = adapter.Get("org.bluez.Adapter1", "Address")
|
||||
print(addr)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "name"):
|
||||
if (len(args) < 2):
|
||||
name = adapter.Get("org.bluez.Adapter", "Name")
|
||||
name = adapter.Get("org.bluez.Adapter1", "Name")
|
||||
print(name)
|
||||
else:
|
||||
adapter.Set("org.bluez.Adapter", "Name", args[1])
|
||||
adapter.Set("org.bluez.Adapter1", "Name", args[1])
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "list"):
|
||||
@ -55,12 +55,12 @@ if (args[0] == "list"):
|
||||
"org.freedesktop.DBus.ObjectManager")
|
||||
objects = om.GetManagedObjects()
|
||||
for path, interfaces in objects.iteritems():
|
||||
if "org.bluez.Adapter" not in interfaces:
|
||||
if "org.bluez.Adapter1" not in interfaces:
|
||||
continue
|
||||
|
||||
print(" [ %s ]" % (path))
|
||||
|
||||
props = interfaces["org.bluez.Adapter"]
|
||||
props = interfaces["org.bluez.Adapter1"]
|
||||
|
||||
for (key, value) in props.items():
|
||||
if (key == "Class"):
|
||||
@ -72,7 +72,7 @@ if (args[0] == "list"):
|
||||
|
||||
if (args[0] == "powered"):
|
||||
if (len(args) < 2):
|
||||
powered = adapter.Get("org.bluez.Adapter", "Powered")
|
||||
powered = adapter.Get("org.bluez.Adapter1", "Powered")
|
||||
print(powered)
|
||||
else:
|
||||
if (args[1] == "on"):
|
||||
@ -81,12 +81,12 @@ if (args[0] == "powered"):
|
||||
value = dbus.Boolean(0)
|
||||
else:
|
||||
value = dbus.Boolean(args[1])
|
||||
adapter.Set("org.bluez.Adapter", "Powered", value)
|
||||
adapter.Set("org.bluez.Adapter1", "Powered", value)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "pairable"):
|
||||
if (len(args) < 2):
|
||||
pairable = adapter.Get("org.bluez.Adapter", "Pairable")
|
||||
pairable = adapter.Get("org.bluez.Adapter1", "Pairable")
|
||||
print(pairable)
|
||||
else:
|
||||
if (args[1] == "on"):
|
||||
@ -95,21 +95,21 @@ if (args[0] == "pairable"):
|
||||
value = dbus.Boolean(0)
|
||||
else:
|
||||
value = dbus.Boolean(args[1])
|
||||
adapter.Set("org.bluez.Adapter", "Pairable", value)
|
||||
adapter.Set("org.bluez.Adapter1", "Pairable", value)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "pairabletimeout"):
|
||||
if (len(args) < 2):
|
||||
pt = adapter.Get("org.bluez.Adapter", "PairableTimeout")
|
||||
pt = adapter.Get("org.bluez.Adapter1", "PairableTimeout")
|
||||
print(pt)
|
||||
else:
|
||||
timeout = dbus.UInt32(args[1])
|
||||
adapter.Set("org.bluez.Adapter", "PairableTimeout", timeout)
|
||||
adapter.Set("org.bluez.Adapter1", "PairableTimeout", timeout)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "discoverable"):
|
||||
if (len(args) < 2):
|
||||
discoverable = adapter.Get("org.bluez.Adapter", "Discoverable")
|
||||
discoverable = adapter.Get("org.bluez.Adapter1", "Discoverable")
|
||||
print(discoverable)
|
||||
else:
|
||||
if (args[1] == "on"):
|
||||
@ -118,20 +118,20 @@ if (args[0] == "discoverable"):
|
||||
value = dbus.Boolean(0)
|
||||
else:
|
||||
value = dbus.Boolean(args[1])
|
||||
adapter.Set("org.bluez.Adapter", "Discoverable", value)
|
||||
adapter.Set("org.bluez.Adapter1", "Discoverable", value)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "discoverabletimeout"):
|
||||
if (len(args) < 2):
|
||||
dt = adapter.Get("org.bluez.Adapter", "DiscoverableTimeout")
|
||||
dt = adapter.Get("org.bluez.Adapter1", "DiscoverableTimeout")
|
||||
print(dt)
|
||||
else:
|
||||
to = dbus.UInt32(args[1])
|
||||
adapter.Set("org.bluez.Adapter", "DiscoverableTimeout", to)
|
||||
adapter.Set("org.bluez.Adapter1", "DiscoverableTimeout", to)
|
||||
sys.exit(0)
|
||||
|
||||
if (args[0] == "discovering"):
|
||||
discovering = adapter.Get("org.bluez.Adapter", "Discovering")
|
||||
discovering = adapter.Get("org.bluez.Adapter1", "Discovering")
|
||||
print(discovering)
|
||||
sys.exit(0)
|
||||
|
||||
|
@ -106,11 +106,11 @@ if __name__ == '__main__':
|
||||
compact = True;
|
||||
|
||||
bus.add_signal_receiver(devices_found,
|
||||
dbus_interface = "org.bluez.Adapter",
|
||||
dbus_interface = "org.bluez.Adapter1",
|
||||
signal_name = "DevicesFound")
|
||||
|
||||
bus.add_signal_receiver(property_changed,
|
||||
dbus_interface = "org.bluez.Adapter",
|
||||
dbus_interface = "org.bluez.Adapter1",
|
||||
signal_name = "PropertyChanged")
|
||||
|
||||
adapter.StartDiscovery()
|
||||
|
@ -138,7 +138,7 @@ objects = manager.GetManagedObjects()
|
||||
adapters = []
|
||||
|
||||
for path, ifaces in objects.iteritems():
|
||||
if ifaces.has_key("org.bluez.Adapter"):
|
||||
if ifaces.has_key("org.bluez.Adapter1"):
|
||||
adapters.append(path)
|
||||
|
||||
i = 1
|
||||
@ -160,7 +160,7 @@ while select == None:
|
||||
sys.exit()
|
||||
|
||||
adapter = dbus.Interface(bus.get_object("org.bluez", select),
|
||||
"org.bluez.Adapter")
|
||||
"org.bluez.Adapter1")
|
||||
|
||||
devices = adapter.GetProperties()["Devices"]
|
||||
|
||||
|
@ -28,7 +28,7 @@ objects = manager.GetManagedObjects()
|
||||
adapters = []
|
||||
|
||||
for path, ifaces in objects.iteritems():
|
||||
if ifaces.has_key("org.bluez.Adapter"):
|
||||
if ifaces.has_key("org.bluez.Adapter1"):
|
||||
adapters.append(path)
|
||||
|
||||
i = 1
|
||||
@ -50,7 +50,7 @@ while select == None:
|
||||
sys.exit()
|
||||
|
||||
adapter = dbus.Interface(bus.get_object("org.bluez", select),
|
||||
"org.bluez.Adapter")
|
||||
"org.bluez.Adapter1")
|
||||
|
||||
devices = adapter.GetProperties()["Devices"]
|
||||
|
||||
|
@ -9,11 +9,11 @@ import dbus.mainloop.glib
|
||||
import bluezutils
|
||||
|
||||
def interfaces_added(path, interfaces):
|
||||
if interfaces.get("org.bluez.Adapter") != None:
|
||||
if interfaces.get("org.bluez.Adapter1") != None:
|
||||
print("Adapter with path %s added" % (path))
|
||||
|
||||
def interfaces_removed(path, interfaces):
|
||||
if "org.bluez.Adapter" in interfaces:
|
||||
if "org.bluez.Adapter1" in interfaces:
|
||||
print("Adapter with path %s removed" % (path))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user