bll

package
v0.0.0-...-0602f2a Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

README

Bll (BLE library)

This package implements a sesn and xport suitable for speaking NMP over BLE. The implementation uses the currantlabs BLE library (https://github.com/currantlabs/ble). This contrasts with the nmxact "nmble" package which is implemented using blehostd, a NimBLE host running in a simulated OS.

This package was created to address the following complications associated with the nmble package:

* Inability to use the built-in Bluetooth controller in MacOS.
* Hassle of setting up and configuring blehostd.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UuidFromBllUuid

func UuidFromBllUuid(bllUuid ble.UUID) (bledefs.BleUuid, error)

Types

type BllSesn

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

A session that uses the host machine's native BLE support.

func NewBllSesn

func NewBllSesn(cfg BllSesnCfg) *BllSesn

func (*BllSesn) AbortRx

func (s *BllSesn) AbortRx(nmpSeq uint8) error

Stops a receive operation in progress. This must be called from a separate thread, as sesn receive operations are blocking.

func (*BllSesn) Close

func (s *BllSesn) Close() error

func (*BllSesn) CoapIsTcp

func (s *BllSesn) CoapIsTcp() bool

func (*BllSesn) IsOpen

func (s *BllSesn) IsOpen() bool

Indicates whether the session is currently open.

func (*BllSesn) MgmtProto

func (s *BllSesn) MgmtProto() sesn.MgmtProto

func (*BllSesn) MtuIn

func (s *BllSesn) MtuIn() int

Retrieves the maximum data payload for incoming NMP responses.

func (*BllSesn) MtuOut

func (s *BllSesn) MtuOut() int

Retrieves the maximum data payload for outgoing NMP requests.

func (*BllSesn) Open

func (s *BllSesn) Open() error

func (*BllSesn) TxCoapOnce

func (s *BllSesn) TxCoapOnce(m coap.Message, resType sesn.ResourceType,
	opt sesn.TxOptions) (coap.COAPCode, []byte, error)

func (*BllSesn) TxNmpOnce

func (s *BllSesn) TxNmpOnce(msg *nmp.NmpMsg, opt sesn.TxOptions) (
	nmp.NmpRsp, error)

Performs a blocking transmit a single NMP message and listens for the response.

  • nil: success.
  • nmxutil.SesnClosedError: session not open.
  • other error

type BllSesnCfg

type BllSesnCfg struct {
	MgmtProto    sesn.MgmtProto
	AdvFilter    ble.AdvFilter
	PreferredMtu uint16
	ConnTimeout  time.Duration
	ConnTries    int
	WriteRsp     bool
}

func NewBllSesnCfg

func NewBllSesnCfg() BllSesnCfg

type BllXport

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

func NewBllXport

func NewBllXport(cfg XportCfg) *BllXport

func (*BllXport) BuildAdvertiser

func (bx *BllXport) BuildAdvertiser() (adv.Advertiser, error)

func (*BllXport) BuildBllSesn

func (bx *BllXport) BuildBllSesn(cfg BllSesnCfg) (sesn.Sesn, error)

func (*BllXport) BuildScanner

func (bx *BllXport) BuildScanner() (scan.Scanner, error)

func (*BllXport) BuildSesn

func (bx *BllXport) BuildSesn(cfg sesn.SesnCfg) (sesn.Sesn, error)

func (*BllXport) Start

func (bx *BllXport) Start() error

func (*BllXport) Stop

func (bx *BllXport) Stop() error

func (*BllXport) Tx

func (bx *BllXport) Tx(data []byte) error

type XportCfg

type XportCfg struct {
	CtlrName string
}

func NewXportCfg

func NewXportCfg() XportCfg

Jump to

Keyboard shortcuts

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