Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp813019rwb; Thu, 11 Aug 2022 10:17:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR466cI7jfXETnUMEnOBGcUCpDniE8MH3n3Y5lrr3p1BOtj3QPhlCWX5zpLxGJ3VqwFrSxeG X-Received: by 2002:a17:902:bd8a:b0:171:45b8:21b2 with SMTP id q10-20020a170902bd8a00b0017145b821b2mr171548pls.53.1660238274429; Thu, 11 Aug 2022 10:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660238274; cv=none; d=google.com; s=arc-20160816; b=nk+fjtJv+2WYT3gV2a+D7Cv+NogiZyGJVpjiXQMfFP7dk0gtj8uJ3hiL1ZReuHAel3 0Rns7L2Vbgjh3/wILa4IoKWbiM3Wy5dYcbgBJ4QT8oUoVDJfnOXOjcQP80A3V3Sdlttf kCpT4fsvNaZHaZT8vrxUnobsxAOveHxTwaqixOM9hyRRVHV7dyQMmmMSWZ0cwxD4XExX oZ/rTw6zWZLHoruG8xpv5wSIEBeHZ2oOqbDqAJRvEoZrYTvdQhOyUgrYwkTiqo0/6hp4 rQqLx4Fw3SoiUu0pEB8CLDZHPjLCR5DQK2ASF1B4GTA9fbIZaVqcSuF5JtaxGGHq31Q8 Q4ag== 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=e1XhQuKgXhDIRbX6GYRatH3nNLVQwZ4FGZDOa6QbM6A=; b=p7NCV2bkPDK0NpXqsXKTaxlzDdT/j2n9WwGHOKftU1kFm2bqQXkjMiSArLQxcXAspi B1npu5Q5mEZ40y0IZE0jYEncUI4uCMQxA1ouRYnMELnkdd6VgdNjcwaItUEjK4XrVv3X FjV5gi0JaOQhPHKfujPRkm4BYgCQFQq57XsBhN1iWCDAHtYdKy9AGfAiPBffH0/C0ugB u/ZIEUys4M108I4YfQLHPXPTvDLmJVjf+P6Qohq1gGanXU7ewgstxei2LFmC6XscACK4 lh2vFm5zh18wbU7+EqoKomB+zXc+gFzjU6Cs3vGmJqiXDLpA63JmQSXcOe8lglMUdHCT LbVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MY7wTEde; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a632b10000000b0041d9293e847si10873696pgr.828.2022.08.11.10.17.19; Thu, 11 Aug 2022 10:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MY7wTEde; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236488AbiHKRP0 (ORCPT + 99 others); Thu, 11 Aug 2022 13:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235861AbiHKROx (ORCPT ); Thu, 11 Aug 2022 13:14:53 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD0E525DF for ; Thu, 11 Aug 2022 09:59:55 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id y13so34489588ejp.13 for ; Thu, 11 Aug 2022 09:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=e1XhQuKgXhDIRbX6GYRatH3nNLVQwZ4FGZDOa6QbM6A=; b=MY7wTEdes+KKmocrSfpz3B8A43V5h10B899ERNO8pwXJ6y0DHVnUY5PbNNozOGLF7M 4fRrAm7AyBI42zcfoH0wnAFVq6j0oahUIuQ6WMVICcSo2nI4V5TAA1Gk8IQdRVdh2p6m dwTqhNwI4PXKY+j2sPkuPfy7oBY10O0AXXnFvWpVVE7mruJj6r/hkV1NiCaPRSx/lJpS z2pfLYEKyzmz1VpbFv7FEj4s8ekhqCfEMWIkgO0M4G0miDZKRzTTBc1Gb2HTuaFPcz9k yLMigstMq/xwWi48EYDtPA9DUKc20wI+SNMTOBo/C2/z+pseo+GaxrcgHojC0eQsrVUh RwSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=e1XhQuKgXhDIRbX6GYRatH3nNLVQwZ4FGZDOa6QbM6A=; b=cEQTOvlbWrajMCwrxgdDp6UryeK23io98oQ5Kpho0m3kP1uRvY6mzFsw8BmzTNUSmY eBCtGiQrLjzTWDN/J58BtO50EWcQHIGJZCQZsp1XT+IGjiAego4U1c0LzEUAeMND1deO 3xc5Yu2olTdrhUwNgMjzbTf7FvGTTytJxf49zj0YJm/9mQOD1Gn4Kar6GZj6HSzQkYPI Cm7Ci0kTK/LT1fQk0S5lDBWzxTEWtKX/Fb5FVF39Ii0rysoTeeL7yvTgOuS5cdb6w/IK 1WQty6CspdS4AHvYJP5vrOF3yzwmaeM3qpKRxeLai0Y0i/Bij8B0kiXNcnHZogvXEtkL /mTw== X-Gm-Message-State: ACgBeo2+4YV7h47EjElM9nzIbwroeRxV6ERYKeiMYGgPAz3cMneOdAIG 8pDMgJHPY9E+WNjqPLr1sl4akpQGSUPw4v2DCMajkoqJxNI= X-Received: by 2002:a17:906:29d:b0:6f0:18d8:7be0 with SMTP id 29-20020a170906029d00b006f018d87be0mr24268669ejf.561.1660237194282; Thu, 11 Aug 2022 09:59:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Thu, 11 Aug 2022 09:59:42 -0700 Message-ID: Subject: Re: Are Parameter types in GATT meaningless? To: John Klug Cc: Linux-Bluetooth MailingList Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi John, On Thu, Aug 11, 2022 at 8:16 AM John Klug wrote: > > The manufacturer of the GATT service gives the types of two different services: > > uint16 > > uint8[32] > > Should uint16 be uint8[2]? > > > I am using the libgio interface to D-BUS. This uses GVariants. > I am using the WriteValue method of GattCharacteristic1. > > For the uint16 case, I find that if I use: > > (aya{sv}) > > then I do not get an immediate error from a bad parameter type list (signature). > > If I use: > > (qa{sv}) > > Then I get the error: > > Error message: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "WriteValue" with signature "qa{sv}" on interface "org.bluez.GattCharacteristic1" doesn't exist > > For the uint8[32] case I use (aya{sv}) which is what I would expect, and I get no error from the WriteValue. > > Are byte arrays used in all cases with GATT from a D-Bus perspective? > > Here is the message that fails which was logged by dbus-monitor: > > uint16 2 > array [ > dict entry( > string "type" > variant string "request" > ) > ] > error time=1660229364.819130 sender=:1.0 -> destination=:1.197 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=16 > string "Method "WriteValue" with signature "qa{sv}" on interface "org.bluez.GattCharacteristic1" doesn't exist > " > > While this message/parameter list does not provoke an error: > > array of bytes [ > 00 02 > ] > array [ > dict entry( > string "type" > variant string "request" > ) > ] WriteValue always expects a byte array (ay) as the first argument which follows ATT/GATT Write/WriteLong procedures so the attribute specific data need to be encoded as byte array (little-endian), btw this is documented in the D-Bus API and you can check how it done by the likes of bluetoothctl. -- Luiz Augusto von Dentz