Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2049646ybb; Thu, 9 Apr 2020 14:09:09 -0700 (PDT) X-Google-Smtp-Source: APiQypKxJBUQGSPAggoZKTwc/kvS4gRzha9AJJCIqXW+FZIEkrWghXgXmWiq/xMFO/hPChU4c74e X-Received: by 2002:a0c:8167:: with SMTP id 94mr2228432qvc.90.1586466548879; Thu, 09 Apr 2020 14:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586466548; cv=none; d=google.com; s=arc-20160816; b=sQOIAECyLpda3JaNCWoPKT55FVjBVZFMkdfZFEigBRWicUDY7ovOWHr+ROsj2qoZGj oFhDx3eKv7NRoqbBRYADW+0RSyoXSHVPKW5ylMRJCQa7BiWS79XBFEM3qAeGhdkFQFH2 XEoTM4E7XO04Y9oMgkgrHEGXUjntcRNYrAnxJHYlAkmSO6KUToeypebrUcRb/pQjexCi 6MmJFzqcArHqTkcpq/gKlpNZ0j3KFdX/os0RxavqCo4CBCSnLrUGmsNxlUcgnFmI68wb xtkRHvS6qgYJmznNG0qceyQ1td3KGpSINNuWXYOvtdVbR0maposjV9lPZAzYT1PEBw9E Dwng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GxS408+UV2gpDvxvD3/brI/Th016BAR4nzkq2aNoLq4=; b=tBhzY+z1msiyLYkOL6suh77e2E/OkAEjl4e7JF+TrLbB2lQ+PYuQB/sVHyZV5txwoT YBTKADOK+F2rYMIJdZYiNuSJAPNejE3kcNR0gB8z+MQTGtT1naR2VL3vHKq57Ua4bN+M x1cT7Mj1eQvssn40oxUKqISYWC6wGf1xKRki+fLLLqOtKNk7BZ1C9kMpX09yCYldxioO LsB1FgTuxpqm/e14e7DRF83a1FXHGZ6Hf3pDEPa9Ncnzd3nAFrvb/j0D5hphh2Dlo9fw TUs7UnpHMkBDAv9O9+gq1Q2OULalohfN1uteIvKRcACveLTXOtjuWFt+EAnkk0+Z7mF5 hF3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A+gCGgk7; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si89933qkc.288.2020.04.09.14.08.51; Thu, 09 Apr 2020 14:09:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A+gCGgk7; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727258AbgDIVIr (ORCPT + 99 others); Thu, 9 Apr 2020 17:08:47 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:44945 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727242AbgDIVIr (ORCPT ); Thu, 9 Apr 2020 17:08:47 -0400 Received: by mail-ed1-f67.google.com with SMTP id cb27so1713153edb.11 for ; Thu, 09 Apr 2020 14:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GxS408+UV2gpDvxvD3/brI/Th016BAR4nzkq2aNoLq4=; b=A+gCGgk7JVUHZQ6jruFGiiY8qAzxVrK5An+72i+uqM+jDI+DsVqlAN6eIbnAhi3njv WCgquBTPY94UHVqpLYPOlA6nc+rrQBm5Y17hUsGws1SdmLc1odYM3J60GWa2e/C6Ejrh vW3rsFAVDctGF2iXo4hi5Jkk8/lPN8UpbmKz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GxS408+UV2gpDvxvD3/brI/Th016BAR4nzkq2aNoLq4=; b=kD1G9SkzHKGzuhUx0uegDDA1A4tDZLHHJeBfF+LWbyLXbmZaKEzD9szqq14e7BQo/H ubFPYjU17vzngzeAxZJV7xSmdRehF01CnSbIasjMlzE5jnxWuXYExTK2Wc4YexLEJPKV zp/8shA254ON8D/AC0hcNVyUPGXLEUq2cYmjzdySTRnEICDWHFd1ti8FUHYpYAk2bnuM rvnJdE3ItziSkx7Y2wfzkCLqaRXwUESbpZqirFGgRsC+6ZB0gu+vnVY05Txypy9kyalW CxY43tDVHrLrCzqK2AipqFeF84fAk60Sl+wOvJIJixWFb5gfU1ePA70Gi59jj4ksx7dI xCTg== X-Gm-Message-State: AGi0Pub2eKiaCAt++X89Ikk4Xag+VWq8bTyeqWbZDhIq9ILsam6kEetq MBpGnIrLWO80gMN8K8wInIZv6kF9zfQ= X-Received: by 2002:a50:f0dc:: with SMTP id a28mr2008334edm.57.1586466525232; Thu, 09 Apr 2020 14:08:45 -0700 (PDT) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com. [209.85.128.51]) by smtp.gmail.com with ESMTPSA id k9sm12928edl.35.2020.04.09.14.08.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 14:08:44 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id a81so291973wmf.5 for ; Thu, 09 Apr 2020 14:08:44 -0700 (PDT) X-Received: by 2002:a1c:a553:: with SMTP id o80mr1894867wme.154.1586466523542; Thu, 09 Apr 2020 14:08:43 -0700 (PDT) MIME-Version: 1.0 References: <20200401221434.12185-1-sonnysasaka@chromium.org> In-Reply-To: From: Sonny Sasaka Date: Thu, 9 Apr 2020 14:08:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/5] D-Bus API changes for managing SDP records To: Luiz Augusto von Dentz Cc: Marcel Holtmann , Bluez mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Thanks for the feedback, Luiz. We will explore the ways you all suggested. On Thu, Apr 9, 2020 at 11:35 AM Luiz Augusto von Dentz wrote: > > Hi Sonny, > > On Thu, Apr 9, 2020 at 11:28 AM Sonny Sasaka w= rote: > > > > Hi Marcel, > > > > This was needed to support emulation of Android apps's Bluetooth API > > on top of BlueZ. Android expects to be able to access the SDP database > > of a remote device via its HAL interface > > (https://android.googlesource.com/platform/system/bt/+/master/include/h= ardware/bt_sdp.h#38). > > I suppose you could read the cache directly, though there is no > guarantee that we won't change the format of that, btw I suppose > services handled by the daemon should not be exposed to the Android > side otherwise you may have conflicts so going with Profile interface > is probably the way to go, but you will need to know the UUIDs that > would be handled by Android. > > > Thanks for the feedback, we will revisit this and see if a redesign > > based on your suggestion is possible. > > > > On Thu, Apr 9, 2020 at 11:05 AM Marcel Holtmann w= rote: > > > > > > Hi Sonny, > > > > > > > This defines the DBus API that we'll use with BlueZ to create, remo= ve > > > > and get service records. > > > > --- > > > > doc/adapter-api.txt | 46 ++++++++++++++++++++++++++++++++++++++++++= +++ > > > > doc/device-api.txt | 37 ++++++++++++++++++++++++++++++++++++ > > > > 2 files changed, 83 insertions(+) > > > > > > > > diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt > > > > index acae032d9..6e4c37fc9 100644 > > > > --- a/doc/adapter-api.txt > > > > +++ b/doc/adapter-api.txt > > > > @@ -204,6 +204,52 @@ Methods void StartDiscovery() > > > > org.bluez.Error.NotReady > > > > org.bluez.Error.Failed > > > > > > > > + uint32 CreateServiceRecord(dict record) > > > > + > > > > + This method creates an entry with the local S= DP server > > > > + for this adapter for the specified record. Th= is method > > > > + will only create the SDP record and not start= listening > > > > + on any ports. It is up to the caller of the m= ethod to > > > > + ensure the validity of the service record. Th= is record > > > > + will not be parsed for any validation but wil= l instead > > > > + directly be inserted into the local SDP serve= r=E2=80=99s > > > > + records. > > > > + > > > > + The return value from this method will be the= 32 bit > > > > + handle for the created service record. > > > > + > > > > + The record dictionary will have dictionary en= tries of > > > > + the format: {id : (type, size, value)}, where= , > > > > + > > > > + uint16 id: The 16 bit attribute ID for a= n > > > > + attribute. > > > > + uint8 type: This will contain the type of= the > > > > + attribute value. Attribute ty= pe values > > > > + are defined in the Bluetooth = spec in > > > > + Volume 3, Part B, 3.2. > > > > + uint32 size: This is the size of the attri= bute > > > > + value. > > > > + variant value: This will contain the attribu= te value > > > > + for a given attribute_id. Thi= s variant > > > > + can either contain a primitiv= e type, or > > > > + if type is SEQUENCE, an array= of struct > > > > + of the signature (type, size,= value). > > > > + > > > > + Possible errors: org.bluez.Error.NotReady > > > > + org.bluez.Error.AlreadyExist= s > > > > + org.bluez.Error.Failed > > > > + org.bluez.Error.InvalidArgum= ents > > > > + > > > > + void RemoveServiceRecord(uint32 handle) > > > > + > > > > + This method removes the SDP record with the g= iven > > > > + handle from the local SDP server. > > > > + > > > > + Possible errors: org.bluez.Error.NotReady > > > > + org.bluez.Error.DoesNotExist > > > > + org.bluez.Error.Failed > > > > + org.bluez.Error.InvalidArgum= ents > > > > + > > > > > > so when design the BlueZ 5.x APIs, we on purpose didn=E2=80=99t do th= is. You are suppose to use doc/profile-api.txt for these kind of things. > > > > > > I am not in favor of dangling SDP records where we have no lifetime g= uarantee of the service behind it. > > > > > > If you look at profiles/iap/main.c then you see how you could write a= vendor profile just as easily. That one is the skeleton for iOS accessory = protocol over Bluetooth. > > > > > > > Properties string Address [readonly] > > > > > > > > The Bluetooth device address. > > > > diff --git a/doc/device-api.txt b/doc/device-api.txt > > > > index ceb68d2f6..e8f2c670d 100644 > > > > --- a/doc/device-api.txt > > > > +++ b/doc/device-api.txt > > > > @@ -120,6 +120,43 @@ Methods void Connect() > > > > Possible errors: org.bluez.Error.DoesNotExist > > > > org.bluez.Error.Failed > > > > > > > > + array{array{dict}} GetServiceRecords() > > > > + > > > > + This method returns the complete service reco= rds of all > > > > + discovered BR/EDR services of the connected d= evice till > > > > + now. The return value will be an array of an = array of > > > > + dictionary entries. Each nested array of dict= ionary > > > > + entries will contain one service record. Each= pair in > > > > + the returned dictionary entries will represen= t an > > > > + attribute in the service record. > > > > + > > > > + The dictionary entries in the returned array = of entries > > > > + will be of the format: {id : (type, size, val= ue)} where, > > > > + > > > > + uint16 id: The 16 bit attribute ID for a= n > > > > + attribute. > > > > + uint8 type: This will contain the type of= the > > > > + attribute value. Attribute ty= pe values > > > > + are defined in the Bluetooth = spec in > > > > + Volume 3, Part B, 3.2. > > > > + uint32 size: This is the size of the attri= bute > > > > + value. > > > > + variant value: This will contain the attribu= te value > > > > + for a given attribute_id. Thi= s variant > > > > + can either contain a primitiv= e type, or > > > > + if type is SEQUENCE, an array= of struct > > > > + of the signature (type, size,= value). > > > > + > > > > + Since the service record contains the service= UUID and > > > > + name, these fields do not need to be given se= parately. > > > > + This method should be called after the Servic= eResolved > > > > + property for this object has been set to true= otherwise > > > > + it may return a partial or stale cached list. > > > > + > > > > + Possible errors: org.bluez.Error.NotReady > > > > + org.bluez.Error.NotConnected > > > > + org.bluez.Error.Failed > > > > + > > > > > > These two things are not related and do not belong in the same patch.= However what is your goal behind this API since even here we tried not to = give raw SDP to the application. It is all baked into the Profile API. > > > > > > Regards > > > > > > Marcel > > > > > > > -- > Luiz Augusto von Dentz