Documentation ¶
Index ¶
- Constants
- Variables
- func BTWriter(ctx context.Context, recv <-chan []byte, repErr chan<- error, ...)
- func CheckRecvHandler(c []byte)
- func ConnectByMac(mac bluetooth.Address) (*bluetooth.Device, error)
- func DisconnectDevice(shx *bluetooth.Device)
- func DisconnectHandler(_ bluetooth.Address, connected bool)
- func EmptyFilter(dev bluetooth.ScanResult) bool
- func GetAvailableBtDevList(filter DeviceFilter) ([]bluetooth.ScanResult, error)
- func GetConnectStatus() bool
- func RWRecvHandler(recvChan chan<- []byte, btOut chan<- struct{}) func(c []byte)
- func SHX8800Filter(dev bluetooth.ScanResult) bool
- func SetConnectStatus(connectStat bool)
- func SetHandler(connHandler func(address bluetooth.Address, connected bool))
- type BTCharacteristic
- func (btc *BTCharacteristic) SendDataToCheck(data []byte) error
- func (btc *BTCharacteristic) SendDataToRW(data []byte) error
- func (btc *BTCharacteristic) SetCheckReceiveHandler(handler RecvHandler, recvChan chan<- []byte)
- func (btc *BTCharacteristic) SetReadWriteReceiveHandler(handler RecvHandler, recvChan chan<- []byte, btIn chan<- struct{})
- type DeviceFilter
- type RecvHandler
Constants ¶
View Source
const ( BT_CONNECT_TIMEOUT = 5 BTNAME_SHX8800 = "walkie-talkie" HANDSHAKE_TIMEOUT = 5 BT_SCAN_TIMEOUT = 10 BATTERY_CHARACTERISTIC_UUID = "2a19" MANUFACTURER_CHARACTERISTIC_UUID = "2a29" FIRMWARE_REVISION_CHARACTERISTIC_UUID = "2a26" MODEL_NUMBER_CHARACTERISTIC_UUID = "2a24" CHECK_CHARACTERISTIC_UUID = "ff31" RW_CHARACTERISTIC_UUID = "ffe1" )
Variables ¶
View Source
var ( CurrentDevice *BTCharacteristic FINAL_DATA_STARTER = []byte{87, 28, 00} NO_SSID_FILTER = false )
View Source
var HANDSHAKE_CODE = []byte{80, 82, 79, 71, 82, 79, 77, 83, 72, 88, 85}
View Source
var HANDSHAKE_RESP = 6
Functions ¶
func CheckRecvHandler ¶
func CheckRecvHandler(c []byte)
func DisconnectDevice ¶
func DisconnectHandler ¶
func EmptyFilter ¶ added in v0.2.1
func EmptyFilter(dev bluetooth.ScanResult) bool
func GetAvailableBtDevList ¶
func GetAvailableBtDevList(filter DeviceFilter) ([]bluetooth.ScanResult, error)
func GetConnectStatus ¶ added in v0.2.0
func GetConnectStatus() bool
func RWRecvHandler ¶
func SHX8800Filter ¶
func SHX8800Filter(dev bluetooth.ScanResult) bool
func SetConnectStatus ¶ added in v0.2.0
func SetConnectStatus(connectStat bool)
func SetHandler ¶
Types ¶
type BTCharacteristic ¶
type BTCharacteristic struct { CheckCharacteristic *bluetooth.DeviceCharacteristic RWCharacteristic *bluetooth.DeviceCharacteristic CheckRecvHandler RecvHandler RWRecvHandler RecvHandler }
func (*BTCharacteristic) SendDataToCheck ¶
func (btc *BTCharacteristic) SendDataToCheck(data []byte) error
func (*BTCharacteristic) SendDataToRW ¶
func (btc *BTCharacteristic) SendDataToRW(data []byte) error
func (*BTCharacteristic) SetCheckReceiveHandler ¶
func (btc *BTCharacteristic) SetCheckReceiveHandler(handler RecvHandler, recvChan chan<- []byte)
func (*BTCharacteristic) SetReadWriteReceiveHandler ¶
func (btc *BTCharacteristic) SetReadWriteReceiveHandler(handler RecvHandler, recvChan chan<- []byte, btIn chan<- struct{})
type DeviceFilter ¶
type DeviceFilter func(dev bluetooth.ScanResult) bool
type RecvHandler ¶
Click to show internal directories.
Click to hide internal directories.