Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGoBleClient ¶
func NewGoBleClient(init GoBleInitFunc) (*bleClient, error)
Types ¶
type Advertisement ¶
type AdvertisementHandler ¶
type AdvertisementHandler func(adv Advertisement)
type Characteristic ¶
type Characteristic interface { Uuid() string WriteCharacteristic(data []byte, resp WriteCharacteristicType) error Subscribe(subType SubscriptionType, f func([]byte)) error Unsubscribe(subType SubscriptionType) error }
type Client ¶
type Client interface { ConnectName(name string, timeout time.Duration) (Peripheral, error) ConnectAddress(address string, timeout time.Duration) (Peripheral, error) Scan(duration time.Duration, handler AdvertisementHandler) error }
type GoBleInitFunc ¶
type Peripheral ¶
type Peripheral interface { Addr() string Disconnect() error FindService(uuid string) Service FindCharacteristic(uuid string) Characteristic WriteCharacteristic(uuid string, data []byte, resp WriteCharacteristicType) error Subscribe(uuid string, subType SubscriptionType, callback func([]byte)) error Unsubscribe(uuid string, subType SubscriptionType) error }
type Service ¶
type Service interface { Uuid() string FindCharacteristic(uuid string) Characteristic }
type SubscriptionType ¶
type SubscriptionType byte
const ( SubscriptionTypeNotification SubscriptionType = 1 SubscriptionTypeIndication SubscriptionType = 2 )
type WriteCharacteristicType ¶
type WriteCharacteristicType byte
const ( NoResponse WriteCharacteristicType = 1 WithResponse WriteCharacteristicType = 2 )
Click to show internal directories.
Click to hide internal directories.