att

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2020 License: Apache-2.0, BSD-3-Clause Imports: 9 Imported by: 0

README

Attribute Protocol (ATT)

This package implement Attribute Protocol (ATT) [Vol 3, Part F]

Check list for ATT Server implementation.
  • Error Response [3.4.1.1]
  • Exchange MTU Request [3.4.2.1 & 3.4.2.2]
  • Find Information Request [3.4.3.1 & 3.4.3.2]
  • Find By Type Value Request [3.4.3.3 & 3.4.3.4]
  • Read By Type Request [3.4.4.1 & 3.4.4.2]
  • Read Request [3.4.4.3 & 3.4.4.4]
  • Read Blob Request [3.4.4.5 & 3.4.4.6]
  • Read Multiple Request [3.4.4.7 & 3.4.4.8]
  • Read By Group Type Request [3.4.4.9 & 3.4.4.10]
  • Write Request [3.4.5.1 & 3.4.5.2]
  • Write Command [3.4.5.3]
  • Signed Write Command [3.4.5.4]
  • Prepare Write Request [3.4.6.1 & 3.4.6.2]
  • Execute Write Request [3.4.6.3]
  • Handle Value Notification [3.4.7.1]
  • Handle Value Indication [3.4.7.2 & 3.4.7.3]
Check list for ATT Client implementation.
  • Error Response [3.4.1.1]
  • Exchange MTU Request [3.4.2.1 & 3.4.2.2]
  • Find Information Request [3.4.3.1 & 3.4.3.2]
  • Find By Type Value Request [3.4.3.3 & 3.4.3.4]
  • Read By Type Request [3.4.4.1 & 3.4.4.2]
  • Read Request [3.4.4.3 & 3.4.4.4]
  • Read Blob Request [3.4.4.5 & 3.4.4.6]
  • Read Multiple Request [3.4.4.7 & 3.4.4.8]
  • Read By Group Type Request [3.4.4.9 & 3.4.4.10]
  • Write Request [3.4.5.1 & 3.4.5.2]
  • Write Command [3.4.5.3]
  • Signed Write Command [3.4.5.4]
  • Prepare Write Request [3.4.6.1 & 3.4.6.2]
  • Execute Write Request [3.4.6.3]
  • Handle Value Notification [3.4.7.1]
  • Handle Value Indication [3.4.7.2 & 3.4.7.3]

Documentation

Index

Constants

View Source
const ErrorResponseCode = 0x01

ErrorResponseCode ...

View Source
const ExchangeMTURequestCode = 0x02

ExchangeMTURequestCode ...

View Source
const ExchangeMTUResponseCode = 0x03

ExchangeMTUResponseCode ...

View Source
const ExecuteWriteRequestCode = 0x18

ExecuteWriteRequestCode ...

View Source
const ExecuteWriteResponseCode = 0x19

ExecuteWriteResponseCode ...

View Source
const FindByTypeValueRequestCode = 0x06

FindByTypeValueRequestCode ...

View Source
const FindByTypeValueResponseCode = 0x07

FindByTypeValueResponseCode ...

View Source
const FindInformationRequestCode = 0x04

FindInformationRequestCode ...

View Source
const FindInformationResponseCode = 0x05

FindInformationResponseCode ...

View Source
const HandleValueConfirmationCode = 0x1E

HandleValueConfirmationCode ...

View Source
const HandleValueIndicationCode = 0x1D

HandleValueIndicationCode ...

View Source
const HandleValueNotificationCode = 0x1B

HandleValueNotificationCode ...

View Source
const PrepareWriteRequestCode = 0x16

PrepareWriteRequestCode ...

View Source
const PrepareWriteResponseCode = 0x17

PrepareWriteResponseCode ...

View Source
const ReadBlobRequestCode = 0x0C

ReadBlobRequestCode ...

View Source
const ReadBlobResponseCode = 0x0D

ReadBlobResponseCode ...

View Source
const ReadByGroupTypeRequestCode = 0x10

ReadByGroupTypeRequestCode ...

View Source
const ReadByGroupTypeResponseCode = 0x11

ReadByGroupTypeResponseCode ...

View Source
const ReadByTypeRequestCode = 0x08

ReadByTypeRequestCode ...

View Source
const ReadByTypeResponseCode = 0x09

ReadByTypeResponseCode ...

