ble

package
v0.0.0-...-04b4a7a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0-only Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAYLOAD_MAX_LENGTH  = 247
	FRAGMENT_MAX_LENGTH = 244
	PROTOBUF_MAX_LENGTH = 242

	EDM_START = 0xAA
	EDM_STOP  = 0x55

	DATA_EVENT   = 0x31
	DATA_COMMAND = 0x36
)

Variables

View Source
var BLENamePattern = regexp.MustCompile(`\+UBTLN:"([^"]+)"`)
View Source
var BLEStartupPattern = regexp.MustCompile(`(\+STARTUP)`)

Functions

This section is empty.

Types

type BLE

type BLE struct {
	Drive   *ums.Drive
	Keyring *crypto.Keyring
	// contains filtered or unexported fields
}

func (*BLE) Init

func (b *BLE) Init() (err error)

func (*BLE) PairingMode

func (b *BLE) PairingMode() (code []byte, err error)

type Data

type Data struct {
	Kind      uint16
	ChannelId uint8
	Data      []byte
}

func (*Data) Bytes

func (cmd *Data) Bytes() []byte

func (*Data) SetDefaults

func (cmd *Data) SetDefaults()

type Fragment

type Fragment struct {
	Total uint8
	Seq   uint8
	Data  []byte
}

func (*Fragment) Bytes

func (frg *Fragment) Bytes() []byte

func (*Fragment) Parse

func (frg *Fragment) Parse(data []byte)

type Packet

type Packet struct {
	Start   uint8
	Length  uint16
	Payload []byte
	Stop    uint8
}

func (*Packet) Bytes

func (pkt *Packet) Bytes() []byte

func (*Packet) SetDefaults

func (pkt *Packet) SetDefaults()

func (*Packet) SetPayload

func (pkt *Packet) SetPayload(buf []byte)

type Session

type Session struct {
	sync.Mutex

	Last   int64
	Skew   time.Duration
	Active bool
	Data   []byte
}

func (*Session) Reset

func (s *Session) Reset()

func (*Session) Time

func (s *Session) Time() int64

Jump to

Keyboard shortcuts

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