Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1040929pxb; Sun, 21 Feb 2021 09:13:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxa2rq5vX6eWxLXDvNJTIz4fybk119W1AeaB6WT63qvlLm253LxJtN8CCoUNWy60OLIZW7R X-Received: by 2002:a17:906:3510:: with SMTP id r16mr17727296eja.186.1613927621973; Sun, 21 Feb 2021 09:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613927621; cv=none; d=google.com; s=arc-20160816; b=VzIQSW8PWFvjL1ldgiBcq/mvWtfkJV3txSJEm7QD0x+7sJ2rCFytwiTdGI+kx5i+OQ fvp8BgslofrndVlnYImEmYEdyhsuQtmvqsNXX2MoNavTZvF5xHlZOSukQT9vdDPGDB3b pX9414/iyWMGlsOBu1xLEWn8unB4SH/ioF7ReCnoS+64cPS/4QqX5/J+Pud0SSdevYhs K8n+BWwjhxE8OuiKQKXzoD7FXkqjaXBJ6HAZtPVxap/ZkJot7Uyw2JpOwwVANzg+8FEh Gf3wnDtE4at5wiJpC74cuvw6WqkufeJz+a5H4WMhUCkyEYBSlWDf7atR/ldltFO2v0+U i4uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=LUwq9McKGOH7NmhhUxJz0Q2jGTHs6WYitlmw6zqnvkA=; b=f8EZYQxvHi91AZnbBVPRfg57RBFUSINia2MmfrdZQDfG4hI++MZoQXnA1lm/Mxo9Zn iOUDFsRzWMinTzntKqvBsEdZaG8if9bpojRFtcQpeMFcGhnFO96B25cicJd5bztHqT7I 6QJGsmX8/HRdr7hJ0Sleezew3ZPuzvbo9z803Pn+yeHe/gSjh0fSP0b+ykswMIUg7Kia iyQzyvQ45zM5SLbB7AtdKc1SsoQWec14ub7M8HQq/gqNsFNJZN6ktqeBP/cS+/z03QlA UfS1rnq47P0kRvLuc+jUIh9AdRIByFMcw5cGprojrVG/Swsz8CNQYdLvh27a6h+MGQ5/ 29Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ng6YZ5Ac; 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 26si8243561edw.488.2021.02.21.09.12.58; Sun, 21 Feb 2021 09:13:41 -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=ng6YZ5Ac; 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 S230074AbhBURKs (ORCPT + 99 others); Sun, 21 Feb 2021 12:10:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbhBURKr (ORCPT ); Sun, 21 Feb 2021 12:10:47 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0895C061786 for ; Sun, 21 Feb 2021 09:10:06 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id v15so16637080wrx.4 for ; Sun, 21 Feb 2021 09:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=LUwq9McKGOH7NmhhUxJz0Q2jGTHs6WYitlmw6zqnvkA=; b=ng6YZ5AcO4FJQqk/qbyJMzHE4mDbg+P7n2Fh1bs/dqQ9E0eBKEPCiROL4yBqd/Ib3t ssLV0Vn4nW+uKMb8dXWTVywGmYAwVRbG4+dwX+GbLf5orhK6B55XWjpIq+0XobQ8GXU7 b2/RIXJxrlx+frcInjOw+h67bwdm9Ec+5olwICc7PxtsND0M7GoWBc8E4vasRetS4xh7 R/52VRzjlF7MVkqK76gDAEFwLKKY5iO+3xX87KyIMxuuKnEM75XgmhbWJcUIw+vWUiEa c88CUDf3Tl6nOOXWRAPC+otXS8KW2rV1fMmqUvIcnBlwxvCj6HRk8x4/na4m5vIZJf5G wkqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LUwq9McKGOH7NmhhUxJz0Q2jGTHs6WYitlmw6zqnvkA=; b=oymgUf3chZeoNaX4g4PUCUChC9FPjEIIdfWaxWF6C8Zu2AgK9zNGSxB0Z7Nfd5ubkO ElpVdUJ387zovpCoWyi4r3bpF5hMtu6zo4Tnfiii1B7RK1le/l0rOxJ32qBsV4UgT31z 9i+CwkmMJTYp8ji/wETDzJMqqtgS/rTbLfhvWrP4soqi46XaCn2nyLZRmPGfQ8LRG36D MEruBJrvsM8M/niJVVTf1XpOcKA0o4uQqcxoQ+k4CxCOQLCmntqeKt1M33B9wAzI4NWA wssAfxZqjJbWj+3dToVC05bWrfr3lk4iFVQPC30dXiOB+rWNDONSTGskd6fnhJBi5ttE jR2Q== X-Gm-Message-State: AOAM533dkKUUaE1MotBJkOGzmw2Wo6ufBhIxHqbza1EgnOVNbZ3T1HMe kCeJMVmMu2uG+X4q/yes2H3lt7eAp7bShMsj0CZIy/EcS/1aEoBK X-Received: by 2002:adf:ee0a:: with SMTP id y10mr14323625wrn.79.1613927404991; Sun, 21 Feb 2021 09:10:04 -0800 (PST) MIME-Version: 1.0 From: Mihai Emilian Date: Sun, 21 Feb 2021 18:09:54 +0100 Message-ID: Subject: How to receive notifications after calling StartNotify To: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Dear linux-bluetooth community, I am writing a bluetooth client in C which receives notifications from a bluetooth device (server). I am able to call StartNotify() from the bluez api and the Notifying property changes to true. However, I am not sure how I should listen for the notifications, or where. There are several questions: a) How do I provide a callback function to this? b) async or sync method call? Does it matter? c) Do I need the main loop to do this and why? Here's my source code https://pastebin.com/KEGTatsL Is there an example? I tried looking at the different files such as client in bluez kernel source and gatttool source, but I couldn't figure this out. Many thanks, Regards, Mihai