Documentation ¶
Index ¶
- type Client
- func (p *Client) Addr() ble.Addr
- func (p *Client) CancelConnection() error
- func (p *Client) ClearSubscriptions() error
- func (p *Client) Conn() ble.Conn
- func (p *Client) Disconnected() <-chan struct{}
- func (p *Client) DiscoverCharacteristics(filter []ble.UUID, s *ble.Service) ([]*ble.Characteristic, error)
- func (p *Client) DiscoverDescriptors(filter []ble.UUID, c *ble.Characteristic) ([]*ble.Descriptor, error)
- func (p *Client) DiscoverIncludedServices(ss []ble.UUID, s *ble.Service) ([]*ble.Service, error)
- func (p *Client) DiscoverProfile(force bool) (*ble.Profile, error)
- func (p *Client) DiscoverServices(filter []ble.UUID) ([]*ble.Service, error)
- func (p *Client) ExchangeMTU(mtu int) (int, error)
- func (p *Client) HandleNotification(req []byte)
- func (p *Client) Name() string
- func (p *Client) Profile() *ble.Profile
- func (p *Client) ReadCharacteristic(c *ble.Characteristic) ([]byte, error)
- func (p *Client) ReadDescriptor(d *ble.Descriptor) ([]byte, error)
- func (p *Client) ReadLongCharacteristic(c *ble.Characteristic) ([]byte, error)
- func (p *Client) ReadRSSI() int
- func (p *Client) Subscribe(c *ble.Characteristic, ind bool, h ble.NotificationHandler) error
- func (p *Client) Unsubscribe(c *ble.Characteristic, ind bool) error
- func (p *Client) WriteCharacteristic(c *ble.Characteristic, v []byte, noRsp bool) error
- func (p *Client) WriteDescriptor(d *ble.Descriptor, v []byte) error
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
A Client is a GATT Client.
func (*Client) CancelConnection ¶
CancelConnection disconnects the connection.
func (*Client) ClearSubscriptions ¶
ClearSubscriptions clears all subscriptions to notifications and indications.
func (*Client) Disconnected ¶
func (p *Client) Disconnected() <-chan struct{}
Disconnected returns a receiving channel, which is closed when the client disconnects.
func (*Client) DiscoverCharacteristics ¶
func (p *Client) DiscoverCharacteristics(filter []ble.UUID, s *ble.Service) ([]*ble.Characteristic, error)
DiscoverCharacteristics finds all the characteristics within a service. [Vol 3, Part G, 4.6.1] If filter is specified, only filtered characteristics are returned.
func (*Client) DiscoverDescriptors ¶
func (p *Client) DiscoverDescriptors(filter []ble.UUID, c *ble.Characteristic) ([]*ble.Descriptor, error)
DiscoverDescriptors finds all the descriptors within a characteristic. [Vol 3, Part G, 4.7.1] If filter is specified, only filtered descriptors are returned.
func (*Client) DiscoverIncludedServices ¶
DiscoverIncludedServices finds the included services of a service. [Vol 3, Part G, 4.5.1] If filter is specified, only filtered services are returned.
func (*Client) DiscoverProfile ¶
DiscoverProfile discovers the whole hierarchy of a server.
func (*Client) DiscoverServices ¶
DiscoverServices finds all the primary services on a server. [Vol 3, Part G, 4.4.1] If filter is specified, only filtered services are returned.
func (*Client) ExchangeMTU ¶
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) HandleNotification ¶
HandleNotification ...
func (*Client) ReadCharacteristic ¶
func (p *Client) ReadCharacteristic(c *ble.Characteristic) ([]byte, error)
ReadCharacteristic reads a characteristic value from a server. [Vol 3, Part G, 4.8.1]
func (*Client) ReadDescriptor ¶
func (p *Client) ReadDescriptor(d *ble.Descriptor) ([]byte, error)
ReadDescriptor reads a characteristic descriptor from a server. [Vol 3, Part G, 4.12.1]
func (*Client) ReadLongCharacteristic ¶
func (p *Client) ReadLongCharacteristic(c *ble.Characteristic) ([]byte, error)
ReadLongCharacteristic reads a characteristic value which is longer than the MTU. [Vol 3, Part G, 4.8.3]
func (*Client) ReadRSSI ¶
ReadRSSI retrieves the current RSSI value of remote peripheral. [Vol 2, Part E, 7.5.4]
func (*Client) Subscribe ¶
func (p *Client) Subscribe(c *ble.Characteristic, ind bool, h ble.NotificationHandler) error
Subscribe subscribes to indication (if ind is set true), or notification of a characteristic value. [Vol 3, Part G, 4.10 & 4.11]
func (*Client) Unsubscribe ¶
func (p *Client) Unsubscribe(c *ble.Characteristic, ind bool) error
Unsubscribe unsubscribes to indication (if ind is set true), or notification of a specified characteristic value. [Vol 3, Part G, 4.10 & 4.11]
func (*Client) WriteCharacteristic ¶
WriteCharacteristic writes a characteristic value to a server. [Vol 3, Part G, 4.9.3]
func (*Client) WriteDescriptor ¶
func (p *Client) WriteDescriptor(d *ble.Descriptor, v []byte) error
WriteDescriptor writes a characteristic descriptor to a server. [Vol 3, Part G, 4.12.3]
type Server ¶
Server ...
func NewServerWithName ¶
NewServerWithName creates a new Server with the specified name
func NewServerWithNameAndHandler ¶
func NewServerWithNameAndHandler(name string, notifyHandler ble.NotifyHandler) (*Server, error)
NewServerWithNameAndHandler allow to specify a custom NotifyHandler