Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3482471pxb; Mon, 25 Jan 2021 18:19:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFwx3q2YFjlKmPYF16VD5Hmc098g6eaEzJOVQddbkDv6yVi5drjmqwx1gXXPMbN0x9CDIa X-Received: by 2002:a17:907:3fa6:: with SMTP id hr38mr2139141ejc.24.1611627546207; Mon, 25 Jan 2021 18:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611627546; cv=none; d=google.com; s=arc-20160816; b=kvFzLH0UtfsJclf0Eo08SjM/4waxNq4BD8TmkmmQ+/OXJJyIAr9mjTBxROLFK4G5UA 5m8DQ0tsyJ80h0pNUHm7NpEtJ3NvNu8xjXn3f+cZk+1hdd6o9yDBVTiMDOsPIb16EPi5 hivrPJOUhc2/XayrdY09dqVgciE2rnGKtFuvOPay2oEM53Sc216HIigFPbrjQ6KKMMYF 06NjJaLMD/Qak424ptBUIcCnvIwOXHE1MMRum1kKFmxZ5B+OIXLtkvASRaw1klTcMywY kuvDm25TpqpPstjGWW4osXn25fxepLXe5yKT09UAOFD9kc+VGUL9HoA4RTlT4bEvne0p AP9A== 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=17Laoe1dDWDlB1+A5B/rlzlj0Hpndd49kssrXZqEyA8=; b=vSA4BTHMsZbi+wfdA7ZjVErVg+9KGGvfCxs4gxGGjjxnc0C7lOS42Z4vnrRSqjlyYo m2DIrCyRbu4fWXyumjLF7d49JiPECzvH8io0Evp+iW5PlhKXDphtFfYQV+inTKPDkT1N nQnptm3Ucec9hhi1TvbdPR8hq26g4cg5/AkRDd7V8QEZfA0KbuCW983em7mzSzuB9N0E 3ahEkHFLDBzKOq9UUytJP/rjtsgUG00FMbAcp0PUp4qr4lFsEAUmvMdupB4iSV5blQZp ZvdocDd4sZY+1mczKn17UNXnCheaa/d/LqtpMCv6cvthgrmo1paPkgvyI1AgxH3CJjSf QahQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kGQQIhS8; 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 j8si8148331edt.239.2021.01.25.18.18.23; Mon, 25 Jan 2021 18:19:06 -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=kGQQIhS8; 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 S1730795AbhAYSAY (ORCPT + 99 others); Mon, 25 Jan 2021 13:00:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731325AbhAYR7s (ORCPT ); Mon, 25 Jan 2021 12:59:48 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 475C7C06174A for ; Mon, 25 Jan 2021 09:59:08 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id e70so13570773ote.11 for ; Mon, 25 Jan 2021 09:59:08 -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=17Laoe1dDWDlB1+A5B/rlzlj0Hpndd49kssrXZqEyA8=; b=kGQQIhS8UIZafz0drfq+W/GQ1R8KQ2s+t5ZxASChV3UHBS3Gc/i0zkcIzna2dwhmZl pzJsmRXVECQwbs52i9j4mDnO8EXm7OWJDyRI7DgM9doRxvVOfewLwcEHxegIv8+K4cqe EcREwTjIGwCrWxigYWlNa1xnPPWy8yirbI8DcThbJFVSVUqkZrqHPBoW9s1xqabMpKfE 3o6orQEXGDEdzTAJU0WqFvksbol3hopHJn4AIRhPDdiA+vzpIYGtNRdOYfOd0k0uMJax mJJGmuf0KC3FYtQ4r3sfgacTSfbrzWALpwTP0+F53IZhlGHsZFPaa+l1VspRuls+JuX/ AHZg== 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=17Laoe1dDWDlB1+A5B/rlzlj0Hpndd49kssrXZqEyA8=; b=TP1JFAaJrZAfte5mKh9cUVDMA6+ylsL2KdOUZZgHv4JfromsFz2HZu5NuOxQNB0NU/ Jt2ksDZDMPzQrpMDPHGRaC6iiRAfwtBjT9QEw713jJqfln+Cuzt1/HRkqoeAEoQdBy8o Ot1zLXHj9dGoMVMQenJWp+SF2Ng9e0R1FGoijW3ul3Fs/WqIgndv7r6HshTjGckJqWJX gve8SQwXgz33Obz5wxlnaJCgQpgjAS7CW84CnYOLZXUgIJsTN1/59/Dx+SWreQ96k/23 RQO3pZu81gjCZKWTdeXnBUFMeSMp2mde0/WoUoUvpBfl2R/ue7dMCXMX92xLBCz1OAzc siJw== X-Gm-Message-State: AOAM530kCB8QSnrO6YD6ORAeRgxxmEBxD1QDoBn7ukAgIv5hbHHtEjml gHHCSYt+8exre0CmcoL7EG56phwAMcT+kJzsHEA= X-Received: by 2002:a9d:6f17:: with SMTP id n23mr1257863otq.371.1611597547631; Mon, 25 Jan 2021 09:59:07 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Mon, 25 Jan 2021 09:58:56 -0800 Message-ID: Subject: Re: How to add "Service Changed Indication" To: Kenny Bian 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 Kenny, On Sun, Jan 24, 2021 at 10:42 PM Kenny Bian wrote: > > 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? HCI traces (btmon) should be able to tell you if it has been subscribed or not, if there is an Indication in it it probably means the remote has subscribed. > 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 -- Luiz Augusto von Dentz