| // Copyright 2020 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; |
| |
| // DEPRECATED. Do not use these types in new code. |
| |
| // TODO(fxbug.dev/44616): Remove all usage of the following types and delete them. |
| |
| [Deprecated] |
| struct Bool { |
| bool value; |
| }; |
| |
| [Deprecated] |
| struct Int8 { |
| int8 value; |
| }; |
| |
| [Deprecated] |
| struct UInt16 { |
| uint16 value; |
| }; |
| |
| [Deprecated = "Use protocol specific error enums and zx.status instead"] |
| enum ErrorCode { |
| UNKNOWN = 0; |
| FAILED = 1; |
| CANCELED = 2; |
| IN_PROGRESS = 3; |
| TIMED_OUT = 4; |
| NOT_FOUND = 5; |
| NOT_SUPPORTED = 6; |
| BLUETOOTH_NOT_AVAILABLE = 7; |
| BAD_STATE = 8; |
| INVALID_ARGUMENTS = 9; |
| ALREADY = 10; |
| PROTOCOL_ERROR = 11; |
| }; |
| |
| [Deprecated = "Use protocol specific error enums instead"] |
| // Represents an error result returned from an asynchronous operation. |
| struct Error { |
| // Represents a high-level error code. If this is set to ErrorCode.PROTOCOL_ERROR, then |
| // `protocol_error_code` will represent a Bluetooth protocol error code. The specific |
| // protocol that caused the error will be context-specific, e.g. GATT interfaces will |
| // return ATT protocol error codes. |
| ErrorCode error_code; |
| |
| // Protocol error code. The value of this field is relevant only if `error_code` is set to |
| // ErrorCode.PROTOCOL_ERROR. |
| uint32 protocol_error_code; |
| |
| // Debug descriptioon of an error. This provides additional debugging information for an error |
| // and is not intended to be displayed in user interfaces. |
| string:MAX? description; |
| }; |
| |
| [Deprecated = "Use protocol specific error enums and the 'error' syntax instead"] |
| // Represents the result of an asynchronous operation. |
| struct Status { |
| // `error` will be null if this represents a "success" status, i.e. no error has occurred. |
| Error? error; |
| }; |
| |
| /// The size of the standard string representation for a UUID. This value is based on the canonical |
| /// 36-character 8-4-4-4-12 format defined in IETF RFC4122 Section 3. |
| const uint8 UUID_STRING_REPRESENTATION_LENGTH = 36; |
| |
| [Deprecated = "Use fuchsia.bluetooth/Uuid instead"] |
| alias UuidString = string:UUID_STRING_REPRESENTATION_LENGTH; |
| |
| [Deprecated = "Use fuchsia.bluetooth/PeerId instead"] |
| alias PeerIdString = string:16; |