rfcomm

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControlNumberSABM Set Asynchronous Balanced Mode
	ControlNumberSABM uint8 = 0x2F

	// ControlNumberUA Unnumbered Acknowledgement
	ControlNumberUA uint8 = 0x63

	// ControlNumberDM Disconnect Mode
	ControlNumberDM uint8 = 0x0F

	// ControlNumberDISC Disconnect
	ControlNumberDISC uint8 = 0x43

	// ControlNumberUIH Unnumbered Information with Header Check
	ControlNumberUIH uint8 = 0xEF
)
View Source
const (
	// Priority ...
	Priority uint8 = 0x07

	// MaxFrameSize ...
	MaxFrameSize uint16 = 0x03f0

	// FlowControl set to 1 when a device is unable to accept any RFCOMM frames
	FlowControl uint8 = 0x00

	// ReadyToCommunicate set to 1 when the device is ready to communicate
	ReadyToCommunicate uint8 = 0x01

	// ReadyToReceive set to 0 when the device cannot receive data and 1 when it can
	ReadyToReceive uint8 = 0x01

	// IncomingCall 1 indicates an incoming call
	IncomingCall uint8 = 0x00

	// ValidData 1 indicates that valid data is being sent
	ValidData uint8 = 0x01
)
View Source
const (
	// FrameTypeUIH In RFCOMM UIH frames indicated by the value 0b1000 are used.
	FrameTypeUIH uint8 = 0x01

	// ConvergenceLayer RFCOMM uses Type 1 (unstructured octet stream) 0x0000
	ConvergenceLayer uint8 = 0x00

	// Timer in RFCOMM, if the timer elapses, the connection is closed down. The timer’s value is not negotiable, but is fixed at 60s. This field is set to 0 to indicate that the timer is not negotiable.
	Timer uint8 = 0x00

	// MaxRetransmissions Because the Bluetooth baseband gives RFCOMM a reliable transport layer, RFCOMM will not retransmit, so this value is set to zero
	MaxRetransmissions uint8 = 0x00

	// WindowSize RFCOMM uses basic mode, so these bits are not interpreted by RFCOMM.
	WindowSize uint8 = 0x00
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Client implementa an Attribute Protocol Client.

func NewClient

func NewClient(ctx context.Context, l2c ble.Conn, channel uint8) (*Client, error)

NewClient returns an RFCOMM Client that has been initialized according to the RFCOMM specifications.

func (*Client) Address

func (c *Client) Address() ble.Addr

Address returns the address of the client.

func (*Client) CancelConnection

func (c *Client) CancelConnection() error

CancelConnection disconnects the connection.

func (*Client) Disconnected

func (c *Client) Disconnected() <-chan struct{}

Disconnected returns a receiving channel, which is closed when the client disconnects.

func (*Client) Read

func (c *Client) Read(b []byte) (int, error)

Read ...

func (*Client) Write

func (c *Client) Write(v []byte) (int, error)

Write RFCOMM Bluetooth specification Version 1.0 B

Jump to

Keyboard shortcuts

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