Documentation ¶
Index ¶
- Constants
- Variables
- type Advertisement
- type BLE
- func (ble *BLE) Connect(deviceUuid xpc.UUID)
- func (ble *BLE) Disconnect(deviceUuid xpc.UUID)
- func (ble *BLE) DiscoverCharacteristics(deviceUuid xpc.UUID, serviceUuid string, characteristicUuids []string)
- func (ble *BLE) DiscoverDescriptors(deviceUuid xpc.UUID, serviceUuid, characteristicUuid string)
- func (ble *BLE) DiscoverServices(deviceUuid xpc.UUID, uuids []xpc.UUID)
- func (ble *BLE) HandleXpcEvent(event xpc.Dict, err error)
- func (ble *BLE) Init()
- func (ble *BLE) Read(deviceUuid xpc.UUID, serviceUuid, characteristicUuid string)
- func (ble *BLE) RemoveServices()
- func (ble *BLE) SetServices(services []Service)
- func (ble *BLE) SetVerbose(v bool)
- func (ble *BLE) StartAdvertising(name string, serviceUuids []xpc.UUID)
- func (ble *BLE) StartAdvertisingIBeacon(uuid xpc.UUID, major, minor uint16, measuredPower int8)
- func (ble *BLE) StartAdvertisingIBeaconData(data []byte)
- func (ble *BLE) StartScanning(serviceUuids []xpc.UUID, allowDuplicates bool)
- func (ble *BLE) StopAdvertising()
- func (ble *BLE) StopScanning()
- func (ble *BLE) UpdateRssi(deviceUuid xpc.UUID)
- type Characteristic
- type CharacteristicDescriptor
- type Descriptor
- type Emitter
- type Event
- type EventHandlerFunc
- type Peripheral
- type Property
- type Service
- type ServiceCharacteristic
- type ServiceData
- type ServiceHandle
Constants ¶
View Source
const ( Broadcast Property = 1 << iota Read = 1 << iota WriteWithoutResponse = 1 << iota Write = 1 << iota Notify = 1 << iota Indicate = 1 << iota AuthenticatedSignedWrites = 1 << iota ExtendedProperties = 1 << iota )
View Source
const (
ALL = "__allEvents__"
)
Variables ¶
View Source
var STATES = []string{"unknown", "resetting", "unsupported", "unauthorized", "poweredOff", "poweredOn"}
Functions ¶
This section is empty.
Types ¶
type Advertisement ¶
type Advertisement struct { LocalName string TxPowerLevel int ManufacturerData []byte ServiceData []ServiceData ServiceUuids []string }
type BLE ¶
type BLE struct { Emitter // contains filtered or unexported fields }
func (*BLE) DiscoverCharacteristics ¶
func (ble *BLE) DiscoverCharacteristics(deviceUuid xpc.UUID, serviceUuid string, characteristicUuids []string)
discover characteristics
func (*BLE) DiscoverDescriptors ¶
discover descriptors
func (*BLE) DiscoverServices ¶
discover services
func (*BLE) HandleXpcEvent ¶
process BLE events and asynchronous errors (implements XpcEventHandler)
func (*BLE) SetVerbose ¶
func (*BLE) StartAdvertising ¶
start advertising
func (*BLE) StartAdvertisingIBeacon ¶
start advertising as IBeacon
func (*BLE) StartAdvertisingIBeaconData ¶
start advertising as IBeacon (raw data)
func (*BLE) StartScanning ¶
start scanning
type Characteristic ¶
type Characteristic struct {
// contains filtered or unexported fields
}
GATT Characteristic
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
GATT Descriptor
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
Emitter is an object to emit and handle Event(s)
func (*Emitter) Init ¶
func (e *Emitter) Init()
Init initialize the emitter and start a goroutine to execute the event handlers
func (*Emitter) On ¶
func (e *Emitter) On(event string, fn EventHandlerFunc)
On(event, cb) registers an handler for the specified event
func (*Emitter) SetVerbose ¶
type Event ¶
type Event struct { Name string State string DeviceUUID xpc.UUID ServiceUuid string CharacteristicUuid string Peripheral Peripheral Data []byte Mtu int IsNotification bool }
Event generated by blued, with associated data
type EventHandlerFunc ¶
The event handler function. Return true to terminate
type Peripheral ¶
type Peripheral struct { Uuid xpc.UUID Address string AddressType string Connectable bool Advertisement Advertisement Rssi int Services map[interface{}]*ServiceHandle }
type ServiceCharacteristic ¶
type ServiceData ¶
type ServiceHandle ¶
type ServiceHandle struct { Uuid string Name string Type string Characteristics map[interface{}]*ServiceCharacteristic // contains filtered or unexported fields }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.