bll

package
v0.0.0-...-691c107 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 21 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 BllXportSetConnParams

func BllXportSetConnParams(dev ble.Device, ownAddrType bledefs.BleAddrType) error

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) Filters

func (s *BllSesn) Filters() (nmcoap.TxMsgFilter, nmcoap.RxMsgFilter)

func (*BllSesn) IsOpen

func (s *BllSesn) IsOpen() bool

Indicates whether the session is currently open.

func (*BllSesn) ListenCoap

func (s *BllSesn) ListenCoap(mc nmcoap.MsgCriteria) (*nmcoap.Listener, error)

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) RxAccept

func (s *BllSesn) RxAccept() (sesn.Sesn, *sesn.SesnCfg, error)

func (*BllSesn) RxCoap

func (s *BllSesn) RxCoap(opt sesn.TxOptions) (coap.Message, error)

func (*BllSesn) SetFilters

func (s *BllSesn) SetFilters(txFilter nmcoap.TxMsgFilter,
	rxFilter nmcoap.RxMsgFilter)

func (*BllSesn) StopListenCoap

func (s *BllSesn) StopListenCoap(mc nmcoap.MsgCriteria)

func (*BllSesn) TxCoap

func (s *BllSesn) TxCoap(m coap.Message) error

func (*BllSesn) TxRxMgmt

func (s *BllSesn) TxRxMgmt(m *nmp.NmpMsg,
	timeout time.Duration) (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

func (*BllSesn) TxRxMgmtAsync

func (s *BllSesn) TxRxMgmtAsync(m *nmp.NmpMsg,
	timeout time.Duration, ch chan nmp.NmpRsp, errc chan error) error

type BllSesnCfg

type BllSesnCfg struct {
	MgmtProto    sesn.MgmtProto
	AdvFilter    ble.AdvFilter
	PreferredMtu uint16
	ConnTimeout  time.Duration
	ConnTries    int
	WriteRsp     bool
	TxFilter     nmcoap.TxMsgFilter
	RxFilter     nmcoap.RxMsgFilter
}

func NewBllSesnCfg

func NewBllSesnCfg() BllSesnCfg

type BllXport

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

func NewBllXport

func NewBllXport(cfg XportCfg, hciIdx int) *BllXport

func (*BllXport) BuildBllSesn

func (bx *BllXport) BuildBllSesn(cfg BllSesnCfg) (sesn.Sesn, 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
	OwnAddrType bledefs.BleAddrType
}

func NewXportCfg

func NewXportCfg() XportCfg

Jump to

Keyboard shortcuts

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