blob: 5aa668cae2b6af76c4c9a4ca9edc57aff3f076c8 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.bluetooth.gatt2;
// The maximum length of an attribute value.
// From Bluetooth Core Spec v5.2, Vol 3, Part F, 3.2.9.
const MAX_VALUE_LENGTH uint16 = 512;
// The maximum number of attributes that can be contained in an attribute database.
const MAX_ATTRIBUTE_COUNT uint16 = 0xFFFF;
// The maximum number of services allowed. While the specification does not define an upper
// limit, this number is here to impose a bound on FIDL messages.
//
// This number is calculated based on 1 attribute per service declaration for a database that
// contains no characteristics.
const MAX_SERVICE_COUNT uint16 = MAX_ATTRIBUTE_COUNT;
// The maximum number of characteristics allowed. While the specification does not define an upper
// limit, this number is here to impose a bound on FIDL messages.
//
// This number is calculated based on 2 attributes per characteristic and excluding the service
// declaration attribute. I.e. this is the number of characteristics that can be represented in a
// database with a single service and no characteristic descriptors.
const MAX_CHARACTERISTIC_COUNT uint16 = 0x7FFF; // (MAX_ATTRIBUTE_COUNT - 1) / 2;
// The maximum number of characteristic descriptors allowed. While the specification does not define
// an upper limit, this number is here to impose a bound on FIDL messages.
//
// This number is calculated based on 1 attribute per descriptor and excluding the service and
// characteristic declaration attributes. I.e. this is the number of characteristics that can be
// represented in a database with a single service and a single characteristic.
const MAX_DESCRIPTOR_COUNT uint16 = 0xFFFC; // MAX_ATTRIBUTE_COUNT - 3;