blob: 5e6bd536cb5c44d319113a43a55e58f068f2ff3e [file] [log] [blame]
// Copyright 2019 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.gatt;
const MAX_VALUE_LENGTH uint16 = 512;
// Maximum number of ReadByTypeResults that fit in a FIDL message.
const MAX_READ_BY_TYPE_RESULTS uint16 = 189;
// From Bluetooth Core Spec v5.2, Vol 3, Part F, 3.4.4.2.
const MAX_READ_BY_TYPE_VALUE_LENGTH uint16 = 253;
// 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;