View Source
const ReadMultipleRequestCode = 0x0E

ReadMultipleRequestCode ...

View Source
const ReadMultipleResponseCode = 0x0F

ReadMultipleResponseCode ...

View Source
const ReadRequestCode = 0x0A

ReadRequestCode ...

View Source
const ReadResponseCode = 0x0B

ReadResponseCode ...

View Source
const SignedWriteCommandCode = 0xD2

SignedWriteCommandCode ...

View Source
const WriteCommandCode = 0x52

WriteCommandCode ...

View Source
const WriteRequestCode = 0x12

WriteRequestCode ...

View Source
const WriteResponseCode = 0x13

WriteResponseCode ...

Variables

View Source
var (
	// ErrInvalidArgument means one or more of the arguments are invalid.
	ErrInvalidArgument = errors.New("invalid argument")

	// ErrInvalidResponse means one or more of the response fields are invalid.
	ErrInvalidResponse = errors.New("invalid response")

	// ErrSeqProtoTimeout means the request hasn't been acknowledged in 30 seconds.
	// [Vol 3, Part F, 3.3.3]
	ErrSeqProtoTimeout = errors.New("req timeout")
)

Functions

func DumpAttributes

func DumpAttributes(aa []*attr)

DumpAttributes ...

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implementa an Attribute Protocol Client.

func NewClient

func NewClient(l2c ble.Conn, h NotificationHandler) *Client

NewClient returns an Attribute Protocol Client.

func (*Client) ExchangeMTU

func (c *Client) ExchangeMTU(clientRxMTU int) (serverRxMTU int, err error)

ExchangeMTU informs the server of the client’s maximum receive MTU size and request the server to respond with its maximum receive MTU size. [Vol 3, Part F, 3.4.2.1]

func (*Client) ExecuteWrite

func (c *Client) ExecuteWrite(flags uint8) error

ExecuteWrite requests the server to write or cancel the write of all the prepared values currently held in the prepare queue from this Client. This request shall be handled by the server as an atomic operation. [Vol 3, Part F, 3.4.6.3 & 3.4.6.4]

func (*Client) FindInformation

func (c *Client) FindInformation(starth, endh uint16) (fmt int, data []byte, err error)

FindInformation obtains the mapping of attribute handles with their associated types. This allows a Client to discover the list of attributes and their types on a server. [Vol 3, Part F, 3.4.3.1 & 3.4.3.2]

func (*Client) Loop

func (c *Client) Loop()

Loop ...

func (*Client) PrepareWrite

func (c *Client) PrepareWrite(handle uint16, offset uint16, value []byte) (uint16, uint16, []byte, error)

PrepareWrite requests the server to prepare to write the value of an attribute. The server will respond to this request with a Prepare Write Response, so that the Client can verify that the value was received correctly. [Vol 3, Part F, 3.4.6.1 & 3.4.6.2]

func (*Client) Read

func (c *Client) Read(handle uint16) ([]byte, error)

Read requests the server to read the value of an attribute and return its value in a Read Response. [Vol 3, Part F, 3.4.4.3 & 3.4.4.4]

func (*Client) ReadBlob

func (c *Client) ReadBlob(handle, offset uint16) ([]byte, error)

ReadBlob requests the server to read part of the value of an attribute at a given offset and return a specific part of the value in a Read Blob Response. [Vol 3, Part F, 3.4.4.5 & 3.4.4.6]

func (*Client) ReadByGroupType

func (c *Client) ReadByGroupType(starth, endh uint16, uuid ble.UUID) (int, []byte, error)

ReadByGroupType obtains the values of attributes where the attribute type is known, the type of a grouping attribute as defined by a higher layer specification, but the handle is not known. [Vol 3, Part F, 3.4.4.9 & 3.4.4.10]

func (*Client) ReadByType

func (c *Client) ReadByType(starth, endh uint16, uuid ble.UUID) (int, []byte, error)

ReadByType obtains the values of attributes where the attribute type is known but the handle is not known. [Vol 3, Part F, 3.4.4.1 & 3.4.4.2]

func (*Client) ReadMultiple

func (c *Client) ReadMultiple(handles []uint16) ([]byte, error)

