Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2843402pxb; Sun, 24 Jan 2021 23:16:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxj5YL+Qm8isPh5USn35dWBRAqA5HbOep6/fi+s0z8fwvb6rRks0FnTsMcslHIT4ZM1vmLZ X-Received: by 2002:a50:852a:: with SMTP id 39mr367738edr.114.1611559018938; Sun, 24 Jan 2021 23:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611559018; cv=none; d=google.com; s=arc-20160816; b=DVb587mBtDgRrYXZjIngMHPR1RaL7u7VWch7Od6Q+UTcsYeeoP/Yus52cqft62ilW+ 79blFDl1plEuIKzzixYBWjUG3t8acsJ9Sns7zWM/4CukZ8/+Qja870pYk50yXZDZi+qu rHnPH+xkfqMLbAto+sSEfu+ImeDQio8qFHrJeuKKjcO090wBoZ31kRNRLIQCTm3RkaFA xKLl+NgH4dwFYZ9JWA7SVtGIwaFGjlA51ZNorMPNMkwzCN5jqg2HIuGaq/6gPiQqlJMQ Xx+xM1mrWdTmIGgYw858gu3IuaADp+yY+mFUBZas3varfO2BroBERzvdVcgcwhXH6M1d P6UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VWxPCOWE4nVOCUe330fdsIiyZ6zF5Mqd+3aCb9h18Nc=; b=jS+Y0BvxhygLPTCWS47MfDoWwhL/iw8I9dF/JwdlqEhRe+MdVShl9bZIVvgjvstiOv kKwId9SsJJ0gI6o90emd12UZz0z972+RNpMaJ8mPsDSpHfBxGOjU6ZHZCJV9z7a1o/Pm iTYzLXeq61cOCnIXPnsQtXHax8U/QGSuF7ymUwsiwGSvqF4VDVFo4lilnDBO57etpeJv kZh2CipIV6Ef/hJDCEmcwSaSUCj/MRWHuYWetroNW2wsaC8FPbtM/bK8qmBWFKlT5+jU mcUAvcjFQVIq6BpcdtnMAx50jtzA53kbsUSKcAZc+U/qmUyEsTQt5Lzr6dGdXc5P8+ao jVqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U9wpChPT; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si7157432eds.484.2021.01.24.23.16.18; Sun, 24 Jan 2021 23:16:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U9wpChPT; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726854AbhAYHAc (ORCPT + 99 others); Mon, 25 Jan 2021 02:00:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbhAYGmp (ORCPT ); Mon, 25 Jan 2021 01:42:45 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26B9EC061756 for ; Sun, 24 Jan 2021 22:42:05 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id e17so8989898qto.3 for ; Sun, 24 Jan 2021 22:42:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VWxPCOWE4nVOCUe330fdsIiyZ6zF5Mqd+3aCb9h18Nc=; b=U9wpChPTB/SsSbl62DJ29zy3chleD7of65QEW0O78luygxiONwyqw3coe8W7Y26l+e RiMRXtTjusu3lhc/E+7FoeL+a+SnUoI49vFPvcE3fRpmy3NNwCALGGCjiILFUmng9hqC HyT1G7w+hFOcYH8Jf0VAI2T6SjFzY2m6h3ijnolFoicGFI9q2+WvWppl0XDITv/tvXDb ayVy7yICwjqQnYlqAEyAy8uO7vrA5nfwwWJHkZPsLiUeMPhFVFdE9X3aX1YoCgXgjV/I gikwsxK8IkF0hZ+JXI4YM5Ix2MdGW3L7AKOOpDJAsRL2zNpW1PcyY97GHzgoKqX7uU24 T2Zg== 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; bh=VWxPCOWE4nVOCUe330fdsIiyZ6zF5Mqd+3aCb9h18Nc=; b=A3yYsyUZj7ody/Gyin5p5VujXaT8EiOEoTewyQRa9wwevMVnu+wUrWouOaHlYldlBS Is7aoN+B4Oc+o7M5YmBdYUIYKb/K7WKzOc5cHF8a9g9DsoanuFurjnl5UWS577eECqy+ AUJXZ5O4EAgaso+yo1DS1hJVPr8hp5CxO9khmek3l4EgQqueILbHebrwOboHBnW9JfFL WtOweOcOPRrJB4d/YxQ+mGV/HekQGqEbTBt5AKCtGt6cbBph43ItfIgNtF05RasVi/jx 4dRa/+tITlLcUK9QK4xh+rIIqfRiR/McMWqPs0uCe8A33qCUN7IPJ3V9S1jxEUYSBqtg XRBA== X-Gm-Message-State: AOAM533Rg6OJNDpSEvtd+Y22v5trIifMuYYwY22mDJQwIU41DNBp4z6q CRnc+VgLmaYmfyFNGqKmtTh9fllvsj4GoEnTRw== X-Received: by 2002:ac8:3508:: with SMTP id y8mr90047qtb.58.1611556924225; Sun, 24 Jan 2021 22:42:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kenny Bian Date: Sun, 24 Jan 2021 22:41:48 -0800 Message-ID: Subject: Re: How to add "Service Changed Indication" To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, Thank you so much for your reply. I appreciate it. By "registering the services", do you mean "RegisterApplication()" in https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server#n656? If that is the case, I believe I already registered the services. I checked the files in /var/lib/bluetooth. According to https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/settings-storage.txt#n321, there should be a "[ServiceChanged]" section in the "info" file. But I don't see it in the "info" file. Is there a way to tell the "Service Changed Indication" is actually working? Let's suppose the "Service Changed Indication" is already enabled, is there a way for the mobile app to check on their side to tell which service(s) got changed? Thanks again for your help. On Sun, Jan 24, 2021 at 7:35 PM Luiz Augusto von Dentz wrote: > > Hi Kenny, > > On Sun, Jan 24, 2021 at 12:45 AM Kenny Bian wrote: > > > > Hello, > > > > We implemented a GATT server on Linux in Python. The code is based on > > the code sample(https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-server). > > The BlueZ version is 5.48. But we found a problem. The cached data in > > /var/lib/bluetooth caused the mobile app to crash if some > > characteristics are changed. After some research, we found "Under BLE > > standard 'Generic Attribute'(0x1801), there is a Characteristic > > 'Service Changed' (0x2A05) with 'indicate' property", see > > https://github.com/espressif/esp-idf/issues/1777. > > > > The questions we have: > > How to enable the "Service Changed Indication"(0x2A05) in the > > bluetooth? Is there any code example in Python? > > If you are registering the services with Bluetoothd then it should > generate the service change automatically: > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n1185 > > When a new service is registered it is indicated here: > > https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/gatt-database.c#n1452 > > > -- > Luiz Augusto von Dentz