Documentation ¶
Index ¶
- Constants
- Variables
- type Field
- func AllUUID(u ble.UUID) Field
- func CompleteName(n string) Field
- func Flags(f byte) Field
- func IBeacon(u ble.UUID, major, minor uint16, pwr int8) Field
- func IBeaconData(md []byte) Field
- func ManufacturerData(id uint16, b []byte) Field
- func Raw(b []byte) Field
- func ServiceData16(id uint16, b []byte) Field
- func ShortName(n string) Field
- func SomeUUID(u ble.UUID) Field
- type Packet
- func (p *Packet) Append(f Field) error
- func (p *Packet) Bytes() []byte
- func (p *Packet) Field(typ byte) []byte
- func (p *Packet) Flags() (flags byte, present bool)
- func (p *Packet) Len() int
- func (p *Packet) LocalName() string
- func (p *Packet) ManufacturerData() []byte
- func (p *Packet) ServiceData() []ble.ServiceData
- func (p *Packet) ServiceSol() []ble.UUID
- func (p *Packet) TxPower() (power int, present bool)
- func (p *Packet) UUIDs() []ble.UUID
Constants ¶
const ( FlagLimitedDiscoverable = 0x01 // LE Limited Discoverable Mode FlagGeneralDiscoverable = 0x02 // LE General Discoverable Mode FlagLEOnly = 0x04 // BR/EDR Not Supported. Bit 37 of LMP Feature Mask Definitions (Page 0) FlagBothController = 0x08 // Simultaneous LE and BR/EDR to Same Device Capable (Controller). FlagBothHost = 0x10 // Simultaneous LE and BR/EDR to Same Device Capable (Host). )
Advertising flags
const MaxEIRPacketLength = 31
MaxEIRPacketLength is the maximum allowed AdvertisingPacket and ScanResponsePacket length.
Variables ¶
var ( ErrInvalid = errors.New("invalid argument") ErrNotFit = errors.New("data not fit") )
ErrNotFit ...
Functions ¶
This section is empty.
Types ¶
type Field ¶
Field is an advertising field which can be appended to a packet.
func IBeaconData ¶
IBeaconData returns an iBeacon advertising packet with specified parameters.
func ManufacturerData ¶
ManufacturerData is manufacturer specific data.
func Raw ¶
Raw appends the bytes to the current packet. This is helpful for creating new packet from existing packets.
func ServiceData16 ¶
ServiceData16 is service data for a 16bit service uuid
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet is an implemntation of ble.AdvPacket for crafting or parsing an advertising packet or scan response. Refer to Supplement to Bluetooth Core Specification | CSSv6, Part A.
func NewRawPacket ¶
NewRawPacket returns a new advertising Packet.
func (*Packet) Append ¶
Append appends a field to the packet. It returns ErrNotFit if the field doesn't fit into the packet, and leaves the packet intact.
func (*Packet) Field ¶
Field returns the field data (excluding the initial length and typ byte). It returns nil, if the specified field is not found.
func (*Packet) ManufacturerData ¶
ManufacturerData returns the ManufacturerData field if it presents.