ReadMultiple requests the server to read two or more values of a set of attributes and return their values in a Read Multiple Response. Only values that have a known fixed size can be read, with the exception of the last value that can have a variable length. The knowledge of whether attributes have a known fixed size is defined in a higher layer specification. [Vol 3, Part F, 3.4.4.7 & 3.4.4.8]

func (*Client) SignedWrite

func (c *Client) SignedWrite(handle uint16, value []byte, signature [12]byte) error

SignedWrite requests the server to write the value of an attribute with an authentication signature, typically into a control-point attribute. [Vol 3, Part F, 3.4.5.4]

func (*Client) Write

func (c *Client) Write(handle uint16, value []byte) error

Write requests the server to write the value of an attribute and acknowledge that this has been achieved in a Write Response. [Vol 3, Part F, 3.4.5.1 & 3.4.5.2]

func (*Client) WriteCommand

func (c *Client) WriteCommand(handle uint16, value []byte) error

WriteCommand requests the server to write the value of an attribute, typically into a control-point attribute. [Vol 3, Part F, 3.4.5.3]

type DB

type DB struct {
	// contains filtered or unexported fields
}

A DB is a contiguous range of attributes.

func NewDB

func NewDB(ss []*ble.Service, base uint16) *DB

NewDB ...

type ErrorResponse

type ErrorResponse []byte

ErrorResponse implements Error Response (0x01) [Vol 3, Part E, 3.4.1.1].

func (ErrorResponse) AttributeInError

func (r ErrorResponse) AttributeInError() uint16

AttributeInError ...

func (ErrorResponse) AttributeOpcode

func (r ErrorResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ErrorResponse) ErrorCode

func (r ErrorResponse) ErrorCode() uint8

ErrorCode ...

func (ErrorResponse) RequestOpcodeInError

func (r ErrorResponse) RequestOpcodeInError() uint8

RequestOpcodeInError ...

func (ErrorResponse) SetAttributeInError

func (r ErrorResponse) SetAttributeInError(v uint16)

SetAttributeInError ...

func (ErrorResponse) SetAttributeOpcode

func (r ErrorResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ErrorResponse) SetErrorCode

func (r ErrorResponse) SetErrorCode(v uint8)

SetErrorCode ...

func (ErrorResponse) SetRequestOpcodeInError

func (r ErrorResponse) SetRequestOpcodeInError(v uint8)

SetRequestOpcodeInError ...

type ExchangeMTURequest

type ExchangeMTURequest []byte

ExchangeMTURequest implements Exchange MTU Request (0x02) [Vol 3, Part E, 3.4.2.1].

func (ExchangeMTURequest) AttributeOpcode

func (r ExchangeMTURequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ExchangeMTURequest) ClientRxMTU

func (r ExchangeMTURequest) ClientRxMTU() uint16

ClientRxMTU ...

func (ExchangeMTURequest) SetAttributeOpcode

func (r ExchangeMTURequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ExchangeMTURequest) SetClientRxMTU

func (r ExchangeMTURequest) SetClientRxMTU(v uint16)

SetClientRxMTU ...

type ExchangeMTUResponse

type ExchangeMTUResponse []byte

ExchangeMTUResponse implements Exchange MTU Response (0x03) [Vol 3, Part E, 3.4.2.2].

func (ExchangeMTUResponse) AttributeOpcode

func (r ExchangeMTUResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ExchangeMTUResponse) ServerRxMTU

func (r ExchangeMTUResponse) ServerRxMTU() uint16

ServerRxMTU ...

func (ExchangeMTUResponse) SetAttributeOpcode

func (r ExchangeMTUResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ExchangeMTUResponse) SetServerRxMTU

func (r ExchangeMTUResponse) SetServerRxMTU(v uint16)

SetServerRxMTU ...

type ExecuteWriteRequest

type ExecuteWriteRequest []byte

ExecuteWriteRequest implements Execute Write Request (0x18) [Vol 3, Part E, 3.4.6.3].

func (ExecuteWriteRequest) AttributeOpcode

func (r ExecuteWriteRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ExecuteWriteRequest) Flags

func (r ExecuteWriteRequest) Flags() uint8

Flags ...

func (ExecuteWriteRequest) SetAttributeOpcode

func (r ExecuteWriteRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ExecuteWriteRequest) SetFlags

func (r ExecuteWriteRequest) SetFlags(v uint8)

SetFlags ...

