Project: /_project.yaml Book: /_book.yaml

fuchsia.bluetooth.gatt

PROTOCOLS

RemoteService {:#RemoteService}

Defined in fuchsia.bluetooth.gatt/client.fidl

DiscoverCharacteristics {:#DiscoverCharacteristics}

Returns the characteristics and characteristic descriptors that belong to this service.

Request

Response

ReadCharacteristic {:#ReadCharacteristic}

Reads the value of the characteristic with id and returns it in the reply. If status indicates an error value will be empty.

If the characteristic has a long value (i.e. larger than the current MTU) this method will return only the first (MTU - 1) bytes of the value. Use ReadLongCharacteristic() to read larger values or starting at a non-zero offset.

Request

Response

ReadLongCharacteristic {:#ReadLongCharacteristic}

Reads the complete value of a characteristic with the given id. This procedure should be used if the characteristic is known to have a value that can not be read in a single request.

Returns up to max_bytes octets of the characteristic value starting at the given offset.

This may return an error if: a. max_bytes is 0; b. The offset is invalid; c. The characteristic does not have a long value; d. The server does not support the long read procedure.

Request

Response

WriteCharacteristic {:#WriteCharacteristic}

Writes |value| to the characteristic with |id|. This operation may return an error if: a. The size of |value| exceeds the current MTU. b. The characteristic referred to by |id| does not have the ‘write’ property.

Request

Response

WriteLongCharacteristic {:#WriteLongCharacteristic}

Writes |value| to the characteristic with |id|, beginning at |offset|. This procedure should be used if the value to be written is too long to fit in a single request or needs to be written at an offset. This may return an error if: a. The |offset| is invalid; b. The server does not support the long write procedure.

Long Writes require multiple messages to the remote service and take longer to execute than Short Writes. It is not recommended to send a short write while a long write is in process to the same id and data range. The order of the responses from this function signify the order in which the remote service received them, not necessarily the order in which it is called.

Request

Response

WriteCharacteristicWithoutResponse {:#WriteCharacteristicWithoutResponse}

Writes value to the characteristic with id without soliciting an acknowledgement from the peer. This method has no response and its delivery cannot be confirmed.

Request

ReadDescriptor {:#ReadDescriptor}

Reads the value of the characteristic descriptor with id and returns it in the reply. If status indicates an error, value can be ignored.

If the descriptor has a long value (i.e. larger than the current MTU) this method will return only the first (MTU - 1) bytes of the value. Use ReadLongDescriptor() to read larger values or starting at a non-zero offset.

Request

Response

ReadLongDescriptor {:#ReadLongDescriptor}

Reads the complete value of a characteristic descriptor with the given id. This procedure should be used if the descriptor is known to have a value that can not be read in a single request.

Returns up to max_bytes octets of the characteristic value starting at the given offset.

This may return an error if: a. max_bytes is 0; b. The offset is invalid; c. The server does not support the long read procedure.

Request

Response

WriteDescriptor {:#WriteDescriptor}

Writes |value| to the characteristic descriptor with |id|. This operation may return an error if: a. The size of |value| exceeds the current MTU. b. |id| refers to an internally reserved descriptor type (e.g. the Client Characteristic Configuration descriptor).

Request

Response

WriteLongDescriptor {:#WriteLongDescriptor}

Writes |value| to the characteristic descriptor with |id|, beginning at |offset|. This procedure should be used if the value to be written is too long to fit in a single request or needs to be written at an offset. This may return an error if: a. The |offset| is invalid; b. The server does not support the long write procedure. c. |id| refers to an internally reserved descriptor type (e.g. the Client Characteristic Configuration descriptor).

Long Writes require multiple messages to the remote service and take longer to execute than Short Writes. It is not recommended to send a short write while a long write is in process to the same id and data range. The order of the responses from this function signify the order in which the remote service received them, not necessarily the order in which it is called.

Request

Response

NotifyCharacteristic {:#NotifyCharacteristic}

Subscribe or unsubscribe to notifications/indications from the characteristic with the given id. Notifications or indications will be enabled if enable is true or disabled if enable is false and they have been enabled for this client.

Either notifications or indications will be enabled depending on characteristic properties. Indications will be preferred if they are supported.

This operation fails if the characteristic does not have the “notify” or “indicate” property or does not contain a Client Characteristic Configuration descriptor.

On success, the OnCharacteristicValueUpdated event will be sent whenever the peer sends a notification or indication. The local host will automically confirm indications.

Request

Response

OnCharacteristicValueUpdated {:#OnCharacteristicValueUpdated}

Events: Called when a characteristic value notification or indication is received.

Response

Client {:#Client}

Defined in fuchsia.bluetooth.gatt/client.fidl

ListServices {:#ListServices}

Enumerates services found on the peer that this Client represents. Results can be restricted by specifying a list of UUIDs in uuids. The returned ServiceInfo structures will contain only basic information about each service and the characteristics and includes fields will be null.

To further interact with services, clients must obtain a RemoteService handle by calling ConnectToService().

Request

Response

ConnectToService {:#ConnectToService}

Connects the RemoteService with the given identifier.

Request

LocalServiceDelegate {:#LocalServiceDelegate}

Defined in fuchsia.bluetooth.gatt/server.fidl

Interface for responding to requests on a local service.

OnCharacteristicConfiguration {:#OnCharacteristicConfiguration}

Notifies the delegate when a remote device with peer_id enables or disables notifications or indications on the characteristic with the given characteristic_id.

Request

OnReadValue {:#OnReadValue}

Called when a remote device issues a request to read the value of the of the characteristic or descriptor with given identifier. The delegate must respond to the request by returning the characteristic value. If the read request resulted in an error it should be returned in error_code. On success, error_code should be set to NO_ERROR and a value should be provided.

Request

Response

OnWriteValue {:#OnWriteValue}

Called when a remote device issues a request to write the value of the characteristic or descriptor with the given identifier.

Request

Response

OnWriteWithoutResponse {:#OnWriteWithoutResponse}

Called when a remote device issues a request to write the value of the characteristic with the given identifier. This can be called on a characteristic with the WRITE_WITHOUT_RESPONSE property.

Request

LocalService {:#LocalService}

Defined in fuchsia.bluetooth.gatt/server.fidl

Interface for communicating with a published service.

RemoveService {:#RemoveService}

Removes the service that this interface instance corresponds to. Does nothing if the service is already removed.

Request

NotifyValue {:#NotifyValue}

Sends a notification carrying the value of the characteristic with the given characteristic_id to the device with peer_id.

If confirm is true, then this method sends an indication instead. If the peer fails to confirm the indication, the link between the peer and the local adapter will be closed.

This method has no effect if the peer has not enabled notifications or indications on the requested characteristic.

Request

Server {:#Server}

Defined in fuchsia.bluetooth.gatt/server.fidl

PublishService {:#PublishService}

Publishes the given service so that it is available to all remote peers. A LocalServiceDelegate must be provided over which to receive service requests.

The caller must assign distinct identifiers to the characteristics and descriptors listed in info. These identifiers will be used in requests sent to delegate.

service can be used to interact with the pubished service. If this service cannot be published then the handle for service will be closed.

Returns the success or failure status of the call and a unique identifier that can be used to unregister the service.

Request

Response

RemoteService {:#RemoteService}

Defined in fuchsia.bluetooth.gatt/client.fidl

DiscoverCharacteristics {:#DiscoverCharacteristics}

Returns the characteristics and characteristic descriptors that belong to this service.

Request

Response

ReadCharacteristic {:#ReadCharacteristic}

Reads the value of the characteristic with id and returns it in the reply. If status indicates an error value will be empty.

If the characteristic has a long value (i.e. larger than the current MTU) this method will return only the first (MTU - 1) bytes of the value. Use ReadLongCharacteristic() to read larger values or starting at a non-zero offset.

Request

Response

ReadLongCharacteristic {:#ReadLongCharacteristic}

Reads the complete value of a characteristic with the given id. This procedure should be used if the characteristic is known to have a value that can not be read in a single request.

Returns up to max_bytes octets of the characteristic value starting at the given offset.

This may return an error if: a. max_bytes is 0; b. The offset is invalid; c. The characteristic does not have a long value; d. The server does not support the long read procedure.

Request

Response

WriteCharacteristic {:#WriteCharacteristic}

Writes |value| to the characteristic with |id|. This operation may return an error if: a. The size of |value| exceeds the current MTU. b. The characteristic referred to by |id| does not have the ‘write’ property.

Request

Response

WriteLongCharacteristic {:#WriteLongCharacteristic}

Writes |value| to the characteristic with |id|, beginning at |offset|. This procedure should be used if the value to be written is too long to fit in a single request or needs to be written at an offset. This may return an error if: a. The |offset| is invalid; b. The server does not support the long write procedure.

Long Writes require multiple messages to the remote service and take longer to execute than Short Writes. It is not recommended to send a short write while a long write is in process to the same id and data range. The order of the responses from this function signify the order in which the remote service received them, not necessarily the order in which it is called.

Request

Response

WriteCharacteristicWithoutResponse {:#WriteCharacteristicWithoutResponse}

Writes value to the characteristic with id without soliciting an acknowledgement from the peer. This method has no response and its delivery cannot be confirmed.

Request

ReadDescriptor {:#ReadDescriptor}

Reads the value of the characteristic descriptor with id and returns it in the reply. If status indicates an error, value can be ignored.

If the descriptor has a long value (i.e. larger than the current MTU) this method will return only the first (MTU - 1) bytes of the value. Use ReadLongDescriptor() to read larger values or starting at a non-zero offset.

Request

Response

ReadLongDescriptor {:#ReadLongDescriptor}

Reads the complete value of a characteristic descriptor with the given id. This procedure should be used if the descriptor is known to have a value that can not be read in a single request.

Returns up to max_bytes octets of the characteristic value starting at the given offset.

This may return an error if: a. max_bytes is 0; b. The offset is invalid; c. The server does not support the long read procedure.

Request

Response

WriteDescriptor {:#WriteDescriptor}

Writes |value| to the characteristic descriptor with |id|. This operation may return an error if: a. The size of |value| exceeds the current MTU. b. |id| refers to an internally reserved descriptor type (e.g. the Client Characteristic Configuration descriptor).

Request

Response

WriteLongDescriptor {:#WriteLongDescriptor}

Writes |value| to the characteristic descriptor with |id|, beginning at |offset|. This procedure should be used if the value to be written is too long to fit in a single request or needs to be written at an offset. This may return an error if: a. The |offset| is invalid; b. The server does not support the long write procedure. c. |id| refers to an internally reserved descriptor type (e.g. the Client Characteristic Configuration descriptor).

Long Writes require multiple messages to the remote service and take longer to execute than Short Writes. It is not recommended to send a short write while a long write is in process to the same id and data range. The order of the responses from this function signify the order in which the remote service received them, not necessarily the order in which it is called.

Request

Response

NotifyCharacteristic {:#NotifyCharacteristic}

Subscribe or unsubscribe to notifications/indications from the characteristic with the given id. Notifications or indications will be enabled if enable is true or disabled if enable is false and they have been enabled for this client.

Either notifications or indications will be enabled depending on characteristic properties. Indications will be preferred if they are supported.

This operation fails if the characteristic does not have the “notify” or “indicate” property or does not contain a Client Characteristic Configuration descriptor.

On success, the OnCharacteristicValueUpdated event will be sent whenever the peer sends a notification or indication. The local host will automically confirm indications.

Request

Response

OnCharacteristicValueUpdated {:#OnCharacteristicValueUpdated}

Events: Called when a characteristic value notification or indication is received.

Response

Client {:#Client}

Defined in fuchsia.bluetooth.gatt/client.fidl

ListServices {:#ListServices}

Enumerates services found on the peer that this Client represents. Results can be restricted by specifying a list of UUIDs in uuids. The returned ServiceInfo structures will contain only basic information about each service and the characteristics and includes fields will be null.

To further interact with services, clients must obtain a RemoteService handle by calling ConnectToService().

Request

Response

ConnectToService {:#ConnectToService}

Connects the RemoteService with the given identifier.

Request

LocalServiceDelegate {:#LocalServiceDelegate}

Defined in fuchsia.bluetooth.gatt/server.fidl

Interface for responding to requests on a local service.

OnCharacteristicConfiguration {:#OnCharacteristicConfiguration}

Notifies the delegate when a remote device with peer_id enables or disables notifications or indications on the characteristic with the given characteristic_id.

Request

OnReadValue {:#OnReadValue}

Called when a remote device issues a request to read the value of the of the characteristic or descriptor with given identifier. The delegate must respond to the request by returning the characteristic value. If the read request resulted in an error it should be returned in error_code. On success, error_code should be set to NO_ERROR and a value should be provided.

Request

Response

OnWriteValue {:#OnWriteValue}

Called when a remote device issues a request to write the value of the characteristic or descriptor with the given identifier.

Request

Response

OnWriteWithoutResponse {:#OnWriteWithoutResponse}

Called when a remote device issues a request to write the value of the characteristic with the given identifier. This can be called on a characteristic with the WRITE_WITHOUT_RESPONSE property.

Request

LocalService {:#LocalService}

Defined in fuchsia.bluetooth.gatt/server.fidl

Interface for communicating with a published service.

RemoveService {:#RemoveService}

Removes the service that this interface instance corresponds to. Does nothing if the service is already removed.

Request

NotifyValue {:#NotifyValue}

Sends a notification carrying the value of the characteristic with the given characteristic_id to the device with peer_id.

If confirm is true, then this method sends an indication instead. If the peer fails to confirm the indication, the link between the peer and the local adapter will be closed.

This method has no effect if the peer has not enabled notifications or indications on the requested characteristic.

Request

Server {:#Server}

Defined in fuchsia.bluetooth.gatt/server.fidl

PublishService {:#PublishService}

Publishes the given service so that it is available to all remote peers. A LocalServiceDelegate must be provided over which to receive service requests.

The caller must assign distinct identifiers to the characteristics and descriptors listed in info. These identifiers will be used in requests sent to delegate.

service can be used to interact with the pubished service. If this service cannot be published then the handle for service will be closed.

Returns the success or failure status of the call and a unique identifier that can be used to unregister the service.

Request

Response

STRUCTS

SecurityRequirements {:#SecurityRequirements}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents encryption, authentication, and authorization permissions that can be assigned to a specific access permission.

AttributePermissions {:#AttributePermissions}

Defined in fuchsia.bluetooth.gatt/types.fidl

Specifies the access permissions for a specific attribute value.

This field is ignored for Descriptors.

ServiceInfo {:#ServiceInfo}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT service.

Characteristic {:#Characteristic}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT characteristic.

For local characteristics, this value is mandatory.

Descriptor {:#Descriptor}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT characteristic descriptor.

For local descriptors, this value is mandatory.

SecurityRequirements {:#SecurityRequirements}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents encryption, authentication, and authorization permissions that can be assigned to a specific access permission.

AttributePermissions {:#AttributePermissions}

Defined in fuchsia.bluetooth.gatt/types.fidl

Specifies the access permissions for a specific attribute value.

This field is ignored for Descriptors.

ServiceInfo {:#ServiceInfo}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT service.

Characteristic {:#Characteristic}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT characteristic.

For local characteristics, this value is mandatory.

Descriptor {:#Descriptor}

Defined in fuchsia.bluetooth.gatt/types.fidl

Represents a local or remote GATT characteristic descriptor.

For local descriptors, this value is mandatory.

ENUMS

ErrorCode {:#ErrorCode}

Type: uint32

Defined in fuchsia.bluetooth.gatt/types.fidl

Codes that can be returned in the protocol_error_code field of a bluetooth.Error.

ErrorCode {:#ErrorCode}

Type: uint32

Defined in fuchsia.bluetooth.gatt/types.fidl

Codes that can be returned in the protocol_error_code field of a bluetooth.Error.

CONSTANTS