Compare commits

...

1 commit

Author SHA1 Message Date
sago35
8cad456ec8 WIP rtl8720dn 2021-07-23 16:36:45 +09:00
3 changed files with 57 additions and 0 deletions

28
adapter_rtl8720dn.go Normal file
View file

@ -0,0 +1,28 @@
// +build wioterminal
package bluetooth
// Adapter is a dummy adapter: it represents the connection to the (only)
// SoftDevice on the chip.
type Adapter struct {
isDefault bool
scanning bool
charWriteHandlers []charWriteHandler
connectHandler func(device Addresser, connected bool)
}
// DefaultAdapter is the default adapter on the current system. On Nordic chips,
// it will return the SoftDevice interface.
//
// Make sure to call Enable() before using it to initialize the adapter.
var DefaultAdapter = &Adapter{isDefault: true,
connectHandler: func(device Addresser, connected bool) {
return
}}
// Enable configures the BLE stack. It must be called before any
// Bluetooth-related calls (unless otherwise indicated).
func (a *Adapter) Enable() error {
return nil
}

12
gap_rtl8720dn.go Normal file
View file

@ -0,0 +1,12 @@
// +build wioterminal
package bluetooth
// Scan starts a BLE scan. It is stopped by a call to StopScan. A common pattern
// is to cancel the scan when a particular device has been found.
//
// The callback is run on the same goroutine as the Scan function when using a
// SoftDevice.
func (a *Adapter) Scan(callback func(*Adapter, ScanResult)) error {
return nil
}

17
gatts_rtl8720dn.go Normal file
View file

@ -0,0 +1,17 @@
// +build wioterminal
package bluetooth
// Characteristic is a single characteristic in a service. It has an UUID and a
// value.
type Characteristic struct {
handle uint16
permissions CharacteristicPermissions
}
// charWriteHandler contains a handler->callback mapping for characteristic
// writes.
type charWriteHandler struct {
handle uint16
callback func(connection Connection, offset int, value []byte)
}