type ExecuteWriteResponse

type ExecuteWriteResponse []byte

ExecuteWriteResponse implements Execute Write Response (0x19) [Vol 3, Part E, 3.4.6.4].

func (ExecuteWriteResponse) AttributeOpcode

func (r ExecuteWriteResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ExecuteWriteResponse) SetAttributeOpcode

func (r ExecuteWriteResponse) SetAttributeOpcode()

SetAttributeOpcode ...

type FindByTypeValueRequest

type FindByTypeValueRequest []byte

FindByTypeValueRequest implements Find By Type Value Request (0x06) [Vol 3, Part E, 3.4.3.3].

func (FindByTypeValueRequest) AttributeOpcode

func (r FindByTypeValueRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (FindByTypeValueRequest) AttributeType

func (r FindByTypeValueRequest) AttributeType() uint16

AttributeType ...

func (FindByTypeValueRequest) AttributeValue

func (r FindByTypeValueRequest) AttributeValue() []byte

AttributeValue ...

func (FindByTypeValueRequest) EndingHandle

func (r FindByTypeValueRequest) EndingHandle() uint16

EndingHandle ...

func (FindByTypeValueRequest) SetAttributeOpcode

func (r FindByTypeValueRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (FindByTypeValueRequest) SetAttributeType

func (r FindByTypeValueRequest) SetAttributeType(v uint16)

SetAttributeType ...

func (FindByTypeValueRequest) SetAttributeValue

func (r FindByTypeValueRequest) SetAttributeValue(v []byte)

SetAttributeValue ...

func (FindByTypeValueRequest) SetEndingHandle

func (r FindByTypeValueRequest) SetEndingHandle(v uint16)

SetEndingHandle ...

func (FindByTypeValueRequest) SetStartingHandle

func (r FindByTypeValueRequest) SetStartingHandle(v uint16)

SetStartingHandle ...

func (FindByTypeValueRequest) StartingHandle

func (r FindByTypeValueRequest) StartingHandle() uint16

StartingHandle ...

type FindByTypeValueResponse

type FindByTypeValueResponse []byte

FindByTypeValueResponse implements Find By Type Value Response (0x07) [Vol 3, Part E, 3.4.3.4].

func (FindByTypeValueResponse) AttributeOpcode

func (r FindByTypeValueResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (FindByTypeValueResponse) HandleInformationList

func (r FindByTypeValueResponse) HandleInformationList() []byte

HandleInformationList ...

func (FindByTypeValueResponse) SetAttributeOpcode

func (r FindByTypeValueResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (FindByTypeValueResponse) SetHandleInformationList

func (r FindByTypeValueResponse) SetHandleInformationList(v []byte)

SetHandleInformationList ...

type FindInformationRequest

type FindInformationRequest []byte

FindInformationRequest implements Find Information Request (0x04) [Vol 3, Part E, 3.4.3.1].

func (FindInformationRequest) AttributeOpcode

func (r FindInformationRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (FindInformationRequest) EndingHandle

func (r FindInformationRequest) EndingHandle() uint16

EndingHandle ...

func (FindInformationRequest) SetAttributeOpcode

func (r FindInformationRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (FindInformationRequest) SetEndingHandle

func (r FindInformationRequest) SetEndingHandle(v uint16)

SetEndingHandle ...

func (FindInformationRequest) SetStartingHandle

func (r FindInformationRequest) SetStartingHandle(v uint16)

SetStartingHandle ...

func (FindInformationRequest) StartingHandle

func (r FindInformationRequest) StartingHandle() uint16

StartingHandle ...

type FindInformationResponse

type FindInformationResponse []byte

FindInformationResponse implements Find Information Response (0x05) [Vol 3, Part E, 3.4.3.2].

func (FindInformationResponse) AttributeOpcode

func (r FindInformationResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (FindInformationResponse) Format

func (r FindInformationResponse) Format() uint8

Format ...

func (FindInformationResponse) InformationData

func (r FindInformationResponse) InformationData() []byte

InformationData ...

func (FindInformationResponse) SetAttributeOpcode

func (r FindInformationResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (FindInformationResponse) SetFormat

func (r FindInformationResponse) SetFormat(v uint8)

SetFormat ...

func (FindInformationResponse) SetInformationData

func (r FindInformationResponse) SetInformationData(v []byte)

SetInformationData ...

type HandleValueConfirmation

type HandleValueConfirmation []byte

HandleValueConfirmation implements Handle Value Confirmation (0x1E) [Vol 3, Part E, 3.4.7.3].

func (HandleValueConfirmation) AttributeOpcode

func (r HandleValueConfirmation) AttributeOpcode() uint8

AttributeOpcode ...

func (HandleValueConfirmation) SetAttributeOpcode

func (r HandleValueConfirmation) SetAttributeOpcode()

SetAttributeOpcode ...

type HandleValueIndication

type HandleValueIndication []byte

HandleValueIndication implements Handle Value Indication (0x1D) [Vol 3, Part E, 3.4.7.2].

func (HandleValueIndication) AttributeHandle

func (r HandleValueIndication) AttributeHandle() uint16

AttributeHandle ...

func (HandleValueIndication) AttributeOpcode

func (r HandleValueIndication) AttributeOpcode() uint8

AttributeOpcode ...

func (HandleValueIndication) AttributeValue

func (r HandleValueIndication) AttributeValue() []byte

AttributeValue ...

func (HandleValueIndication) SetAttributeHandle

func (r HandleValueIndication) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (HandleValueIndication) SetAttributeOpcode

func (r HandleValueIndication) SetAttributeOpcode()

SetAttributeOpcode ...

func (HandleValueIndication) SetAttributeValue

func (r HandleValueIndication) SetAttributeValue(v []byte)

SetAttributeValue ...

type HandleValueNotification

type HandleValueNotification []byte

HandleValueNotification implements Handle Value Notification (0x1B) [Vol 3, Part E, 3.4.7.1].

func (HandleValueNotification) AttributeHandle

func (r HandleValueNotification) AttributeHandle() uint16

AttributeHandle ...

func (HandleValueNotification) AttributeOpcode

func (r HandleValueNotification) AttributeOpcode() uint8

AttributeOpcode ...

func (HandleValueNotification) AttributeValue

func (r HandleValueNotification) AttributeValue() []byte

AttributeValue ...

func (HandleValueNotification) SetAttributeHandle

func (r HandleValueNotification) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (HandleValueNotification) SetAttributeOpcode

func (r HandleValueNotification) SetAttributeOpcode()

SetAttributeOpcode ...

func (HandleValueNotification) SetAttributeValue

func (r HandleValueNotification) SetAttributeValue(v []byte)

SetAttributeValue ...

type NotificationHandler

type NotificationHandler interface {
	HandleNotification(req []byte)
}

NotificationHandler handles notification or indication.

type PrepareWriteRequest

type PrepareWriteRequest []byte

PrepareWriteRequest implements Prepare Write Request (0x16) [Vol 3, Part E, 3.4.6.1].

func (PrepareWriteRequest) AttributeHandle

func (r PrepareWriteRequest) AttributeHandle() uint16

AttributeHandle ...

func (PrepareWriteRequest) AttributeOpcode

func (r PrepareWriteRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (PrepareWriteRequest) PartAttributeValue

func (r PrepareWriteRequest) PartAttributeValue() []byte

PartAttributeValue ...

func (PrepareWriteRequest) SetAttributeHandle

func (r PrepareWriteRequest) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (PrepareWriteRequest) SetAttributeOpcode

func (r PrepareWriteRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (PrepareWriteRequest) SetPartAttributeValue

func (r PrepareWriteRequest) SetPartAttributeValue(v []byte)

SetPartAttributeValue ...

func (PrepareWriteRequest) SetValueOffset

func (r PrepareWriteRequest) SetValueOffset(v uint16)

SetValueOffset ...

func (PrepareWriteRequest) ValueOffset

func (r PrepareWriteRequest) ValueOffset() uint16

ValueOffset ...

type PrepareWriteResponse

type PrepareWriteResponse []byte

PrepareWriteResponse implements Prepare Write Response (0x17) [Vol 3, Part E, 3.4.6.2].

func (PrepareWriteResponse) AttributeHandle

func (r PrepareWriteResponse) AttributeHandle() uint16

AttributeHandle ...

func (PrepareWriteResponse) AttributeOpcode

func (r PrepareWriteResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (PrepareWriteResponse) PartAttributeValue

func (r PrepareWriteResponse) PartAttributeValue() []byte

PartAttributeValue ...

func (PrepareWriteResponse) SetAttributeHandle

func (r PrepareWriteResponse) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (PrepareWriteResponse) SetAttributeOpcode

func (r PrepareWriteResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (PrepareWriteResponse) SetPartAttributeValue

func (r PrepareWriteResponse) SetPartAttributeValue(v []byte)

SetPartAttributeValue ...

func (PrepareWriteResponse) SetValueOffset

func (r PrepareWriteResponse) SetValueOffset(v uint16)

SetValueOffset ...

func (PrepareWriteResponse) ValueOffset

func (r PrepareWriteResponse) ValueOffset() uint16

ValueOffset ...

type ReadBlobRequest

type ReadBlobRequest []byte

ReadBlobRequest implements Read Blob Request (0x0C) [Vol 3, Part E, 3.4.4.5].

func (ReadBlobRequest) AttributeHandle

func (r ReadBlobRequest) AttributeHandle() uint16

AttributeHandle ...

func (ReadBlobRequest) AttributeOpcode

func (r ReadBlobRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadBlobRequest) SetAttributeHandle

func (r ReadBlobRequest) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (ReadBlobRequest) SetAttributeOpcode

func (r ReadBlobRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadBlobRequest) SetValueOffset

func (r ReadBlobRequest) SetValueOffset(v uint16)

SetValueOffset ...

func (ReadBlobRequest) ValueOffset

func (r ReadBlobRequest) ValueOffset() uint16

ValueOffset ...

type ReadBlobResponse

type ReadBlobResponse []byte

ReadBlobResponse implements Read Blob Response (0x0D) [Vol 3, Part E, 3.4.4.6].

func (ReadBlobResponse) AttributeOpcode

func (r ReadBlobResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadBlobResponse) PartAttributeValue

func (r ReadBlobResponse) PartAttributeValue() []byte

PartAttributeValue ...

func (ReadBlobResponse) SetAttributeOpcode

func (r ReadBlobResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadBlobResponse) SetPartAttributeValue

func (r ReadBlobResponse) SetPartAttributeValue(v []byte)

SetPartAttributeValue ...

type ReadByGroupTypeRequest

type ReadByGroupTypeRequest []byte

ReadByGroupTypeRequest implements Read By Group Type Request (0x10) [Vol 3, Part E, 3.4.4.9].

func (ReadByGroupTypeRequest) AttributeGroupType

func (r ReadByGroupTypeRequest) AttributeGroupType() []byte

AttributeGroupType ...

func (ReadByGroupTypeRequest) AttributeOpcode

func (r ReadByGroupTypeRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadByGroupTypeRequest) EndingHandle

func (r ReadByGroupTypeRequest) EndingHandle() uint16

EndingHandle ...

func (ReadByGroupTypeRequest) SetAttributeGroupType

func (r ReadByGroupTypeRequest) SetAttributeGroupType(v []byte)

SetAttributeGroupType ...

func (ReadByGroupTypeRequest) SetAttributeOpcode

func (r ReadByGroupTypeRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadByGroupTypeRequest) SetEndingHandle

func (r ReadByGroupTypeRequest) SetEndingHandle(v uint16)

SetEndingHandle ...

func (ReadByGroupTypeRequest) SetStartingHandle

func (r ReadByGroupTypeRequest) SetStartingHandle(v uint16)

SetStartingHandle ...

func (ReadByGroupTypeRequest) StartingHandle

func (r ReadByGroupTypeRequest) StartingHandle() uint16

StartingHandle ...

type ReadByGroupTypeResponse

type ReadByGroupTypeResponse []byte

ReadByGroupTypeResponse implements Read By Group Type Response (0x11) [Vol 3, Part E, 3.4.4.10].

func (ReadByGroupTypeResponse) AttributeDataList

func (r ReadByGroupTypeResponse) AttributeDataList() []byte

AttributeDataList ...

func (ReadByGroupTypeResponse) AttributeOpcode

func (r ReadByGroupTypeResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadByGroupTypeResponse) Length

func (r ReadByGroupTypeResponse) Length() uint8

Length ...

func (ReadByGroupTypeResponse) SetAttributeDataList

func (r ReadByGroupTypeResponse) SetAttributeDataList(v []byte)

SetAttributeDataList ...

func (ReadByGroupTypeResponse) SetAttributeOpcode

func (r ReadByGroupTypeResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadByGroupTypeResponse) SetLength

func (r ReadByGroupTypeResponse) SetLength(v uint8)

SetLength ...

type ReadByTypeRequest

type ReadByTypeRequest []byte

ReadByTypeRequest implements Read By Type Request (0x08) [Vol 3, Part E, 3.4.4.1].

func (ReadByTypeRequest) AttributeOpcode

func (r ReadByTypeRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadByTypeRequest) AttributeType

func (r ReadByTypeRequest) AttributeType() []byte

AttributeType ...

func (ReadByTypeRequest) EndingHandle

func (r ReadByTypeRequest) EndingHandle() uint16

EndingHandle ...

func (ReadByTypeRequest) SetAttributeOpcode

func (r ReadByTypeRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadByTypeRequest) SetAttributeType

func (r ReadByTypeRequest) SetAttributeType(v []byte)

SetAttributeType ...

func (ReadByTypeRequest) SetEndingHandle

func (r ReadByTypeRequest) SetEndingHandle(v uint16)

SetEndingHandle ...

func (ReadByTypeRequest) SetStartingHandle

func (r ReadByTypeRequest) SetStartingHandle(v uint16)

SetStartingHandle ...

func (ReadByTypeRequest) StartingHandle

func (r ReadByTypeRequest) StartingHandle() uint16

StartingHandle ...

type ReadByTypeResponse

type ReadByTypeResponse []byte

ReadByTypeResponse implements Read By Type Response (0x09) [Vol 3, Part E, 3.4.4.2].

func (ReadByTypeResponse) AttributeDataList

func (r ReadByTypeResponse) AttributeDataList() []byte

AttributeDataList ...

func (ReadByTypeResponse) AttributeOpcode

func (r ReadByTypeResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadByTypeResponse) Length

func (r ReadByTypeResponse) Length() uint8

Length ...

func (ReadByTypeResponse) SetAttributeDataList

func (r ReadByTypeResponse) SetAttributeDataList(v []byte)

SetAttributeDataList ...

func (ReadByTypeResponse) SetAttributeOpcode

func (r ReadByTypeResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadByTypeResponse) SetLength

func (r ReadByTypeResponse) SetLength(v uint8)

SetLength ...

type ReadMultipleRequest

type ReadMultipleRequest []byte

ReadMultipleRequest implements Read Multiple Request (0x0E) [Vol 3, Part E, 3.4.4.7].

func (ReadMultipleRequest) AttributeOpcode

func (r ReadMultipleRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadMultipleRequest) SetAttributeOpcode

func (r ReadMultipleRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadMultipleRequest) SetOfHandles

func (r ReadMultipleRequest) SetOfHandles() []byte

SetOfHandles ...

func (ReadMultipleRequest) SetSetOfHandles

func (r ReadMultipleRequest) SetSetOfHandles(v []byte)

SetSetOfHandles ...

type ReadMultipleResponse

type ReadMultipleResponse []byte

ReadMultipleResponse implements Read Multiple Response (0x0F) [Vol 3, Part E, 3.4.4.8].

func (ReadMultipleResponse) AttributeOpcode

func (r ReadMultipleResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadMultipleResponse) SetAttributeOpcode

func (r ReadMultipleResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadMultipleResponse) SetOfValues

func (r ReadMultipleResponse) SetOfValues() []byte

SetOfValues ...

func (ReadMultipleResponse) SetSetOfValues

func (r ReadMultipleResponse) SetSetOfValues(v []byte)

SetSetOfValues ...

type ReadRequest

type ReadRequest []byte

ReadRequest implements Read Request (0x0A) [Vol 3, Part E, 3.4.4.3].

func (ReadRequest) AttributeHandle

func (r ReadRequest) AttributeHandle() uint16

AttributeHandle ...

func (ReadRequest) AttributeOpcode

func (r ReadRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadRequest) SetAttributeHandle

func (r ReadRequest) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (ReadRequest) SetAttributeOpcode

func (r ReadRequest) SetAttributeOpcode()

SetAttributeOpcode ...

type ReadResponse

type ReadResponse []byte

ReadResponse implements Read Response (0x0B) [Vol 3, Part E, 3.4.4.4].

func (ReadResponse) AttributeOpcode

func (r ReadResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (ReadResponse) AttributeValue

func (r ReadResponse) AttributeValue() []byte

AttributeValue ...

func (ReadResponse) SetAttributeOpcode

func (r ReadResponse) SetAttributeOpcode()

SetAttributeOpcode ...

func (ReadResponse) SetAttributeValue

func (r ReadResponse) SetAttributeValue(v []byte)

SetAttributeValue ...

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements an ATT (Attribute Protocol) server.

func NewServer

func NewServer(db *DB, l2c ble.Conn) (*Server, error)

NewServer returns an ATT (Attribute Protocol) server.

func (*Server) Loop

func (s *Server) Loop()

Loop accepts incoming ATT request, and respond response.

type SignedWriteCommand

type SignedWriteCommand []byte

SignedWriteCommand implements Signed Write Command (0xD2) [Vol 3, Part E, 3.4.5.4].

func (SignedWriteCommand) AttributeHandle

func (r SignedWriteCommand) AttributeHandle() uint16

AttributeHandle ...

func (SignedWriteCommand) AttributeOpcode

func (r SignedWriteCommand) AttributeOpcode() uint8

AttributeOpcode ...

func (SignedWriteCommand) AttributeValue

func (r SignedWriteCommand) AttributeValue() []byte

AttributeValue ...

func (SignedWriteCommand) AuthenticationSignature

func (r SignedWriteCommand) AuthenticationSignature() [12]byte

AuthenticationSignature ...

func (SignedWriteCommand) SetAttributeHandle

func (r SignedWriteCommand) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (SignedWriteCommand) SetAttributeOpcode

func (r SignedWriteCommand) SetAttributeOpcode()

SetAttributeOpcode ...

func (SignedWriteCommand) SetAttributeValue

func (r SignedWriteCommand) SetAttributeValue(v []byte)

SetAttributeValue ...

func (SignedWriteCommand) SetAuthenticationSignature

func (r SignedWriteCommand) SetAuthenticationSignature(v [12]byte)

SetAuthenticationSignature ...

type WriteCommand

type WriteCommand []byte

WriteCommand implements Write Command (0x52) [Vol 3, Part E, 3.4.5.3].

func (WriteCommand) AttributeHandle

func (r WriteCommand) AttributeHandle() uint16

AttributeHandle ...

func (WriteCommand) AttributeOpcode

func (r WriteCommand) AttributeOpcode() uint8

AttributeOpcode ...

func (WriteCommand) AttributeValue

func (r WriteCommand) AttributeValue() []byte

AttributeValue ...

func (WriteCommand) SetAttributeHandle

func (r WriteCommand) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (WriteCommand) SetAttributeOpcode

func (r WriteCommand) SetAttributeOpcode()

SetAttributeOpcode ...

func (WriteCommand) SetAttributeValue

func (r WriteCommand) SetAttributeValue(v []byte)

SetAttributeValue ...

type WriteRequest

type WriteRequest []byte

WriteRequest implements Write Request (0x12) [Vol 3, Part E, 3.4.5.1].

func (WriteRequest) AttributeHandle

func (r WriteRequest) AttributeHandle() uint16

AttributeHandle ...

func (WriteRequest) AttributeOpcode

func (r WriteRequest) AttributeOpcode() uint8

AttributeOpcode ...

func (WriteRequest) AttributeValue

func (r WriteRequest) AttributeValue() []byte

AttributeValue ...

func (WriteRequest) SetAttributeHandle

func (r WriteRequest) SetAttributeHandle(v uint16)

SetAttributeHandle ...

func (WriteRequest) SetAttributeOpcode

func (r WriteRequest) SetAttributeOpcode()

SetAttributeOpcode ...

func (WriteRequest) SetAttributeValue

func (r WriteRequest) SetAttributeValue(v []byte)

SetAttributeValue ...

type WriteResponse

type WriteResponse []byte

WriteResponse implements Write Response (0x13) [Vol 3, Part E, 3.4.5.2].

func (WriteResponse) AttributeOpcode

func (r WriteResponse) AttributeOpcode() uint8

AttributeOpcode ...

func (WriteResponse) SetAttributeOpcode

func (r WriteResponse) SetAttributeOpcode()

SetAttributeOpcode ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL