ble

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvtBase = 1
	EvtLast = 0x0F
)
View Source
const (
	EvtUserMemReq     = EvtBase + 0 // user memory request
	EvtUserMemRelease = EvtBase + 1 // user memory release
)
View Source
const ErrorBase = 0x3000

Variables

This section is empty.

Functions

func Enable

func Enable(ramBase uintptr) (minBase uintptr, err error)

Enable enables and initializes the BLE stack.

func EncodeUUID

func EncodeUUID(uuid *UUID, buf []byte) (int, error)

EncodeUUID encode UUID bytes into provided buffer ant returns its size in bytes. Set buf to nil to only compute encoded UUID size.

func GetEvt

func GetEvt(dest []uint32) (uintptr, error)

GetEvt gets an event bytes from the pending events queue. It copies event data to dest and returns its size (in bytes). Set dest to nil to only check the event size.

Types

type Data

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

func DataBytes

func DataBytes(data []byte) Data

type Error

type Error uint32
const (
	ErrNotEnabled          Error = ErrorBase + 1 // BLE not enabled
	ErrInvalidConnHandle   Error = ErrorBase + 2 // invalid connection handle
	ErrInvalidAttrHandle   Error = ErrorBase + 3 // invalid connection handle
	ErrInvalidAdvHandle    Error = ErrorBase + 4 // invalid advertising handle
	ErrInvalidRole         Error = ErrorBase + 5 // invalid advertising handle
	ErrBlockedByOtherLinks Error = ErrorBase + 6 // change link settings failed due to the scheduling of other links
)

func (Error) Error

func (e Error) Error() string

type EvtHdr

type EvtHdr struct {
	ID         uint16 // event id (eg. EvtUserMemReq, gap.EvtConnected)
	Len        uint16 // length in octets including this header
	ConnHandle Handle // connection handle
}

func (*EvtHdr) EventID

func (e *EvtHdr) EventID() uint16

type HCIStatus

type HCIStatus uint8
const (
	HCISuccess                               HCIStatus = 0x00
	HCIUnknownBTLECommand                    HCIStatus = 0x01
	HCIUnknownConnectionIdentifier           HCIStatus = 0x02
	HCIAuthenticationFailure                 HCIStatus = 0x05
	HCIPinOrKeyMissing                       HCIStatus = 0x06
	HCIMemoryCapacityExceeded                HCIStatus = 0x07
	HCIConnectionTimeout                     HCIStatus = 0x08
	HCICommandDisallowed                     HCIStatus = 0x0C
	HCIInvalidBTLECommandParameters          HCIStatus = 0x12
	HCIRemoteUserTerminatedConnection        HCIStatus = 0x13
	HCIRemoteDevTerminationDueToLowResources HCIStatus = 0x14
	HCIRemoteDevTerminationDUETOPOWEROFF     HCIStatus = 0x15
	HCILocalHostTerminatedConnection         HCIStatus = 0x16
	HCIUnsupportedRemoteFeature              HCIStatus = 0x1A
	HCIInvalidLMPParameters                  HCIStatus = 0x1E
	HCIUnspecifiedError                      HCIStatus = 0x1F
	HCILMPResponseTimeout                    HCIStatus = 0x22
	HCILMPErrorTransactionCollision          HCIStatus = 0x23
	HCILMPPDUNotAllowed                      HCIStatus = 0x24
	HCIInstantPassed                         HCIStatus = 0x28
	HCIPairingWithUnitKeyUnsupported         HCIStatus = 0x29
	HCIDifferentTransactionCollision         HCIStatus = 0x2A
	HCIParameterOutOfMandatoryRange          HCIStatus = 0x30
	HCIControllerBusy                        HCIStatus = 0x3A
	HCIConnIntervalUnacceptable              HCIStatus = 0x3B
	HCIDirectedAdvertiserTimeout             HCIStatus = 0x3C
	HCIConnTerminatedDueToMICFailure         HCIStatus = 0x3D
	HCIConnFailedToBeEstablished             HCIStatus = 0x3E
)

type Handle

type Handle uint16
const (
	ConnInvalid Handle = 0xFFFF // invalid connection handle
	ConnAll     Handle = 0xFFFE // applies to all connection handles
)

type MemType

type MemType uint8
const (
	UserMemInvalid           MemType = 0 // invalid user memory types
	UserMemGATTSQueuedWrites MemType = 1 // User memory for GATTS queued writes
)

type UUID

type UUID struct {
	Value uint16
	Type  UUIDType
}

type UUID128

type UUID128 [16]byte // little-endian UUID bytes

type UUIDType

type UUIDType uint8
const (
	UUIDXX     UUIDType = 0 // unknown/invalid UUID type
	UUID16     UUIDType = 1 // bluetooth SIG 16-bit UUID
	VSUUIDBase UUIDType = 2 // vendor-spcific UUID types start at this index
)

func AddVSUUID

func AddVSUUID(vsuuid *UUID128) (t UUIDType, err error)

AddVSUUID add a Vendor Specific base UUID.

type UserMemBlock

type UserMemBlock struct {
	Mem *uint8 // Pointer to the start of the user memory block.
	Len uint16 // Length in bytes of the user memory block.
}

type UserMemRelease

type UserMemRelease struct {
	EvtHdr
	Type     MemType      // user memory type
	MemBlock UserMemBlock // user memory block
}

type UserMemReq added in v0.3.0

type UserMemReq struct {
	EvtHdr
	Type MemType // user memory type
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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