Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2753386pxb; Sun, 24 Jan 2021 19:38:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpzKUndCVVW3zpwW5PbCXxL3Ui/FIwhoU4luydYaq0YUJPOZC/FG241PAWzJhYTiJCqk2K X-Received: by 2002:a17:906:154d:: with SMTP id c13mr60948ejd.471.1611545932600; Sun, 24 Jan 2021 19:38:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611545932; cv=none; d=google.com; s=arc-20160816; b=e7ry3ndtDwRNElJnlv1xzVbCe2S2zXNOITyt0GEhjoJWwfMLW1t++CSPlVTYLOLAKI btIIFnT8uG6wdp2h6jj1/dycVz+KU0JLVPMyipSiiMCVuCrE9FwgM5/PZ1UmoWlYjF6i NL5PU97X6Dc/C5edsek5mcwuzogtGPbc50YM7qDk4r/7jiXkrRjIpHRA2xazB3BFLlIm MBK3eJPP9qNLBJeO5GQRa/DdyiVF/YoSN9hheesGuuBj0rT6MuLWeTrGjBgEOwnYVcBf cY4jDeFMR6DPtfJXgacOE5TXaYQFYp541u5d6HL47FImdO6eE/lCvWBG707eb6ODpgKW YuXw== 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=sWCIZkNG9V5891xrVruyNqQCmhK58wXe75MOyr6ERJw=; b=r5mQEimfIz6bikAgMn6VyL9lt3AJ8xmUh4bwuHxFU8PzQAx+esfwHnMfSi1mN5sy0M t2HE8vffL0LA+oqRd7S3+yZpi9MUH0gnraLV/5tbH6VkFMsSzkpN+0fva9td9btUvkbA JmyrzmwBKqf+W96afGf3AaDKmCnHfIyTKHC2ZoRFQ10/nSDOojNK5+/RA3T45+f2/MMi 0p292w8dD8ZoTogDIANRMt/HvlBpm8vUVAMjlUtN+1nSX2uJCzhEXmNCj8EU3webTK6d oY9ubCSoHPWDCUvp+BAwO+M+Ij7iGYG4lt4tKtCwzQDgrXDZfCDkzlYOdnVf5z3AOtDv ABhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jCCCcesq; 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 d30si7313399edd.488.2021.01.24.19.38.08; Sun, 24 Jan 2021 19:38:52 -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=jCCCcesq; 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 S1726707AbhAYDgR (ORCPT + 99 others); Sun, 24 Jan 2021 22:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbhAYDgP (ORCPT ); Sun, 24 Jan 2021 22:36:15 -0500 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E31C061573 for ; Sun, 24 Jan 2021 19:35:35 -0800 (PST) Received: by mail-ot1-x332.google.com with SMTP id 36so11489093otp.2 for ; Sun, 24 Jan 2021 19:35:35 -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=sWCIZkNG9V5891xrVruyNqQCmhK58wXe75MOyr6ERJw=; b=jCCCcesqWXFGWL98nemCjnWrOjrF5+8FAYgxaAAeQZkJcY3yysNUMdPNNLmm4JO2o1 +NyZ5Q6aUqSmtpef9cxUPaUSvsvlhYgcjq8upnlbwl2GyZzJSLLxX3OJC8xGo/B+Rjtf jKVdUefeZmYk36Iaw9QNGhgWccXFhllRmeexbisPn5X6OXi7rEtmdcxL1UPj011aiXye 0LdE1f8y2EQb7hDli/dtJavmYScwK/mnddwE5vkVmJn22ysPUYrmJXhEInhs5QRavzkv DVDbA8Q2bqfq469e9sT0DkTQmjS6FxbAXaVXu4XSfM/VaEOhBIzVJqyT7ggzotPK33mP OpjA== 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=sWCIZkNG9V5891xrVruyNqQCmhK58wXe75MOyr6ERJw=; b=oZmaCKiAGQWaMiCPPMzATwvTdlPkKkznAUa5wxp2MzZ0M2iw519ghr5bTRGK6+dgf9 O21eXiOyyXZrraEx+S4zxymZOVNgN0jZcrVswaUxLP0FQdn0EBY1CYEbrlsJfcinztI8 rfgydC6COALP/JvswtAxd+uzjPkDqQZScx8rFTqwCB8oa3vc33wc6UaYtpzsW2S2emRh T5iFPephp3nT5XA/exobvI407BYbQL5cIzZAMMpBlHidA7uelTi/dtGGDQLOaUOQ6nkC eySAEJTF1cvqE5/9k7CKuCrSzDWtXQ9SZIgpN6d5LUV1I6BuFIv437qg9nx8yzUWkw/V cSNw== X-Gm-Message-State: AOAM530feOvp8wWXn3KoMkspxFOAOreiWhqmIR9GMKst8GOXF4P1wki7 2sz0smcpxWvWjDuN1HSmtMBjGIVxmbSu5H3oqg0= X-Received: by 2002:a9d:2035:: with SMTP id n50mr10428908ota.44.1611545734757; Sun, 24 Jan 2021 19:35:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Sun, 24 Jan 2021 19:35:23 -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 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