Documentation ¶
Index ¶
- Constants
- type ADType
- type AdvPDU
- func (pdu AdvPDU) AppendAddr(addr int64) (offset int)
- func (pdu AdvPDU) AppendBytes(typ ADType, s ...byte)
- func (pdu AdvPDU) AppendString(typ ADType, s string)
- func (pdu AdvPDU) AppendUUIDs(typ ADType, uuids ...uuid.UUID)
- func (pdu AdvPDU) AppendWords16(typ ADType, s ...uint16)
- func (pdu AdvPDU) AppendWords32(typ ADType, s ...uint32)
- func (pdu AdvPDU) RxAdd() bool
- func (pdu AdvPDU) SetRxAdd(rnda bool)
- func (pdu AdvPDU) SetTxAdd(rnda bool)
- func (pdu AdvPDU) SetType(typ AdvPDUType)
- func (pdu AdvPDU) TxAdd() bool
- func (pdu AdvPDU) Type() AdvPDUType
- func (pdu AdvPDU) UpdateAddr(offset int, addr int64)
- type AdvPDUType
- type DataPDU
- type DataRing
- type HCI
- type Header
- type PDU
Constants ¶
View Source
const ( LimitedDisc = 1 << 0 // LE Limited Discoverable mode. GeneralDisc = 1 << 1 // LE General Discoverable mode. OnlyLE = 1 << 2 // BR/EDR not supported. DualModeCtlr = 1 << 3 // LE and BR/EDR capable (controller). DualModeHost = 1 << 4 // LE and BR/EDR capable (host). )
Flags
View Source
const ( MaxAdvPay = 37 // Max. advertising payload length in bytes. MaxDataPay = 31 // Max. data payload length in bytes (BLE 4.0, 4.1). MaxLongDataPay = 255 // Max. data payload length in bytes (BLE 4.2+). )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ADType ¶
type ADType byte
const ( Flags ADType = 0x01 // Flags MoreServices16 ADType = 0x02 // More 16-bit UUIDs available. Services16 ADType = 0x03 // Complete list of 16-bit UUIDs available. MoreServices32 ADType = 0x04 // More 32-bit UUIDs available. Services32 ADType = 0x05 // Complete list of 32-bit UUIDs available. MoreServices ADType = 0x06 // More 128-bit UUIDs available. Services ADType = 0x07 // Complete list of 128-bit UUIDs available. ShortLocalName ADType = 0x08 // Shortened local name. LocalName ADType = 0x09 // Complete local name. TxPower ADType = 0x0A // Tx Power Level: -127 to +127 dBm. SlaveConnIntRange ADType = 0x12 // Slave Connection Interval Range. ManufSpecData ADType = 0xFF // Manufacturer Specific Data. )
type AdvPDU ¶
type AdvPDU struct {
PDU
}
AdvPDU represents Advertising Channel PDU. See PDU for more information.
func MakeAdvPDU ¶
MakeAdvPDU is more readable counterpart of AdvPDU{MakePDU(maxpay)}.
func (AdvPDU) AppendAddr ¶
func (AdvPDU) AppendBytes ¶
func (AdvPDU) AppendString ¶
func (AdvPDU) AppendWords16 ¶
func (AdvPDU) AppendWords32 ¶
func (AdvPDU) UpdateAddr ¶
type AdvPDUType ¶
type AdvPDUType byte
AdvPDUType represents Advertising Channel PDU type.
const ( AdvInd AdvPDUType = 0 AdvDirectInd AdvPDUType = 1 AdvNonconnInd AdvPDUType = 2 ScanReq AdvPDUType = 3 ScanRsp AdvPDUType = 4 ConnectReq AdvPDUType = 5 AdvScanInd AdvPDUType = 6 )
type DataPDU ¶
type DataPDU struct {
PDU
}
DataPDU represents Data Channel PDU. See PDU for more information.
func MakeDataPDU ¶
MakeDataPDU is more readable counterpart of DataPDU{MakePDU(maxpay)}.
type DataRing ¶
type DataRing struct {
// contains filtered or unexported fields
}
func MakeDataRing ¶
type HCI ¶
type HCI interface { // Recv returns next received PDU. Recv() (DataPDU, error) // GetSend returns current transmit PDU. This PDU is not zeroed (can // contain random data in payload and header). GetSend() DataPDU // Send sends current transmit PDU. Send() error }
HCI defines Host Controller Interface for Bluetooth LE.
type Header ¶
type Header byte
Header represents first byte of Data Channel PDU header. Second byte of header is payload length and can be obtained using PayLen method.
const ( LLID Header = 0x03 // Mask for L2CAPCont, L2CAPStart, LLControl. L2CAPCont Header = 0x01 // Continuation of L2CAP message or empty PDU. L2CAPStart Header = 0x02 // Start of L2CAP message or complete message. LLControl Header = 0x03 // LL Control PDU. NESN Header = 1 << 2 // Next Expected Sequence Number. SN Header = 1 << 3 // Sequence Number. MD Header = 1 << 4 // More Data. )
type PDU ¶
type PDU struct {
// contains filtered or unexported fields
}
PDU represents BLE Protocol Data Unit. It has reference semantic (like slice), so it should be initialized before use.
Click to show internal directories.
Click to hide internal directories.