Documentation ¶
Index ¶
- Constants
- Variables
- func HCIConnUpdate(fd *os.File, ...) int
- func NewBLE(remoteAddr *L2Sockaddr, name string) (*os.File, error)
- func NewHCI(dev_id uint8) (*os.File, error)
- type AttPDU
- type ConnInfo
- type DEV_ID
- type Device
- type Error
- type FindByTypeValueRequest
- type FindByTypeValueResponse
- type FindInfoByValueResponse
- type FindInfoRequest
- type FindInfoResponse
- type GroupValue
- type GroupValueLst
- type Handle
- type HandleInfo
- type HandleUUID
- type HandleUUIDLst
- type HandleValue
- type L2Sockaddr
- type Manager
- func (this *Manager) AddDeviceForConn(addr string, nick string, f io.ReadWriteCloser, ci *ConnInfo) *Device
- func (this *Manager) ConnUpdate(device *Device, interval uint16) int
- func (this *Manager) ConnectTCP(addr string, nick string) error
- func (this *Manager) ConnectTo(addrType uint8, addr string, nick string) error
- func (this *Manager) DisconnectFrom(nick string) error
- func (this *Manager) RouteConnUpdate(req Request)
- func (this *Manager) RouteFindByTypeValue(req Request)
- func (this *Manager) RouteFindInfo(req Request)
- func (this *Manager) RouteReadByType(req Request)
- func (this *Manager) RunRouter()
- func (this *Manager) Start(nick string) error
- func (this *Manager) StartDevice(device *Device) error
- func (this *Manager) StartNoDiscover(nick string) error
- type ReadByGroupTypeResponse
- type ReadByTypeRequest
- type ReadByTypeResponse
- type Request
- type Response
- type Transaction
- type UUID
Constants ¶
View Source
const ( ATT_OPCODE_ERROR uint8 = iota ATT_OPCODE_MTU_REQUEST ATT_OPCODE_MTU_RESPONSE ATT_OPCODE_FIND_INFO_REQUEST ATT_OPCODE_FIND_INFO_RESPONSE ATT_OPCODE_FIND_BY_TYPE_VALUE_REQUEST ATT_OPCODE_FIND_BY_TYPE_VALUE_RESPONSE ATT_OPCODE_READ_BY_TYPE_REQUEST ATT_OPCODE_READ_BY_TYPE_RESPONSE ATT_OPCODE_READ_REQUEST ATT_OPCODE_READ_RESPONSE ATT_OPCODE_READ_BLOB_REQUEST ATT_OPCODE_READ_BLOB_RESPONSE ATT_OPCODE_READ_MULTIPLE_REQUEST ATT_OPCODE_READ_MULTIPLE_RESPONSE ATT_OPCODE_READ_BY_GROUP_TYPE_REQUEST ATT_OPCODE_READ_BY_GROUP_TYPE_RESPONSE ATT_OPCODE_WRITE_REQUEST ATT_OPCODE_WRITE_RESPONSE ATT_OPCODE_WRITE_COMMAND = 0x52 ATT_OPCODE_PREPARE_WRITE_REQUEST = 0x16 ATT_OPCODE_PREPARE_WRITE_RESPONSE = 0x17 ATT_OPCODE_EXECUTE_WRITE_REQUEST = 0x18 ATT_OPCODE_EXECUTE_WRITE_RESPONSE = 0x19 ATT_OPCODE_HANDLE_VALUE_NOTIFICATION = 0x1B ATT_OPCODE_HANDLE_VALUE_INDICATION = 0x1D ATT_OPCODE_HANDLE_VALUE_CONFIRMATION = 0x1E ATT_OPCODE_SIGNED_WRITE_COMMAND = 0xD2 ATT_OPCODE_CONN_UPDATE = 0xF0 )
View Source
const ( BTPROTO_L2CAP int = 0 BTPROTO_HCI int = 1 BTPROTO_SCO int = 2 BTPROTO_RFCOM int = 3 BTPROTO_BNEP int = 4 BTPROTO_CMTP int = 5 BTPROTO_HIDP int = 6 BTPROTO_AVDTP int = 7 )
View Source
const ( SOL_HCI int = 0 SOL_L2CAP int = 6 SOL_SCO int = 17 SOL_RFCOMM int = 18 )
View Source
const ( BDADDR_BREDR uint8 = 0x00 BDADDR_LE_PUBLIC uint8 = 0x01 BDADDR_LE_RANDOM uint8 = 0x02 )
View Source
const ( L2CAP_LM int = 0x03 L2CAP_LM_MASTER int = 0x0001 L2CAP_LM_AUTH int = 0x0002 L2CAP_LM_ENCRYPT int = 0x0004 L2CAP_LM_TRUSTED int = 0x0008 L2CAP_LM_RELIABLE int = 0x0010 L2CAP_LM_SECURE int = 0x0020 L2CAP_LM_FIPS int = 0x0040 )
View Source
const AF_BLUETOOTH int = 31
View Source
const (
L2CAP_CONNINFO int = 0x02
)
Variables ¶
View Source
var BLUETOOTH_BASE_UUID [12]byte = [12]byte{0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}
View Source
var Debug bool = false
Functions ¶
func HCIConnUpdate ¶
Types ¶
type ConnInfo ¶
func GetConnInfo ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) Disconnect ¶
func (this *Device) Disconnect()
func (*Device) StrHandles ¶
type FindByTypeValueRequest ¶
type FindByTypeValueRequest struct {
// contains filtered or unexported fields
}
func ParseFindByTypeValueRequest ¶
func ParseFindByTypeValueRequest(msg []byte) (*FindByTypeValueRequest, error)
func (*FindByTypeValueRequest) EndHandle ¶
func (this *FindByTypeValueRequest) EndHandle() uint16
func (*FindByTypeValueRequest) StartHandle ¶
func (this *FindByTypeValueRequest) StartHandle() uint16
func (*FindByTypeValueRequest) Type ¶
func (this *FindByTypeValueRequest) Type() UUID
func (*FindByTypeValueRequest) Value ¶
func (this *FindByTypeValueRequest) Value() []byte
type FindByTypeValueResponse ¶
type FindByTypeValueResponse struct {
// contains filtered or unexported fields
}
func NewFindByTypeValueResponse ¶
func NewFindByTypeValueResponse(vals []*GroupValue) *FindByTypeValueResponse
type FindInfoByValueResponse ¶
type FindInfoByValueResponse struct {
// contains filtered or unexported fields
}
func NewFindInfoByValueResponse ¶
func NewFindInfoByValueResponse(msg []byte) (*FindInfoByValueResponse, error)
func (*FindInfoByValueResponse) Msg ¶
func (this *FindInfoByValueResponse) Msg() []byte
type FindInfoRequest ¶
type FindInfoRequest struct {
// contains filtered or unexported fields
}
func ParseFindInfoRequest ¶
func ParseFindInfoRequest(msg []byte) (*FindInfoRequest, error)
func (*FindInfoRequest) EndHandle ¶
func (this *FindInfoRequest) EndHandle() uint16
func (*FindInfoRequest) StartHandle ¶
func (this *FindInfoRequest) StartHandle() uint16
type FindInfoResponse ¶
type FindInfoResponse struct {
// contains filtered or unexported fields
}
func NewFindInfoResponse ¶
func NewFindInfoResponse(handles []HandleUUID) *FindInfoResponse
func ParseFindInfoResponse ¶
func ParseFindInfoResponse(msg []byte) (*FindInfoResponse, error)
func (*FindInfoResponse) Format ¶
func (this *FindInfoResponse) Format() uint8
func (*FindInfoResponse) InfoData ¶
func (this *FindInfoResponse) InfoData() []*HandleInfo
func (*FindInfoResponse) Msg ¶
func (this *FindInfoResponse) Msg() []byte
type GroupValue ¶
type GroupValue struct {
// contains filtered or unexported fields
}
func DiscoverServices ¶
func DiscoverServices(f *Device) ([]*GroupValue, error)
type GroupValueLst ¶
type GroupValueLst []*GroupValue
func (GroupValueLst) Len ¶
func (this GroupValueLst) Len() int
func (GroupValueLst) Less ¶
func (this GroupValueLst) Less(i, j int) bool
func (GroupValueLst) Swap ¶
func (this GroupValueLst) Swap(i, j int)
type HandleInfo ¶
type HandleInfo struct {
// contains filtered or unexported fields
}
func DiscoverHandles ¶
func DiscoverHandles(f *Device, startHandle uint16, endHandle uint16) ([]*HandleInfo, error)
type HandleUUID ¶
type HandleUUID struct {
// contains filtered or unexported fields
}
type HandleUUIDLst ¶
type HandleUUIDLst []HandleUUID
func (HandleUUIDLst) Len ¶
func (this HandleUUIDLst) Len() int
func (HandleUUIDLst) Less ¶
func (this HandleUUIDLst) Less(i, j int) bool
func (HandleUUIDLst) Swap ¶
func (this HandleUUIDLst) Swap(i, j int)
type HandleValue ¶
type HandleValue struct {
// contains filtered or unexported fields
}
func DiscoverCharacteristics ¶
func DiscoverCharacteristics(f *Device, startHandle uint16, endHandle uint16) ([]*HandleValue, error)
type L2Sockaddr ¶
type L2Sockaddr struct {
// contains filtered or unexported fields
}
func NewL2Sockaddr ¶
func NewL2Sockaddr(channel uint16, addr DEV_ID, addr_type uint8) *L2Sockaddr
type Manager ¶
func NewManager ¶
func (*Manager) AddDeviceForConn ¶
func (*Manager) DisconnectFrom ¶
func (*Manager) RouteConnUpdate ¶
func (*Manager) RouteFindByTypeValue ¶
func (*Manager) RouteFindInfo ¶
func (*Manager) RouteReadByType ¶
func (*Manager) StartDevice ¶
func (*Manager) StartNoDiscover ¶
type ReadByGroupTypeResponse ¶
type ReadByGroupTypeResponse struct {
// contains filtered or unexported fields
}
func ParseReadByGroupTypeResponse ¶
func ParseReadByGroupTypeResponse(msg []byte) (*ReadByGroupTypeResponse, error)
func (*ReadByGroupTypeResponse) DataList ¶
func (this *ReadByGroupTypeResponse) DataList() []*GroupValue
func (*ReadByGroupTypeResponse) Length ¶
func (this *ReadByGroupTypeResponse) Length() uint8
type ReadByTypeRequest ¶
type ReadByTypeRequest struct {
// contains filtered or unexported fields
}
func NewReadByTypeRequest ¶
func NewReadByTypeRequest(startHandle, endHandle uint16, attType UUID) *ReadByTypeRequest
func ParseReadByTypeRequest ¶
func ParseReadByTypeRequest(msg []byte) (*ReadByTypeRequest, error)
func (*ReadByTypeRequest) EndHandle ¶
func (this *ReadByTypeRequest) EndHandle() uint16
func (*ReadByTypeRequest) StartHandle ¶
func (this *ReadByTypeRequest) StartHandle() uint16
func (*ReadByTypeRequest) Type ¶
func (this *ReadByTypeRequest) Type() UUID
type ReadByTypeResponse ¶
type ReadByTypeResponse struct {
// contains filtered or unexported fields
}
func NewReadByTypeResponse ¶
func NewReadByTypeResponse(vals []*GroupValue) *ReadByTypeResponse
func ParseReadByTypeResponse ¶
func ParseReadByTypeResponse(msg []byte) (*ReadByTypeResponse, error)
func (*ReadByTypeResponse) DataList ¶
func (this *ReadByTypeResponse) DataList() []*HandleValue
func (*ReadByTypeResponse) Length ¶
func (this *ReadByTypeResponse) Length() uint8
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.