Versions in this module Expand all Collapse all v0 v0.0.2 Mar 5, 2020 v0.0.1 May 13, 2019 Changes in this version + const ErrorResponseCode + const ExchangeMTURequestCode + const ExchangeMTUResponseCode + const ExecuteWriteRequestCode + const ExecuteWriteResponseCode + const FindByTypeValueRequestCode + const FindByTypeValueResponseCode + const FindInformationRequestCode + const FindInformationResponseCode + const HandleValueConfirmationCode + const HandleValueIndicationCode + const HandleValueNotificationCode + const PrepareWriteRequestCode + const PrepareWriteResponseCode + const ReadBlobRequestCode + const ReadBlobResponseCode + const ReadByGroupTypeRequestCode + const ReadByGroupTypeResponseCode + const ReadByTypeRequestCode + const ReadByTypeResponseCode + const ReadMultipleRequestCode + const ReadMultipleResponseCode + const ReadRequestCode + const ReadResponseCode + const SignedWriteCommandCode + const WriteCommandCode + const WriteRequestCode + const WriteResponseCode + var ErrInvalidArgument = errors.New("invalid argument") + var ErrInvalidResponse = errors.New("invalid response") + var ErrSeqProtoTimeout = errors.New("req timeout") + func DumpAttributes(aa []*attr) + type Client struct + func NewClient(l2c ble.Conn, h NotificationHandler) *Client + func (c *Client) ExchangeMTU(clientRxMTU int) (serverRxMTU int, err error) + func (c *Client) ExecuteWrite(flags uint8) error + func (c *Client) FindInformation(starth, endh uint16) (fmt int, data []byte, err error) + func (c *Client) Loop() + func (c *Client) PrepareWrite(handle uint16, offset uint16, value []byte) (uint16, uint16, []byte, error) + func (c *Client) Read(handle uint16) ([]byte, error) + func (c *Client) ReadBlob(handle, offset uint16) ([]byte, error) + func (c *Client) ReadByGroupType(starth, endh uint16, uuid ble.UUID) (int, []byte, error) + func (c *Client) ReadByType(starth, endh uint16, uuid ble.UUID) (int, []byte, error) + func (c *Client) ReadMultiple(handles []uint16) ([]byte, error) + func (c *Client) SignedWrite(handle uint16, value []byte, signature [12]byte) error + func (c *Client) Write(handle uint16, value []byte) error + func (c *Client) WriteCommand(handle uint16, value []byte) error + type DB struct + func NewDB(ss []*ble.Service, base uint16) *DB + type ErrorResponse []byte + func (r ErrorResponse) AttributeInError() uint16 + func (r ErrorResponse) AttributeOpcode() uint8 + func (r ErrorResponse) ErrorCode() uint8 + func (r ErrorResponse) RequestOpcodeInError() uint8 + func (r ErrorResponse) SetAttributeInError(v uint16) + func (r ErrorResponse) SetAttributeOpcode() + func (r ErrorResponse) SetErrorCode(v uint8) + func (r ErrorResponse) SetRequestOpcodeInError(v uint8) + type ExchangeMTURequest []byte + func (r ExchangeMTURequest) AttributeOpcode() uint8 + func (r ExchangeMTURequest) ClientRxMTU() uint16 + func (r ExchangeMTURequest) SetAttributeOpcode() + func (r ExchangeMTURequest) SetClientRxMTU(v uint16) + type ExchangeMTUResponse []byte + func (r ExchangeMTUResponse) AttributeOpcode() uint8 + func (r ExchangeMTUResponse) ServerRxMTU() uint16 + func (r ExchangeMTUResponse) SetAttributeOpcode() + func (r ExchangeMTUResponse) SetServerRxMTU(v uint16) + type ExecuteWriteRequest []byte + func (r ExecuteWriteRequest) AttributeOpcode() uint8 + func (r ExecuteWriteRequest) Flags() uint8 + func (r ExecuteWriteRequest) SetAttributeOpcode() + func (r ExecuteWriteRequest) SetFlags(v uint8) + type ExecuteWriteResponse []byte + func (r ExecuteWriteResponse) AttributeOpcode() uint8 + func (r ExecuteWriteResponse) SetAttributeOpcode() + type FindByTypeValueRequest []byte + func (r FindByTypeValueRequest) AttributeOpcode() uint8 + func (r FindByTypeValueRequest) AttributeType() uint16 + func (r FindByTypeValueRequest) AttributeValue() []byte + func (r FindByTypeValueRequest) EndingHandle() uint16 + func (r FindByTypeValueRequest) SetAttributeOpcode() + func (r FindByTypeValueRequest) SetAttributeType(v uint16) + func (r FindByTypeValueRequest) SetAttributeValue(v []byte) + func (r FindByTypeValueRequest) SetEndingHandle(v uint16) + func (r FindByTypeValueRequest) SetStartingHandle(v uint16) + func (r FindByTypeValueRequest) StartingHandle() uint16 + type FindByTypeValueResponse []byte + func (r FindByTypeValueResponse) AttributeOpcode() uint8 + func (r FindByTypeValueResponse) HandleInformationList() []byte + func (r FindByTypeValueResponse) SetAttributeOpcode() + func (r FindByTypeValueResponse) SetHandleInformationList(v []byte) + type FindInformationRequest []byte + func (r FindInformationRequest) AttributeOpcode() uint8 + func (r FindInformationRequest) EndingHandle() uint16 + func (r FindInformationRequest) SetAttributeOpcode() + func (r FindInformationRequest) SetEndingHandle(v uint16) + func (r FindInformationRequest) SetStartingHandle(v uint16) + func (r FindInformationRequest) StartingHandle() uint16 + type FindInformationResponse []byte + func (r FindInformationResponse) AttributeOpcode() uint8 + func (r FindInformationResponse) Format() uint8 + func (r FindInformationResponse) InformationData() []byte + func (r FindInformationResponse) SetAttributeOpcode() + func (r FindInformationResponse) SetFormat(v uint8) + func (r FindInformationResponse) SetInformationData(v []byte) + type HandleValueConfirmation []byte + func (r HandleValueConfirmation) AttributeOpcode() uint8 + func (r HandleValueConfirmation) SetAttributeOpcode() + type HandleValueIndication []byte + func (r HandleValueIndication) AttributeHandle() uint16 + func (r HandleValueIndication) AttributeOpcode() uint8 + func (r HandleValueIndication) AttributeValue() []byte + func (r HandleValueIndication) SetAttributeHandle(v uint16) + func (r HandleValueIndication) SetAttributeOpcode() + func (r HandleValueIndication) SetAttributeValue(v []byte) + type HandleValueNotification []byte + func (r HandleValueNotification) AttributeHandle() uint16 + func (r HandleValueNotification) AttributeOpcode() uint8 + func (r HandleValueNotification) AttributeValue() []byte + func (r HandleValueNotification) SetAttributeHandle(v uint16) + func (r HandleValueNotification) SetAttributeOpcode() + func (r HandleValueNotification) SetAttributeValue(v []byte) + type NotificationHandler interface + HandleNotification func(req []byte) + type PrepareWriteRequest []byte + func (r PrepareWriteRequest) AttributeHandle() uint16 + func (r PrepareWriteRequest) AttributeOpcode() uint8 + func (r PrepareWriteRequest) PartAttributeValue() []byte + func (r PrepareWriteRequest) SetAttributeHandle(v uint16) + func (r PrepareWriteRequest) SetAttributeOpcode() + func (r PrepareWriteRequest) SetPartAttributeValue(v []byte) + func (r PrepareWriteRequest) SetValueOffset(v uint16) + func (r PrepareWriteRequest) ValueOffset() uint16 + type PrepareWriteResponse []byte + func (r PrepareWriteResponse) AttributeHandle() uint16 + func (r PrepareWriteResponse) AttributeOpcode() uint8 + func (r PrepareWriteResponse) PartAttributeValue() []byte + func (r PrepareWriteResponse) SetAttributeHandle(v uint16) + func (r PrepareWriteResponse) SetAttributeOpcode() + func (r PrepareWriteResponse) SetPartAttributeValue(v []byte) + func (r PrepareWriteResponse) SetValueOffset(v uint16) + func (r PrepareWriteResponse) ValueOffset() uint16 + type ReadBlobRequest []byte + func (r ReadBlobRequest) AttributeHandle() uint16 + func (r ReadBlobRequest) AttributeOpcode() uint8 + func (r ReadBlobRequest) SetAttributeHandle(v uint16) + func (r ReadBlobRequest) SetAttributeOpcode() + func (r ReadBlobRequest) SetValueOffset(v uint16) + func (r ReadBlobRequest) ValueOffset() uint16 + type ReadBlobResponse []byte + func (r ReadBlobResponse) AttributeOpcode() uint8 + func (r ReadBlobResponse) PartAttributeValue() []byte + func (r ReadBlobResponse) SetAttributeOpcode() + func (r ReadBlobResponse) SetPartAttributeValue(v []byte) + type ReadByGroupTypeRequest []byte + func (r ReadByGroupTypeRequest) AttributeGroupType() []byte + func (r ReadByGroupTypeRequest) AttributeOpcode() uint8 + func (r ReadByGroupTypeRequest) EndingHandle() uint16 + func (r ReadByGroupTypeRequest) SetAttributeGroupType(v []byte) + func (r ReadByGroupTypeRequest) SetAttributeOpcode() + func (r ReadByGroupTypeRequest) SetEndingHandle(v uint16) + func (r ReadByGroupTypeRequest) SetStartingHandle(v uint16) + func (r ReadByGroupTypeRequest) StartingHandle() uint16 + type ReadByGroupTypeResponse []byte + func (r ReadByGroupTypeResponse) AttributeDataList() []byte + func (r ReadByGroupTypeResponse) AttributeOpcode() uint8 + func (r ReadByGroupTypeResponse) Length() uint8 + func (r ReadByGroupTypeResponse) SetAttributeDataList(v []byte) + func (r ReadByGroupTypeResponse) SetAttributeOpcode() + func (r ReadByGroupTypeResponse) SetLength(v uint8) + type ReadByTypeRequest []byte + func (r ReadByTypeRequest) AttributeOpcode() uint8 + func (r ReadByTypeRequest) AttributeType() []byte + func (r ReadByTypeRequest) EndingHandle() uint16 + func (r ReadByTypeRequest) SetAttributeOpcode() + func (r ReadByTypeRequest) SetAttributeType(v []byte) + func (r ReadByTypeRequest) SetEndingHandle(v uint16) + func (r ReadByTypeRequest) SetStartingHandle(v uint16) + func (r ReadByTypeRequest) StartingHandle() uint16 + type ReadByTypeResponse []byte + func (r ReadByTypeResponse) AttributeDataList() []byte + func (r ReadByTypeResponse) AttributeOpcode() uint8 + func (r ReadByTypeResponse) Length() uint8 + func (r ReadByTypeResponse) SetAttributeDataList(v []byte) + func (r ReadByTypeResponse) SetAttributeOpcode() + func (r ReadByTypeResponse) SetLength(v uint8) + type ReadMultipleRequest []byte + func (r ReadMultipleRequest) AttributeOpcode() uint8 + func (r ReadMultipleRequest) SetAttributeOpcode() + func (r ReadMultipleRequest) SetOfHandles() []byte + func (r ReadMultipleRequest) SetSetOfHandles(v []byte) + type ReadMultipleResponse []byte + func (r ReadMultipleResponse) AttributeOpcode() uint8 + func (r ReadMultipleResponse) SetAttributeOpcode() + func (r ReadMultipleResponse) SetOfValues() []byte + func (r ReadMultipleResponse) SetSetOfValues(v []byte) + type ReadRequest []byte + func (r ReadRequest) AttributeHandle() uint16 + func (r ReadRequest) AttributeOpcode() uint8 + func (r ReadRequest) SetAttributeHandle(v uint16) + func (r ReadRequest) SetAttributeOpcode() + type ReadResponse []byte + func (r ReadResponse) AttributeOpcode() uint8 + func (r ReadResponse) AttributeValue() []byte + func (r ReadResponse) SetAttributeOpcode() + func (r ReadResponse) SetAttributeValue(v []byte) + type Server struct + func NewServer(db *DB, l2c ble.Conn) (*Server, error) + func (s *Server) Loop() + type SignedWriteCommand []byte + func (r SignedWriteCommand) AttributeHandle() uint16 + func (r SignedWriteCommand) AttributeOpcode() uint8 + func (r SignedWriteCommand) AttributeValue() []byte + func (r SignedWriteCommand) AuthenticationSignature() [12]byte + func (r SignedWriteCommand) SetAttributeHandle(v uint16) + func (r SignedWriteCommand) SetAttributeOpcode() + func (r SignedWriteCommand) SetAttributeValue(v []byte) + func (r SignedWriteCommand) SetAuthenticationSignature(v [12]byte) + type WriteCommand []byte + func (r WriteCommand) AttributeHandle() uint16 + func (r WriteCommand) AttributeOpcode() uint8 + func (r WriteCommand) AttributeValue() []byte + func (r WriteCommand) SetAttributeHandle(v uint16) + func (r WriteCommand) SetAttributeOpcode() + func (r WriteCommand) SetAttributeValue(v []byte) + type WriteRequest []byte + func (r WriteRequest) AttributeHandle() uint16 + func (r WriteRequest) AttributeOpcode() uint8 + func (r WriteRequest) AttributeValue() []byte + func (r WriteRequest) SetAttributeHandle(v uint16) + func (r WriteRequest) SetAttributeOpcode() + func (r WriteRequest) SetAttributeValue(v []byte) + type WriteResponse []byte + func (r WriteResponse) AttributeOpcode() uint8 + func (r WriteResponse) SetAttributeOpcode()