mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject [36/50] [abbrv] incubator-mynewt-newt git commit: MYNEWT-653 Use runtimeco gatt fork.
Date Mon, 06 Mar 2017 21:17:10 GMT
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/cmd/cmd.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/cmd/cmd.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/cmd/cmd.go
deleted file mode 100644
index 937f802..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/cmd/cmd.go
+++ /dev/null
@@ -1,995 +0,0 @@
-package cmd
-
-import (
-	"bytes"
-	"errors"
-	"fmt"
-	"io"
-	"log"
-
-	"github.com/runtimeinc/gatt/linux/evt"
-	"github.com/runtimeinc/gatt/linux/util"
-)
-
-type CmdParam interface {
-	Marshal([]byte)
-	Opcode() int
-	Len() int
-}
-
-func NewCmd(d io.Writer) *Cmd {
-	c := &Cmd{
-		dev:     d,
-		sent:    []*cmdPkt{},
-		compc:   make(chan evt.CommandCompleteEP),
-		statusc: make(chan evt.CommandStatusEP),
-	}
-	go c.processCmdEvents()
-	return c
-}
-
-type cmdPkt struct {
-	op   int
-	cp   CmdParam
-	done chan []byte
-}
-
-func (c cmdPkt) Marshal() []byte {
-	b := make([]byte, 1+2+1+c.cp.Len())
-	b[0] = byte(0x1) // typCommandPkt
-	b[1] = byte(c.op)
-	b[2] = byte(c.op >> 8)
-	b[3] = byte(c.cp.Len())
-	c.cp.Marshal(b[4:])
-	return b
-}
-
-type Cmd struct {
-	dev     io.Writer
-	sent    []*cmdPkt
-	compc   chan evt.CommandCompleteEP
-	statusc chan evt.CommandStatusEP
-}
-
-func (c Cmd) trace(fmt string, v ...interface{}) {}
-
-func (c *Cmd) HandleComplete(b []byte) error {
-	var e evt.CommandCompleteEP
-	if err := e.Unmarshal(b); err != nil {
-		return err
-	}
-	c.compc <- e
-	return nil
-}
-
-func (c *Cmd) HandleStatus(b []byte) error {
-	var e evt.CommandStatusEP
-	if err := e.Unmarshal(b); err != nil {
-		return err
-	}
-	c.statusc <- e
-	return nil
-}
-
-func (c *Cmd) Send(cp CmdParam) ([]byte, error) {
-	op := cp.Opcode()
-	p := &cmdPkt{op: op, cp: cp, done: make(chan []byte)}
-	raw := p.Marshal()
-
-	c.sent = append(c.sent, p)
-	if n, err := c.dev.Write(raw); err != nil {
-		return nil, err
-	} else if n != len(raw) {
-		return nil, errors.New("Failed to send whole Cmd pkt to HCI socket")
-	}
-	return <-p.done, nil
-}
-
-func (c *Cmd) SendAndCheckResp(cp CmdParam, exp []byte) error {
-	rsp, err := c.Send(cp)
-	if err != nil {
-		return err
-	}
-	// Don't care about the response
-	if len(exp) == 0 {
-		return nil
-	}
-	// Check the if status is one of the expected value
-	if !bytes.Contains(exp, rsp[0:1]) {
-		return fmt.Errorf("HCI command: '0x%04x' return 0x%02X, expect: [%X] ", cp.Opcode(), rsp[0], exp)
-	}
-	return nil
-}
-
-func (c *Cmd) processCmdEvents() {
-	for {
-		select {
-		case status := <-c.statusc:
-			found := false
-			for i, p := range c.sent {
-				if uint16(p.op) == status.CommandOpcode {
-					found = true
-					c.sent = append(c.sent[:i], c.sent[i+1:]...)
-					close(p.done)
-					break
-				}
-			}
-			if !found {
-				log.Printf("Can't find the cmdPkt for this CommandStatusEP: %v", status)
-			}
-		case comp := <-c.compc:
-			found := false
-			for i, p := range c.sent {
-				if uint16(p.op) == comp.CommandOPCode {
-					found = true
-					c.sent = append(c.sent[:i], c.sent[i+1:]...)
-					p.done <- comp.ReturnParameters
-					break
-				}
-			}
-			if !found {
-				log.Printf("Can't find the cmdPkt for this CommandCompleteEP: %v", comp)
-			}
-		}
-	}
-}
-
-const (
-	linkCtl     = 0x01
-	linkPolicy  = 0x02
-	hostCtl     = 0x03
-	infoParam   = 0x04
-	statusParam = 0x05
-	testingCmd  = 0X3E
-	leCtl       = 0x08
-	vendorCmd   = 0X3F
-)
-
-const (
-	opInquiry                = linkCtl<<10 | 0x0001 // Inquiry
-	opInquiryCancel          = linkCtl<<10 | 0x0002 // Inquiry Cancel
-	opPeriodicInquiry        = linkCtl<<10 | 0x0003 // Periodic Inquiry Mode
-	opExitPeriodicInquiry    = linkCtl<<10 | 0x0004 // Exit Periodic Inquiry Mode
-	opCreateConn             = linkCtl<<10 | 0x0005 // Create Connection
-	opDisconnect             = linkCtl<<10 | 0x0006 // Disconnect
-	opCreateConnCancel       = linkCtl<<10 | 0x0008 // Create Connection Cancel
-	opAcceptConnReq          = linkCtl<<10 | 0x0009 // Accept Connection Request
-	opRejectConnReq          = linkCtl<<10 | 0x000A // Reject Connection Request
-	opLinkKeyReply           = linkCtl<<10 | 0x000B // Link Key Request Reply
-	opLinkKeyNegReply        = linkCtl<<10 | 0x000C // Link Key Request Negative Reply
-	opPinCodeReply           = linkCtl<<10 | 0x000D // PIN Code Request Reply
-	opPinCodeNegReply        = linkCtl<<10 | 0x000E // PIN Code Request Negative Reply
-	opSetConnPtype           = linkCtl<<10 | 0x000F // Change Connection Packet Type
-	opAuthRequested          = linkCtl<<10 | 0x0011 // Authentication Request
-	opSetConnEncrypt         = linkCtl<<10 | 0x0013 // Set Connection Encryption
-	opChangeConnLinkKey      = linkCtl<<10 | 0x0015 // Change Connection Link Key
-	opMasterLinkKey          = linkCtl<<10 | 0x0017 // Master Link Key
-	opRemoteNameReq          = linkCtl<<10 | 0x0019 // Remote Name Request
-	opRemoteNameReqCancel    = linkCtl<<10 | 0x001A // Remote Name Request Cancel
-	opReadRemoteFeatures     = linkCtl<<10 | 0x001B // Read Remote Supported Features
-	opReadRemoteExtFeatures  = linkCtl<<10 | 0x001C // Read Remote Extended Features
-	opReadRemoteVersion      = linkCtl<<10 | 0x001D // Read Remote Version Information
-	opReadClockOffset        = linkCtl<<10 | 0x001F // Read Clock Offset
-	opReadLMPHandle          = linkCtl<<10 | 0x0020 // Read LMP Handle
-	opSetupSyncConn          = linkCtl<<10 | 0x0028 // Setup Synchronous Connection
-	opAcceptSyncConnReq      = linkCtl<<10 | 0x0029 // Aceept Synchronous Connection
-	opRejectSyncConnReq      = linkCtl<<10 | 0x002A // Recject Synchronous Connection
-	opIOCapabilityReply      = linkCtl<<10 | 0x002B // IO Capability Request Reply
-	opUserConfirmReply       = linkCtl<<10 | 0x002C // User Confirmation Request Reply
-	opUserConfirmNegReply    = linkCtl<<10 | 0x002D // User Confirmation Negative Reply
-	opUserPasskeyReply       = linkCtl<<10 | 0x002E // User Passkey Request Reply
-	opUserPasskeyNegReply    = linkCtl<<10 | 0x002F // User Passkey Request Negative Reply
-	opRemoteOOBDataReply     = linkCtl<<10 | 0x0030 // Remote OOB Data Request Reply
-	opRemoteOOBDataNegReply  = linkCtl<<10 | 0x0033 // Remote OOB Data Request Negative Reply
-	opIOCapabilityNegReply   = linkCtl<<10 | 0x0034 // IO Capability Request Negative Reply
-	opCreatePhysicalLink     = linkCtl<<10 | 0x0035 // Create Physical Link
-	opAcceptPhysicalLink     = linkCtl<<10 | 0x0036 // Accept Physical Link
-	opDisconnectPhysicalLink = linkCtl<<10 | 0x0037 // Disconnect Physical Link
-	opCreateLogicalLink      = linkCtl<<10 | 0x0038 // Create Logical Link
-	opAcceptLogicalLink      = linkCtl<<10 | 0x0039 // Accept Logical Link
-	opDisconnectLogicalLink  = linkCtl<<10 | 0x003A // Disconnect Logical Link
-	opLogicalLinkCancel      = linkCtl<<10 | 0x003B // Logical Link Cancel
-	opFlowSpecModify         = linkCtl<<10 | 0x003C // Flow Spec Modify
-)
-
-const (
-	opHoldMode               = linkPolicy<<10 | 0x0001 // Hold Mode
-	opSniffMode              = linkPolicy<<10 | 0x0003 // Sniff Mode
-	opExitSniffMode          = linkPolicy<<10 | 0x0004 // Exit Sniff Mode
-	opParkMode               = linkPolicy<<10 | 0x0005 // Park State
-	opExitParkMode           = linkPolicy<<10 | 0x0006 // Exit Park State
-	opQoSSetup               = linkPolicy<<10 | 0x0007 // QoS Setup
-	opRoleDiscovery          = linkPolicy<<10 | 0x0009 // Role Discovery
-	opSwitchRole             = linkPolicy<<10 | 0x000B // Switch Role
-	opReadLinkPolicy         = linkPolicy<<10 | 0x000C // Read Link Policy Settings
-	opWriteLinkPolicy        = linkPolicy<<10 | 0x000D // Write Link Policy Settings
-	opReadDefaultLinkPolicy  = linkPolicy<<10 | 0x000E // Read Default Link Policy Settings
-	opWriteDefaultLinkPolicy = linkPolicy<<10 | 0x000F // Write Default Link Policy Settings
-	opFlowSpecification      = linkPolicy<<10 | 0x0010 // Flow Specification
-	opSniffSubrating         = linkPolicy<<10 | 0x0011 // Sniff Subrating
-)
-
-const (
-	opSetEventMask                      = hostCtl<<10 | 0x0001 // Set Event Mask
-	opReset                             = hostCtl<<10 | 0x0003 // Reset
-	opSetEventFlt                       = hostCtl<<10 | 0x0005 // Set Event Filter
-	opFlush                             = hostCtl<<10 | 0x0008 // Flush
-	opReadPinType                       = hostCtl<<10 | 0x0009 // Read PIN Type
-	opWritePinType                      = hostCtl<<10 | 0x000A // Write PIN Type
-	opCreateNewUnitKey                  = hostCtl<<10 | 0x000B // Create New Unit Key
-	opReadStoredLinkKey                 = hostCtl<<10 | 0x000D // Read Stored Link Key
-	opWriteStoredLinkKey                = hostCtl<<10 | 0x0011 // Write Stored Link Key
-	opDeleteStoredLinkKey               = hostCtl<<10 | 0x0012 // Delete Stored Link Key
-	opWriteLocalName                    = hostCtl<<10 | 0x0013 // Write Local Name
-	opReadLocalName                     = hostCtl<<10 | 0x0014 // Read Local Name
-	opReadConnAcceptTimeout             = hostCtl<<10 | 0x0015 // Read Connection Accept Timeout
-	opWriteConnAcceptTimeout            = hostCtl<<10 | 0x0016 // Write Connection Accept Timeout
-	opReadPageTimeout                   = hostCtl<<10 | 0x0017 // Read Page Timeout
-	opWritePageTimeout                  = hostCtl<<10 | 0x0018 // Write Page Timeout
-	opReadScanEnable                    = hostCtl<<10 | 0x0019 // Read Scan Enable
-	opWriteScanEnable                   = hostCtl<<10 | 0x001A // Write Scan Enable
-	opReadPageActivity                  = hostCtl<<10 | 0x001B // Read Page Scan Activity
-	opWritePageActivity                 = hostCtl<<10 | 0x001C // Write Page Scan Activity
-	opReadInqActivity                   = hostCtl<<10 | 0x001D // Read Inquiry Scan Activity
-	opWriteInqActivity                  = hostCtl<<10 | 0x001E // Write Inquiry Scan Activity
-	opReadAuthEnable                    = hostCtl<<10 | 0x001F // Read Authentication Enable
-	opWriteAuthEnable                   = hostCtl<<10 | 0x0020 // Write Authentication Enable
-	opReadEncryptMode                   = hostCtl<<10 | 0x0021
-	opWriteEncryptMode                  = hostCtl<<10 | 0x0022
-	opReadClassOfDev                    = hostCtl<<10 | 0x0023 // Read Class of Device
-	opWriteClassOfDevice                = hostCtl<<10 | 0x0024 // Write Class of Device
-	opReadVoiceSetting                  = hostCtl<<10 | 0x0025 // Read Voice Setting
-	opWriteVoiceSetting                 = hostCtl<<10 | 0x0026 // Write Voice Setting
-	opReadAutomaticFlushTimeout         = hostCtl<<10 | 0x0027 // Read Automatic Flush Timeout
-	opWriteAutomaticFlushTimeout        = hostCtl<<10 | 0x0028 // Write Automatic Flush Timeout
-	opReadNumBroadcastRetrans           = hostCtl<<10 | 0x0029 // Read Num Broadcast Retransmissions
-	opWriteNumBroadcastRetrans          = hostCtl<<10 | 0x002A // Write Num Broadcast Retransmissions
-	opReadHoldModeActivity              = hostCtl<<10 | 0x002B // Read Hold Mode Activity
-	opWriteHoldModeActivity             = hostCtl<<10 | 0x002C // Write Hold Mode Activity
-	opReadTransmitPowerLevel            = hostCtl<<10 | 0x002D // Read Transmit Power Level
-	opReadSyncFlowEnable                = hostCtl<<10 | 0x002E // Read Synchronous Flow Control
-	opWriteSyncFlowEnable               = hostCtl<<10 | 0x002F // Write Synchronous Flow Control
-	opSetControllerToHostFC             = hostCtl<<10 | 0x0031 // Set Controller To Host Flow Control
-	opHostBufferSize                    = hostCtl<<10 | 0x0033 // Host Buffer Size
-	opHostNumCompPkts                   = hostCtl<<10 | 0x0035 // Host Number Of Completed Packets
-	opReadLinkSupervisionTimeout        = hostCtl<<10 | 0x0036 // Read Link Supervision Timeout
-	opWriteLinkSupervisionTimeout       = hostCtl<<10 | 0x0037 // Write Link Supervision Timeout
-	opReadNumSupportedIAC               = hostCtl<<10 | 0x0038 // Read Number Of Supported IAC
-	opReadCurrentIACLAP                 = hostCtl<<10 | 0x0039 // Read Current IAC LAP
-	opWriteCurrentIACLAP                = hostCtl<<10 | 0x003A // Write Current IAC LAP
-	opReadPageScanPeriodMode            = hostCtl<<10 | 0x003B
-	opWritePageScanPeriodMode           = hostCtl<<10 | 0x003C
-	opReadPageScanMode                  = hostCtl<<10 | 0x003D
-	opWritePageScanMode                 = hostCtl<<10 | 0x003E
-	opSetAFHClassification              = hostCtl<<10 | 0x003F // Set AFH Host Channel Classification
-	opReadInquiryScanType               = hostCtl<<10 | 0x0042 // Read Inquiry Scan Type
-	opWriteInquiryScanType              = hostCtl<<10 | 0x0043 // Write Inquiry Scan Type
-	opReadInquiryMode                   = hostCtl<<10 | 0x0044 // Read Inquiry Mode
-	opWriteInquiryMode                  = hostCtl<<10 | 0x0045 // Write Inquiry Mode
-	opReadPageScanType                  = hostCtl<<10 | 0x0046 // Read Page Scan Type
-	opWritePageScanType                 = hostCtl<<10 | 0x0047 // Write Page Scan Type
-	opReadAFHMode                       = hostCtl<<10 | 0x0048 // Read AFH Channel Assessment Mode
-	opWriteAFHMode                      = hostCtl<<10 | 0x0049 // Write AFH Channel Assesment Mode
-	opReadExtInquiryResponse            = hostCtl<<10 | 0x0051 // Read Extended Inquiry Response
-	opWriteExtInquiryResponse           = hostCtl<<10 | 0x0052 // Write Extended Inquiry Response
-	opRefreshEncryptionKey              = hostCtl<<10 | 0x0053 // Refresh Encryption Key
-	opReadSimplePairingMode             = hostCtl<<10 | 0x0055 // Read Simple Pairing Mode
-	opWriteSimplePairingMode            = hostCtl<<10 | 0x0056 // Write Simple Pairing Mode
-	opReadLocalOobData                  = hostCtl<<10 | 0x0057 // Read Local OOB Data
-	opReadInqResponseTransmitPowerLevel = hostCtl<<10 | 0x0058 // Read Inquiry Response Transmit Power Level
-	opWriteInquiryTransmitPowerLevel    = hostCtl<<10 | 0x0059 // Write Inquiry Response Transmit Power Level
-	opReadDefaultErrorDataReporting     = hostCtl<<10 | 0x005A // Read Default Erroneous Data Reporting
-	opWriteDefaultErrorDataReporting    = hostCtl<<10 | 0x005B // Write Default Erroneous Data Reporting
-	opEnhancedFlush                     = hostCtl<<10 | 0x005F // Enhanced Flush
-	opSendKeypressNotify                = hostCtl<<10 | 0x0060 // send Keypress Notification
-	opReadLogicalLinkAcceptTimeout      = hostCtl<<10 | 0x0061 // Read Logical Link Accept Timeout
-	opWriteLogicalLinkAcceptTimeout     = hostCtl<<10 | 0x0062 // Write Logical Link Accept Timeout
-	opSetEventMaskPage2                 = hostCtl<<10 | 0x0063 // Set Event Mask Page 2
-	opReadLocationData                  = hostCtl<<10 | 0x0064 // Read Location Data
-	opWriteLocationData                 = hostCtl<<10 | 0x0065 // Write Location Data
-	opReadFlowControlMode               = hostCtl<<10 | 0x0066 // Read Flow Control Mode
-	opWriteFlowControlMode              = hostCtl<<10 | 0x0067 // Write Flow Control Mode
-	opReadEnhancedTransmitpowerLevel    = hostCtl<<10 | 0x0068 // Read Enhanced Transmit Power Level
-	opReadBestEffortFlushTimeout        = hostCtl<<10 | 0x0069 // Read Best Effort Flush Timeout
-	opWriteBestEffortFlushTimeout       = hostCtl<<10 | 0x006A // Write Best Effort Flush Timeout
-	opReadLEHostSupported               = hostCtl<<10 | 0x006C // Read LE Host Supported
-	opWriteLEHostSupported              = hostCtl<<10 | 0x006D // Write LE Host Supported
-)
-const (
-	opReadLocalVersionInformation = infoParam<<10 | 0x0001 // Read Local Version Information
-	opReadLocalSupportedCommands  = infoParam<<10 | 0x0002 // Read Local Supported Commands
-	opReadLocalSupportedFeatures  = infoParam<<10 | 0x0003 // Read Local Supported Features
-	opReadLocalExtendedFeatures   = infoParam<<10 | 0x0004 // Read Local Extended Features
-	opReadBufferSize              = infoParam<<10 | 0x0005 // Read Buffer Size
-	opReadBDADDR                  = infoParam<<10 | 0x0009 // Read BD_ADDR
-	opReadDataBlockSize           = infoParam<<10 | 0x000A // Read Data Block Size
-	opReadLocalSupportedCodecs    = infoParam<<10 | 0x000B // Read Local Supported Codecs
-)
-const (
-	opLESetEventMask                      = leCtl<<10 | 0x0001 // LE Set Event Mask
-	opLEReadBufferSize                    = leCtl<<10 | 0x0002 // LE Read Buffer Size
-	opLEReadLocalSupportedFeatures        = leCtl<<10 | 0x0003 // LE Read Local Supported Features
-	opLESetRandomAddress                  = leCtl<<10 | 0x0005 // LE Set Random Address
-	opLESetAdvertisingParameters          = leCtl<<10 | 0x0006 // LE Set Advertising Parameters
-	opLEReadAdvertisingChannelTxPower     = leCtl<<10 | 0x0007 // LE Read Advertising Channel Tx Power
-	opLESetAdvertisingData                = leCtl<<10 | 0x0008 // LE Set Advertising Data
-	opLESetScanResponseData               = leCtl<<10 | 0x0009 // LE Set Scan Response Data
-	opLESetAdvertiseEnable                = leCtl<<10 | 0x000a // LE Set Advertising Enable
-	opLESetScanParameters                 = leCtl<<10 | 0x000b // LE Set Scan Parameters
-	opLESetScanEnable                     = leCtl<<10 | 0x000c // LE Set Scan Enable
-	opLECreateConn                        = leCtl<<10 | 0x000d // LE Create Connection
-	opLECreateConnCancel                  = leCtl<<10 | 0x000e // LE Create Connection Cancel
-	opLEReadWhiteListSize                 = leCtl<<10 | 0x000f // LE Read White List Size
-	opLEClearWhiteList                    = leCtl<<10 | 0x0010 // LE Clear White List
-	opLEAddDeviceToWhiteList              = leCtl<<10 | 0x0011 // LE Add Device To White List
-	opLERemoveDeviceFromWhiteList         = leCtl<<10 | 0x0012 // LE Remove Device From White List
-	opLEConnUpdate                        = leCtl<<10 | 0x0013 // LE Connection Update
-	opLESetHostChannelClassification      = leCtl<<10 | 0x0014 // LE Set Host Channel Classification
-	opLEReadChannelMap                    = leCtl<<10 | 0x0015 // LE Read Channel Map
-	opLEReadRemoteUsedFeatures            = leCtl<<10 | 0x0016 // LE Read Remote Used Features
-	opLEEncrypt                           = leCtl<<10 | 0x0017 // LE Encrypt
-	opLERand                              = leCtl<<10 | 0x0018 // LE Rand
-	opLEStartEncryption                   = leCtl<<10 | 0x0019 // LE Star Encryption
-	opLELTKReply                          = leCtl<<10 | 0x001a // LE Long Term Key Request Reply
-	opLELTKNegReply                       = leCtl<<10 | 0x001b // LE Long Term Key Request Negative Reply
-	opLEReadSupportedStates               = leCtl<<10 | 0x001c // LE Read Supported States
-	opLEReceiverTest                      = leCtl<<10 | 0x001d // LE Reciever Test
-	opLETransmitterTest                   = leCtl<<10 | 0x001e // LE Transmitter Test
-	opLETestEnd                           = leCtl<<10 | 0x001f // LE Test End
-	opLERemoteConnectionParameterReply    = leCtl<<10 | 0x0020 // LE Remote Connection Parameter Request Reply
-	opLERemoteConnectionParameterNegReply = leCtl<<10 | 0x0021 // LE Remote Connection Parameter Request Negative Reply
-)
-
-var o = util.Order
-
-// Link Control Commands
-
-// Disconnect (0x0006)
-type Disconnect struct {
-	ConnectionHandle uint16
-	Reason           uint8
-}
-
-func (c Disconnect) Opcode() int { return opDisconnect }
-func (c Disconnect) Len() int    { return 3 }
-func (c Disconnect) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	b[2] = c.Reason
-}
-
-// No Return Parameters, Check for Disconnection Complete Event
-type DisconnectRP struct{}
-
-// Link Policy Commands
-
-// Write Default Link Policy
-type WriteDefaultLinkPolicy struct{ DefaultLinkPolicySettings uint16 }
-
-func (c WriteDefaultLinkPolicy) Opcode() int      { return opWriteDefaultLinkPolicy }
-func (c WriteDefaultLinkPolicy) Len() int         { return 2 }
-func (c WriteDefaultLinkPolicy) Marshal(b []byte) { o.PutUint16(b, c.DefaultLinkPolicySettings) }
-
-type WriteDefaultLinkPolicyRP struct{ Status uint8 }
-
-// Host Control Commands
-
-// Set Event Mask (0x0001)
-type SetEventMask struct{ EventMask uint64 }
-
-func (c SetEventMask) Opcode() int      { return opSetEventMask }
-func (c SetEventMask) Len() int         { return 8 }
-func (c SetEventMask) Marshal(b []byte) { o.PutUint64(b, c.EventMask) }
-
-type SetEventMaskRP struct{ Status uint8 }
-
-// Reset (0x0002)
-type Reset struct{}
-
-func (c Reset) Opcode() int      { return opReset }
-func (c Reset) Len() int         { return 0 }
-func (c Reset) Marshal(b []byte) {}
-
-type ResetRP struct{ Status uint8 }
-
-// Set Event Filter (0x0003)
-// FIXME: This structures are overloading.
-// Both Marshal() and Len() are just placeholder.
-// Need more effort for decoding.
-// type SetEventFlt struct {
-// 	FilterType          uint8
-// 	FilterConditionType uint8
-// 	Condition           uint8
-// }
-
-// func (c SetEventFlt) Opcode() int   { return opSetEventFlt }
-// func (c SetEventFlt) Len() int         { return 0 }
-// func (c SetEventFlt) Marshal(b []byte) {}
-
-type SetEventFltRP struct{ Status uint8 }
-
-// Flush (0x0008)
-type Flush struct{ ConnectionHandle uint16 }
-
-func (c Flush) Opcode() int      { return opFlush }
-func (c Flush) Len() int         { return 2 }
-func (c Flush) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) }
-
-type flushRP struct{ status uint8 }
-
-// Write Page Timeout (0x0018)
-type WritePageTimeout struct{ PageTimeout uint16 }
-
-func (c WritePageTimeout) Opcode() int      { return opWritePageTimeout }
-func (c WritePageTimeout) Len() int         { return 2 }
-func (c WritePageTimeout) Marshal(b []byte) { o.PutUint16(b, c.PageTimeout) }
-
-type WritePageTimeoutRP struct{}
-
-// Write Class of Device (0x0024)
-type WriteClassOfDevice struct{ ClassOfDevice [3]byte }
-
-func (c WriteClassOfDevice) Opcode() int      { return opWriteClassOfDevice }
-func (c WriteClassOfDevice) Len() int         { return 3 }
-func (c WriteClassOfDevice) Marshal(b []byte) { copy(b, c.ClassOfDevice[:]) }
-
-type WriteClassOfDevRP struct{ status uint8 }
-
-// Write Host Buffer Size (0x0033)
-type HostBufferSize struct {
-	HostACLDataPacketLength            uint16
-	HostSynchronousDataPacketLength    uint8
-	HostTotalNumACLDataPackets         uint16
-	HostTotalNumSynchronousDataPackets uint16
-}
-
-func (c HostBufferSize) Opcode() int { return opHostBufferSize }
-func (c HostBufferSize) Len() int    { return 7 }
-func (c HostBufferSize) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.HostACLDataPacketLength)
-	o.PutUint8(b[2:], c.HostSynchronousDataPacketLength)
-	o.PutUint16(b[3:], c.HostTotalNumACLDataPackets)
-	o.PutUint16(b[5:], c.HostTotalNumSynchronousDataPackets)
-}
-
-type HostBufferSizeRP struct{ Status uint8 }
-
-// Write Inquiry Scan Type (0x0043)
-type WriteInquiryScanType struct{ ScanType uint8 }
-
-func (c WriteInquiryScanType) Opcode() int      { return opWriteInquiryScanType }
-func (c WriteInquiryScanType) Len() int         { return 1 }
-func (c WriteInquiryScanType) Marshal(b []byte) { b[0] = c.ScanType }
-
-type WriteInquiryScanTypeRP struct{ Status uint8 }
-
-// Write Inquiry Mode (0x0045)
-type WriteInquiryMode struct {
-	InquiryMode uint8
-}
-
-func (c WriteInquiryMode) Opcode() int      { return opWriteInquiryMode }
-func (c WriteInquiryMode) Len() int         { return 1 }
-func (c WriteInquiryMode) Marshal(b []byte) { b[0] = c.InquiryMode }
-
-type WriteInquiryModeRP struct{ Status uint8 }
-
-// Write Page Scan Type (0x0046)
-type WritePageScanType struct{ PageScanType uint8 }
-
-func (c WritePageScanType) Opcode() int      { return opWritePageScanType }
-func (c WritePageScanType) Len() int         { return 1 }
-func (c WritePageScanType) Marshal(b []byte) { b[0] = c.PageScanType }
-
-type WritePageScanTypeRP struct{ Status uint8 }
-
-// Write Simple Pairing Mode (0x0056)
-type WriteSimplePairingMode struct{ SimplePairingMode uint8 }
-
-func (c WriteSimplePairingMode) Opcode() int      { return opWriteSimplePairingMode }
-func (c WriteSimplePairingMode) Len() int         { return 1 }
-func (c WriteSimplePairingMode) Marshal(b []byte) { b[0] = c.SimplePairingMode }
-
-type WriteSimplePairingModeRP struct{}
-
-// Set Event Mask Page 2 (0x0063)
-type SetEventMaskPage2 struct{ EventMaskPage2 uint64 }
-
-func (c SetEventMaskPage2) Opcode() int      { return opSetEventMaskPage2 }
-func (c SetEventMaskPage2) Len() int         { return 8 }
-func (c SetEventMaskPage2) Marshal(b []byte) { o.PutUint64(b, c.EventMaskPage2) }
-
-type SetEventMaskPage2RP struct{ Status uint8 }
-
-// Write LE Host Supported (0x006D)
-type WriteLEHostSupported struct {
-	LESupportedHost    uint8
-	SimultaneousLEHost uint8
-}
-
-func (c WriteLEHostSupported) Opcode() int      { return opWriteLEHostSupported }
-func (c WriteLEHostSupported) Len() int         { return 2 }
-func (c WriteLEHostSupported) Marshal(b []byte) { b[0], b[1] = c.LESupportedHost, c.SimultaneousLEHost }
-
-type WriteLeHostSupportedRP struct{ Status uint8 }
-
-// LE Controller Commands
-
-// LE Set Event Mask (0x0001)
-type LESetEventMask struct{ LEEventMask uint64 }
-
-func (c LESetEventMask) Opcode() int      { return opLESetEventMask }
-func (c LESetEventMask) Len() int         { return 8 }
-func (c LESetEventMask) Marshal(b []byte) { o.PutUint64(b, c.LEEventMask) }
-
-type LESetEventMaskRP struct{ Status uint8 }
-
-// LE Read Buffer Size (0x0002)
-type LEReadBufferSize struct{}
-
-func (c LEReadBufferSize) Opcode() int      { return opLEReadBufferSize }
-func (c LEReadBufferSize) Len() int         { return 1 }
-func (c LEReadBufferSize) Marshal(b []byte) {}
-
-type LEReadBufferSizeRP struct {
-	Status                     uint8
-	HCLEACLDataPacketLength    uint16
-	HCTotalNumLEACLDataPackets uint8
-}
-
-// LE Read Local Supported Features (0x0003)
-type LEReadLocalSupportedFeatures struct{}
-
-func (c LEReadLocalSupportedFeatures) Opcode() int      { return opLEReadLocalSupportedFeatures }
-func (c LEReadLocalSupportedFeatures) Len() int         { return 0 }
-func (c LEReadLocalSupportedFeatures) Marshal(b []byte) {}
-
-type LEReadLocalSupportedFeaturesRP struct {
-	Status     uint8
-	LEFeatures uint64
-}
-
-// LE Set Random Address (0x0005)
-type LESetRandomAddress struct{ RandomAddress [6]byte }
-
-func (c LESetRandomAddress) Opcode() int      { return opLESetRandomAddress }
-func (c LESetRandomAddress) Len() int         { return 6 }
-func (c LESetRandomAddress) Marshal(b []byte) { o.PutMAC(b, c.RandomAddress) }
-
-type LESetRandomAddressRP struct{ Status uint8 }
-
-// LE Set Advertising Parameters (0x0006)
-type LESetAdvertisingParameters struct {
-	AdvertisingIntervalMin  uint16
-	AdvertisingIntervalMax  uint16
-	AdvertisingType         uint8
-	OwnAddressType          uint8
-	DirectAddressType       uint8
-	DirectAddress           [6]byte
-	AdvertisingChannelMap   uint8
-	AdvertisingFilterPolicy uint8
-}
-
-func (c LESetAdvertisingParameters) Opcode() int { return opLESetAdvertisingParameters }
-func (c LESetAdvertisingParameters) Len() int    { return 15 }
-func (c LESetAdvertisingParameters) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.AdvertisingIntervalMin)
-	o.PutUint16(b[2:], c.AdvertisingIntervalMax)
-	o.PutUint8(b[4:], c.AdvertisingType)
-	o.PutUint8(b[5:], c.OwnAddressType)
-	o.PutUint8(b[6:], c.DirectAddressType)
-	o.PutMAC(b[7:], c.DirectAddress)
-	o.PutUint8(b[13:], c.AdvertisingChannelMap)
-	o.PutUint8(b[14:], c.AdvertisingFilterPolicy)
-}
-
-type LESetAdvertisingParametersRP struct{ Status uint8 }
-
-// LE Read Advertising Channel Tx Power (0x0007)
-type LEReadAdvertisingChannelTxPower struct{}
-
-func (c LEReadAdvertisingChannelTxPower) Opcode() int      { return opLEReadAdvertisingChannelTxPower }
-func (c LEReadAdvertisingChannelTxPower) Len() int         { return 0 }
-func (c LEReadAdvertisingChannelTxPower) Marshal(b []byte) {}
-
-type LEReadAdvertisingChannelTxPowerRP struct {
-	Status             uint8
-	TransmitPowerLevel uint8
-}
-
-// LE Set Advertising Data (0x0008)
-type LESetAdvertisingData struct {
-	AdvertisingDataLength uint8
-	AdvertisingData       [31]byte
-}
-
-func (c LESetAdvertisingData) Opcode() int { return opLESetAdvertisingData }
-func (c LESetAdvertisingData) Len() int    { return 32 }
-func (c LESetAdvertisingData) Marshal(b []byte) {
-	b[0] = c.AdvertisingDataLength
-	copy(b[1:], c.AdvertisingData[:c.AdvertisingDataLength])
-}
-
-type LESetAdvertisingDataRP struct{ Status uint8 }
-
-// LE Set Scan Response Data (0x0009)
-type LESetScanResponseData struct {
-	ScanResponseDataLength uint8
-	ScanResponseData       [31]byte
-}
-
-func (c LESetScanResponseData) Opcode() int { return opLESetScanResponseData }
-func (c LESetScanResponseData) Len() int    { return 32 }
-func (c LESetScanResponseData) Marshal(b []byte) {
-	b[0] = c.ScanResponseDataLength
-	copy(b[1:], c.ScanResponseData[:c.ScanResponseDataLength])
-}
-
-type LESetScanResponseDataRP struct{ Status uint8 }
-
-// LE Set Advertising Enable (0x000A)
-type LESetAdvertiseEnable struct{ AdvertisingEnable uint8 }
-
-func (c LESetAdvertiseEnable) Opcode() int      { return opLESetAdvertiseEnable }
-func (c LESetAdvertiseEnable) Len() int         { return 1 }
-func (c LESetAdvertiseEnable) Marshal(b []byte) { b[0] = c.AdvertisingEnable }
-
-type LESetAdvertiseEnableRP struct{ Status uint8 }
-
-// LE Set Scan Parameters (0x000B)
-type LESetScanParameters struct {
-	LEScanType           uint8
-	LEScanInterval       uint16
-	LEScanWindow         uint16
-	OwnAddressType       uint8
-	ScanningFilterPolicy uint8
-}
-
-func (c LESetScanParameters) Opcode() int { return opLESetScanParameters }
-func (c LESetScanParameters) Len() int    { return 7 }
-func (c LESetScanParameters) Marshal(b []byte) {
-	o.PutUint8(b[0:], c.LEScanType)
-	o.PutUint16(b[1:], c.LEScanInterval)
-	o.PutUint16(b[3:], c.LEScanWindow)
-	o.PutUint8(b[5:], c.OwnAddressType)
-	o.PutUint8(b[6:], c.ScanningFilterPolicy)
-}
-
-type LESetScanParametersRP struct{ Status uint8 }
-
-// LE Set Scan Enable (0x000C)
-type LESetScanEnable struct {
-	LEScanEnable     uint8
-	FilterDuplicates uint8
-}
-
-func (c LESetScanEnable) Opcode() int      { return opLESetScanEnable }
-func (c LESetScanEnable) Len() int         { return 2 }
-func (c LESetScanEnable) Marshal(b []byte) { b[0], b[1] = c.LEScanEnable, c.FilterDuplicates }
-
-type LESetScanEnableRP struct{ Status uint8 }
-
-// LE Create Connection (0x000D)
-type LECreateConn struct {
-	LEScanInterval        uint16
-	LEScanWindow          uint16
-	InitiatorFilterPolicy uint8
-	PeerAddressType       uint8
-	PeerAddress           [6]byte
-	OwnAddressType        uint8
-	ConnIntervalMin       uint16
-	ConnIntervalMax       uint16
-	ConnLatency           uint16
-	SupervisionTimeout    uint16
-	MinimumCELength       uint16
-	MaximumCELength       uint16
-}
-
-func (c LECreateConn) Opcode() int { return opLECreateConn }
-func (c LECreateConn) Len() int    { return 25 }
-func (c LECreateConn) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.LEScanInterval)
-	o.PutUint16(b[2:], c.LEScanWindow)
-	o.PutUint8(b[4:], c.InitiatorFilterPolicy)
-	o.PutUint8(b[5:], c.PeerAddressType)
-	o.PutMAC(b[6:], c.PeerAddress)
-	o.PutUint8(b[12:], c.OwnAddressType)
-	o.PutUint16(b[13:], c.ConnIntervalMin)
-	o.PutUint16(b[15:], c.ConnIntervalMax)
-	o.PutUint16(b[17:], c.ConnLatency)
-	o.PutUint16(b[19:], c.SupervisionTimeout)
-	o.PutUint16(b[21:], c.MinimumCELength)
-	o.PutUint16(b[23:], c.MaximumCELength)
-}
-
-type LECreateConnRP struct{}
-
-// LE Create Connection Cancel (0x000E)
-type LECreateConnCancel struct{}
-
-func (c LECreateConnCancel) Opcode() int      { return opLECreateConnCancel }
-func (c LECreateConnCancel) Len() int         { return 0 }
-func (c LECreateConnCancel) Marshal(b []byte) {}
-
-type LECreateConnCancelRP struct{ Status uint8 }
-
-// LE Read White List Size (0x000F)
-type LEReadWhiteListSize struct{}
-
-func (c LEReadWhiteListSize) Opcode() int      { return opLEReadWhiteListSize }
-func (c LEReadWhiteListSize) Len() int         { return 0 }
-func (c LEReadWhiteListSize) Marshal(b []byte) {}
-
-type LEReadWhiteListSizeRP struct {
-	Status        uint8
-	WhiteListSize uint8
-}
-
-// LE Clear White List (0x0010)
-type LEClearWhiteList struct{}
-
-func (c LEClearWhiteList) Opcode() int      { return opLEClearWhiteList }
-func (c LEClearWhiteList) Len() int         { return 0 }
-func (c LEClearWhiteList) Marshal(b []byte) {}
-
-type LEClearWhiteListRP struct{ Status uint8 }
-
-// LE Add Device To White List (0x0011)
-type LEAddDeviceToWhiteList struct {
-	AddressType uint8
-	Address     [6]byte
-}
-
-func (c LEAddDeviceToWhiteList) Opcode() int { return opLEAddDeviceToWhiteList }
-func (c LEAddDeviceToWhiteList) Len() int    { return 7 }
-func (c LEAddDeviceToWhiteList) Marshal(b []byte) {
-	b[0] = c.AddressType
-	o.PutMAC(b[1:], c.Address)
-}
-
-type LEAddDeviceToWhiteListRP struct{ Status uint8 }
-
-// LE Remove Device From White List (0x0012)
-type LERemoveDeviceFromWhiteList struct {
-	AddressType uint8
-	Address     [6]byte
-}
-
-func (c LERemoveDeviceFromWhiteList) Opcode() int { return opLERemoveDeviceFromWhiteList }
-func (c LERemoveDeviceFromWhiteList) Len() int    { return 7 }
-func (c LERemoveDeviceFromWhiteList) Marshal(b []byte) {
-	b[0] = c.AddressType
-	o.PutMAC(b[1:], c.Address)
-}
-
-type LERemoveDeviceFromWhiteListRP struct{ Status uint8 }
-
-// LE Connection Update (0x0013)
-type LEConnUpdate struct {
-	ConnectionHandle   uint16
-	ConnIntervalMin    uint16
-	ConnIntervalMax    uint16
-	ConnLatency        uint16
-	SupervisionTimeout uint16
-	MinimumCELength    uint16
-	MaximumCELength    uint16
-}
-
-func (c LEConnUpdate) Opcode() int { return opLEConnUpdate }
-func (c LEConnUpdate) Len() int    { return 14 }
-func (c LEConnUpdate) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	o.PutUint16(b[2:], c.ConnIntervalMin)
-	o.PutUint16(b[4:], c.ConnIntervalMax)
-	o.PutUint16(b[6:], c.ConnLatency)
-	o.PutUint16(b[8:], c.SupervisionTimeout)
-	o.PutUint16(b[10:], c.MinimumCELength)
-	o.PutUint16(b[12:], c.MaximumCELength)
-}
-
-type LEConnUpdateRP struct{}
-
-// LE Set Host Channel Classification (0x0014)
-type LESetHostChannelClassification struct{ ChannelMap [5]byte }
-
-func (c LESetHostChannelClassification) Opcode() int      { return opLESetHostChannelClassification }
-func (c LESetHostChannelClassification) Len() int         { return 5 }
-func (c LESetHostChannelClassification) Marshal(b []byte) { copy(b, c.ChannelMap[:]) }
-
-type LESetHostChannelClassificationRP struct{ Status uint8 }
-
-// LE Read Channel Map (0x0015)
-type LEReadChannelMap struct{ ConnectionHandle uint16 }
-
-func (c LEReadChannelMap) Opcode() int      { return opLEReadChannelMap }
-func (c LEReadChannelMap) Len() int         { return 2 }
-func (c LEReadChannelMap) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) }
-
-type LEReadChannelMapRP struct {
-	Status           uint8
-	ConnectionHandle uint16
-	ChannelMap       [5]byte
-}
-
-// LE Read Remote Used Features (0x0016)
-type LEReadRemoteUsedFeatures struct{ ConnectionHandle uint16 }
-
-func (c LEReadRemoteUsedFeatures) Opcode() int      { return opLEReadRemoteUsedFeatures }
-func (c LEReadRemoteUsedFeatures) Len() int         { return 8 }
-func (c LEReadRemoteUsedFeatures) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) }
-
-type LEReadRemoteUsedFeaturesRP struct{}
-
-// LE Encrypt (0x0017)
-type LEEncrypt struct {
-	Key           [16]byte
-	PlaintextData [16]byte
-}
-
-func (c LEEncrypt) Opcode() int { return opLEEncrypt }
-func (c LEEncrypt) Len() int    { return 32 }
-func (c LEEncrypt) Marshal(b []byte) {
-	copy(b[0:], c.Key[:])
-	copy(b[16:], c.PlaintextData[:])
-}
-
-type LEEncryptRP struct {
-	Stauts        uint8
-	EncryptedData [16]byte
-}
-
-// LE Rand (0x0018)
-type LERand struct{}
-
-func (c LERand) Opcode() int      { return opLERand }
-func (c LERand) Len() int         { return 0 }
-func (c LERand) Marshal(b []byte) {}
-
-type LERandRP struct {
-	Status       uint8
-	RandomNumber uint64
-}
-
-// LE Start Encryption (0x0019)
-type LEStartEncryption struct {
-	ConnectionHandle     uint16
-	RandomNumber         uint64
-	EncryptedDiversifier uint16
-	LongTermKey          [16]byte
-}
-
-func (c LEStartEncryption) Opcode() int { return opLEStartEncryption }
-func (c LEStartEncryption) Len() int    { return 28 }
-func (c LEStartEncryption) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	o.PutUint64(b[2:], c.RandomNumber)
-	o.PutUint16(b[10:], c.EncryptedDiversifier)
-	copy(b[12:], c.LongTermKey[:])
-}
-
-type LEStartEncryptionRP struct{}
-
-// LE Long Term Key Reply (0x001A)
-type LELTKReply struct {
-	ConnectionHandle uint16
-	LongTermKey      [16]byte
-}
-
-func (c LELTKReply) Opcode() int { return opLELTKReply }
-func (c LELTKReply) Len() int    { return 18 }
-func (c LELTKReply) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	copy(b[2:], c.LongTermKey[:])
-}
-
-type LELTKReplyRP struct {
-	Status           uint8
-	ConnectionHandle uint16
-}
-
-// LE Long Term Key  Negative Reply (0x001B)
-type LELTKNegReply struct{ ConnectionHandle uint16 }
-
-func (c LELTKNegReply) Opcode() int      { return opLELTKNegReply }
-func (c LELTKNegReply) Len() int         { return 2 }
-func (c LELTKNegReply) Marshal(b []byte) { o.PutUint16(b, c.ConnectionHandle) }
-
-type LELTKNegReplyRP struct {
-	Status           uint8
-	ConnectionHandle uint16
-}
-
-// LE Read Supported States (0x001C)
-type LEReadSupportedStates struct{}
-
-func (c LEReadSupportedStates) Opcode() int      { return opLEReadSupportedStates }
-func (c LEReadSupportedStates) Len() int         { return 0 }
-func (c LEReadSupportedStates) Marshal(b []byte) {}
-
-type LEReadSupportedStatesRP struct {
-	Status   uint8
-	LEStates [8]byte
-}
-
-// LE Reciever Test (0x001D)
-type LEReceiverTest struct{ RxChannel uint8 }
-
-func (c LEReceiverTest) Opcode() int      { return opLEReceiverTest }
-func (c LEReceiverTest) Len() int         { return 1 }
-func (c LEReceiverTest) Marshal(b []byte) { b[0] = c.RxChannel }
-
-type LEReceiverTestRP struct{ Status uint8 }
-
-// LE Transmitter Test (0x001E)
-type LETransmitterTest struct {
-	TxChannel        uint8
-	LengthOfTestData uint8
-	PacketPayload    uint8
-}
-
-func (c LETransmitterTest) Opcode() int { return opLETransmitterTest }
-func (c LETransmitterTest) Len() int    { return 3 }
-func (c LETransmitterTest) Marshal(b []byte) {
-	b[0], b[1], b[2] = c.TxChannel, c.LengthOfTestData, c.PacketPayload
-}
-
-type LETransmitterTestRP struct{ Status uint8 }
-
-// LE Test End (0x001F)
-type LETestEnd struct{}
-
-func (c LETestEnd) Opcode() int      { return opLETestEnd }
-func (c LETestEnd) Len() int         { return 0 }
-func (c LETestEnd) Marshal(b []byte) {}
-
-type LETestEndRP struct {
-	Status          uint8
-	NumberOfPackets uint16
-}
-
-// LE Remote Connection Parameters Reply (0x0020)
-type LERemoteConnectionParameterReply struct {
-	ConnectionHandle uint16
-	IntervalMin      uint16
-	IntervalMax      uint16
-	Latency          uint16
-	Timeout          uint16
-	MinimumCELength  uint16
-	MaximumCELength  uint16
-}
-
-func (c LERemoteConnectionParameterReply) Opcode() int { return opLERemoteConnectionParameterReply }
-func (c LERemoteConnectionParameterReply) Len() int    { return 14 }
-func (c LERemoteConnectionParameterReply) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	o.PutUint16(b[2:], c.IntervalMin)
-	o.PutUint16(b[4:], c.IntervalMax)
-	o.PutUint16(b[6:], c.Latency)
-	o.PutUint16(b[8:], c.Timeout)
-	o.PutUint16(b[10:], c.MinimumCELength)
-	o.PutUint16(b[12:], c.MaximumCELength)
-}
-
-type LERemoteConnectionParameterReplyRP struct {
-	Status           uint8
-	ConnectionHandle uint16
-}
-
-// LE Remote Connection Parameters Negative Reply (0x0021)
-type LERemoteConnectionParameterNegReply struct {
-	ConnectionHandle uint16
-	Reason           uint8
-}
-
-func (c LERemoteConnectionParameterNegReply) Opcode() int {
-	return opLERemoteConnectionParameterNegReply
-}
-func (c LERemoteConnectionParameterNegReply) Len() int { return 3 }
-func (c LERemoteConnectionParameterNegReply) Marshal(b []byte) {
-	o.PutUint16(b[0:], c.ConnectionHandle)
-	b[2] = c.Reason
-}
-
-type LERemoteConnectionParameterNegReplyRP struct {
-	Status           uint8
-	ConnectionHandle uint16
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/const.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/const.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/const.go
deleted file mode 100644
index 8c0a140..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/const.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package linux
-
-type packetType uint8
-
-// HCI Packet types
-const (
-	typCommandPkt packetType = 0X01
-	typACLDataPkt            = 0X02
-	typSCODataPkt            = 0X03
-	typEventPkt              = 0X04
-	typVendorPkt             = 0XFF
-)
-
-// Event Type
-const (
-	advInd        = 0x00 // Connectable undirected advertising (ADV_IND).
-	advDirectInd  = 0x01 // Connectable directed advertising (ADV_DIRECT_IND)
-	advScanInd    = 0x02 // Scannable undirected advertising (ADV_SCAN_IND)
-	advNonconnInd = 0x03 // Non connectable undirected advertising (ADV_NONCONN_IND)
-	scanRsp       = 0x04 // Scan Response (SCAN_RSP)
-)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/device.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/device.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/device.go
deleted file mode 100644
index ef55268..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/device.go
+++ /dev/null
@@ -1,109 +0,0 @@
-package linux
-
-import (
-	"errors"
-	"log"
-	"sync"
-	"syscall"
-	"unsafe"
-
-	"github.com/runtimeinc/gatt/linux/gioctl"
-	"github.com/runtimeinc/gatt/linux/socket"
-)
-
-type device struct {
-	fd   int
-	dev  int
-	name string
-	rmu  *sync.Mutex
-	wmu  *sync.Mutex
-}
-
-func newDevice(n int, chk bool) (*device, error) {
-	fd, err := socket.Socket(socket.AF_BLUETOOTH, syscall.SOCK_RAW, socket.BTPROTO_HCI)
-	if err != nil {
-		return nil, err
-	}
-	if n != -1 {
-		return newSocket(fd, n, chk)
-	}
-
-	req := devListRequest{devNum: hciMaxDevices}
-	if err := gioctl.Ioctl(uintptr(fd), hciGetDeviceList, uintptr(unsafe.Pointer(&req))); err != nil {
-		return nil, err
-	}
-	for i := 0; i < int(req.devNum); i++ {
-		d, err := newSocket(fd, i, chk)
-		if err == nil {
-			log.Printf("dev: %s opened", d.name)
-			return d, err
-		}
-	}
-	return nil, errors.New("no supported devices available")
-}
-
-func newSocket(fd, n int, chk bool) (*device, error) {
-	i := hciDevInfo{id: uint16(n)}
-	if err := gioctl.Ioctl(uintptr(fd), hciGetDeviceInfo, uintptr(unsafe.Pointer(&i))); err != nil {
-		return nil, err
-	}
-	name := string(i.name[:])
-	// Check the feature list returned feature list.
-	if chk && i.features[4]&0x40 == 0 {
-		err := errors.New("does not support LE")
-		log.Printf("dev: %s %s", name, err)
-		return nil, err
-	}
-	log.Printf("dev: %s up", name)
-	if err := gioctl.Ioctl(uintptr(fd), hciUpDevice, uintptr(n)); err != nil {
-		if err != syscall.EALREADY {
-			return nil, err
-		}
-		log.Printf("dev: %s reset", name)
-		if err := gioctl.Ioctl(uintptr(fd), hciResetDevice, uintptr(n)); err != nil {
-			return nil, err
-		}
-	}
-	log.Printf("dev: %s down", name)
-	if err := gioctl.Ioctl(uintptr(fd), hciDownDevice, uintptr(n)); err != nil {
-		return nil, err
-	}
-
-	// Attempt to use the linux 3.14 feature, if this fails with EINVAL fall back to raw access
-	// on older kernels.
-	sa := socket.SockaddrHCI{Dev: n, Channel: socket.HCI_CHANNEL_USER}
-	if err := socket.Bind(fd, &sa); err != nil {
-		if err != syscall.EINVAL {
-			return nil, err
-		}
-		log.Printf("dev: %s can't bind to hci user channel, err: %s.", name, err)
-		sa := socket.SockaddrHCI{Dev: n, Channel: socket.HCI_CHANNEL_RAW}
-		if err := socket.Bind(fd, &sa); err != nil {
-			log.Printf("dev: %s can't bind to hci raw channel, err: %s.", name, err)
-			return nil, err
-		}
-	}
-	return &device{
-		fd:   fd,
-		dev:  n,
-		name: name,
-		rmu:  &sync.Mutex{},
-		wmu:  &sync.Mutex{},
-	}, nil
-}
-
-func (d device) Read(b []byte) (int, error) {
-	d.rmu.Lock()
-	defer d.rmu.Unlock()
-	return syscall.Read(d.fd, b)
-}
-
-func (d device) Write(b []byte) (int, error) {
-	d.wmu.Lock()
-	defer d.wmu.Unlock()
-	return syscall.Write(d.fd, b)
-}
-
-func (d device) Close() error {
-	return syscall.Close(d.fd)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/devices.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/devices.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/devices.go
deleted file mode 100644
index 7c5336f..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/devices.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package linux
-
-import "github.com/runtimeinc/gatt/linux/gioctl"
-
-const (
-	ioctlSize     = uintptr(4)
-	hciMaxDevices = 16
-	typHCI        = 72 // 'H'
-)
-
-var (
-	hciUpDevice      = gioctl.IoW(typHCI, 201, ioctlSize) // HCIDEVUP
-	hciDownDevice    = gioctl.IoW(typHCI, 202, ioctlSize) // HCIDEVDOWN
-	hciResetDevice   = gioctl.IoW(typHCI, 203, ioctlSize) // HCIDEVRESET
-	hciGetDeviceList = gioctl.IoR(typHCI, 210, ioctlSize) // HCIGETDEVLIST
-	hciGetDeviceInfo = gioctl.IoR(typHCI, 211, ioctlSize) // HCIGETDEVINFO
-)
-
-type devRequest struct {
-	id  uint16
-	opt uint32
-}
-
-type devListRequest struct {
-	devNum     uint16
-	devRequest [hciMaxDevices]devRequest
-}
-
-type hciDevInfo struct {
-	id         uint16
-	name       [8]byte
-	bdaddr     [6]byte
-	flags      uint32
-	devType    uint8
-	features   [8]uint8
-	pktType    uint32
-	linkPolicy uint32
-	linkMode   uint32
-	aclMtu     uint16
-	aclPkts    uint16
-	scoMtu     uint16
-	scoPkts    uint16
-
-	stats hciDevStats
-}
-
-type hciDevStats struct {
-	errRx  uint32
-	errTx  uint32
-	cmdTx  uint32
-	evtRx  uint32
-	aclTx  uint32
-	aclRx  uint32
-	scoTx  uint32
-	scoRx  uint32
-	byteRx uint32
-	byteTx uint32
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/doc.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/doc.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/doc.go
deleted file mode 100644
index c41c53e..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/doc.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Package linux provides linux-specific support for gatt.
-//
-// This package is work in progress. We expect the APIs to change significantly before stabilizing.
-
-package linux

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/evt/evt.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/evt/evt.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/evt/evt.go
deleted file mode 100644
index 2461a30..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/evt/evt.go
+++ /dev/null
@@ -1,382 +0,0 @@
-package evt
-
-import (
-	"bytes"
-	"encoding/binary"
-	"errors"
-
-	"github.com/runtimeinc/gatt/linux/util"
-)
-
-type EventHandler interface {
-	HandleEvent([]byte) error
-}
-
-type HandlerFunc func(b []byte) error
-
-func (f HandlerFunc) HandleEvent(b []byte) error {
-	return f(b)
-}
-
-type Evt struct {
-	evtHandlers map[int]EventHandler
-}
-
-func NewEvt() *Evt {
-	return &Evt{
-		evtHandlers: map[int]EventHandler{},
-	}
-}
-
-func (e *Evt) HandleEvent(c int, h EventHandler) {
-	e.evtHandlers[c] = h
-}
-
-func (e *Evt) Dispatch(b []byte) error {
-	h := &EventHeader{}
-	if err := h.Unmarshal(b); err != nil {
-		return err
-	}
-	b = b[2:] // Skip Event Header (uint8 + uint8)
-	if f, found := e.evtHandlers[h.code]; found {
-		e.trace("> HCI Event: %s (0x%02X) plen %d: [ % X ])\n", h.code, uint8(h.code), h.plen, b)
-		return f.HandleEvent(b)
-	}
-	e.trace("> HCI Event: no handler for %s (0x%02X)\n", h.code, uint8(h.code))
-	return nil
-}
-
-func (e *Evt) trace(fmt string, v ...interface{}) {}
-
-const (
-	InquiryComplete                              = 0x01 // Inquiry Complete
-	InquiryResult                                = 0x02 // Inquiry Result
-	ConnectionComplete                           = 0x03 // Connection Complete
-	ConnectionRequest                            = 0x04 // Connection Request
-	DisconnectionComplete                        = 0x05 // Disconnection Complete
-	AuthenticationComplete                       = 0x06 // Authentication
-	RemoteNameReqComplete                        = 0x07 // Remote Name Request Complete
-	EncryptionChange                             = 0x08 // Encryption Change
-	ChangeConnectionLinkKeyComplete              = 0x09 // Change Conection Link Key Complete
-	MasterLinkKeyComplete                        = 0x0A // Master Link Keye Complete
-	ReadRemoteSupportedFeaturesComplete          = 0x0B // Read Remote Supported Features Complete
-	ReadRemoteVersionInformationComplete         = 0x0C // Read Remote Version Information Complete
-	QoSSetupComplete                             = 0x0D // QoSSetupComplete
-	CommandComplete                              = 0x0E // Command Complete
-	CommandStatus                                = 0x0F // Command status
-	HardwareError                                = 0x10 // Hardware Error
-	FlushOccurred                                = 0x11 // Flush Occured
-	RoleChange                                   = 0x12 // Role Change
-	NumberOfCompletedPkts                        = 0x13 // Number Of Completed Packets
-	ModeChange                                   = 0x14 // Mode Change
-	ReturnLinkKeys                               = 0x15 // Return Link Keys
-	PinCodeRequest                               = 0x16 // PIN Code Request
-	LinkKeyRequest                               = 0x17 // Link Key Request
-	LinkKeyNotification                          = 0x18 // Link Key Notification
-	LoopbackCommand                              = 0x19 // Loopback Command
-	DataBufferOverflow                           = 0x1A // Data Buffer Overflow
-	MaxSlotsChange                               = 0x1B // Max Slots Change
-	ReadClockOffsetComplete                      = 0x1C // Read Clock Offset Complete
-	ConnectionPtypeChanged                       = 0x1D // Connection Packet Type Changed
-	QoSViolation                                 = 0x1E // QoS Violation
-	PageScanRepetitionModeChange                 = 0x20 // Page Scan Repetition Mode Change
-	FlowSpecificationComplete                    = 0x21 // Flow Specification
-	InquiryResultWithRssi                        = 0x22 // Inquery Result with RSSI
-	ReadRemoteExtendedFeaturesComplete           = 0x23 // Read Remote Extended Features Complete
-	SyncConnectionComplete                       = 0x2C // Synchronous Connection Complete
-	SyncConnectionChanged                        = 0x2D // Synchronous Connection Changed
-	SniffSubrating                               = 0x2E // Sniff Subrating
-	ExtendedInquiryResult                        = 0x2F // Extended Inquiry Result
-	EncryptionKeyRefreshComplete                 = 0x30 // Encryption Key Refresh Complete
-	IOCapabilityRequest                          = 0x31 // IO Capability Request
-	IOCapabilityResponse                         = 0x32 // IO Capability Changed
-	UserConfirmationRequest                      = 0x33 // User Confirmation Request
-	UserPasskeyRequest                           = 0x34 // User Passkey Request
-	RemoteOOBDataRequest                         = 0x35 // Remote OOB Data
-	SimplePairingComplete                        = 0x36 // Simple Pairing Complete
-	LinkSupervisionTimeoutChanged                = 0x38 // Link Supervision Timeout Changed
-	EnhancedFlushComplete                        = 0x39 // Enhanced Flush Complete
-	UserPasskeyNotify                            = 0x3B // User Passkey Notification
-	KeypressNotify                               = 0x3C // Keypass Notification
-	RemoteHostFeaturesNotify                     = 0x3D // Remote Host Supported Features Notification
-	LEMeta                                       = 0x3E // LE Meta
-	PhysicalLinkComplete                         = 0x40 // Physical Link Complete
-	ChannelSelected                              = 0x41 // Channel Selected
-	DisconnectionPhysicalLinkComplete            = 0x42 // Disconnection Physical Link Complete
-	PhysicalLinkLossEarlyWarning                 = 0x43 // Physical Link Loss Early Warning
-	PhysicalLinkRecovery                         = 0x44 // Physical Link Recovery
-	LogicalLinkComplete                          = 0x45 // Logical Link Complete
-	DisconnectionLogicalLinkComplete             = 0x46 // Disconnection Logical Link Complete
-	FlowSpecModifyComplete                       = 0x47 // Flow Spec Modify Complete
-	NumberOfCompletedBlocks                      = 0x48 // Number Of Completed Data Blocks
-	AMPStartTest                                 = 0x49 // AMP Start Test
-	AMPTestEnd                                   = 0x4A // AMP Test End
-	AMPReceiverReport                            = 0x4b // AMP Receiver Report
-	AMPStatusChange                              = 0x4D // AMP status Change
-	TriggeredClockCapture                        = 0x4e // Triggered Clock Capture
-	SynchronizationTrainComplete                 = 0x4F // Synchronization Train Complete
-	SynchronizationTrainReceived                 = 0x50 // Synchronization Train Received
-	ConnectionlessSlaveBroadcastReceive          = 0x51 // Connectionless Slave Broadcast Receive
-	ConnectionlessSlaveBroadcastTimeout          = 0x52 // Connectionless Slave Broadcast Timeout
-	TruncatedPageComplete                        = 0x53 // Truncated Page Complete
-	SlavePageResponseTimeout                     = 0x54 // Slave Page Response Timeout
-	ConnectionlessSlaveBroadcastChannelMapChange = 0x55 // Connectionless Slave Broadcast Channel Map Change
-	InquiryResponseNotification                  = 0x56 // Inquiry Response Notification
-	AuthenticatedPayloadTimeoutExpired           = 0x57 // Authenticated Payload Timeout Expired
-)
-
-type LEEventCode int
-
-const (
-	LEConnectionComplete               LEEventCode = 0x01 // LE Connection Complete
-	LEAdvertisingReport                            = 0x02 // LE Advertising Report
-	LEConnectionUpdateComplete                     = 0x03 // LE Connection Update Complete
-	LEReadRemoteUsedFeaturesComplete               = 0x04 // LE Read Remote Used Features Complete
-	LELTKRequest                                   = 0x05 // LE LTK Request
-	LERemoteConnectionParameterRequest             = 0x06 // LE Remote Connection Parameter Request
-)
-
-type EventHeader struct {
-	code int
-	plen uint8
-}
-
-func (h *EventHeader) Unmarshal(b []byte) error {
-	if len(b) < 2 {
-		return errors.New("malformed header")
-	}
-	h.code = int(b[0])
-	h.plen = b[1]
-	if uint8(len(b)) != 2+h.plen {
-		return errors.New("wrong length")
-	}
-	return nil
-}
-
-var o = util.Order
-
-// Event Parameters
-
-type InquiryCompleteEP struct {
-	Status uint8
-}
-
-type InquiryResultEP struct {
-	NumResponses           uint8
-	BDAddr                 [][6]byte
-	PageScanRepetitionMode []uint8
-	Reserved1              []byte
-	Reserved2              []byte
-	ClassOfDevice          [][3]byte
-	ClockOffset            []uint16
-}
-
-type ConnectionCompleteEP struct {
-	Status            uint8
-	ConnectionHandle  uint16
-	BDAddr            [6]byte
-	LinkType          uint8
-	EncryptionEnabled uint8
-}
-
-type ConnectionRequestEP struct {
-	BDAddr        [6]byte
-	ClassofDevice [3]byte
-	LinkType      uint8
-}
-
-type DisconnectionCompleteEP struct {
-	Status           uint8
-	ConnectionHandle uint16
-	Reason           uint8
-}
-
-func (e *DisconnectionCompleteEP) Unmarshal(b []byte) error {
-	buf := bytes.NewBuffer(b)
-	binary.Read(buf, binary.LittleEndian, &e.Status)
-	binary.Read(buf, binary.LittleEndian, &e.ConnectionHandle)
-	return binary.Read(buf, binary.LittleEndian, &e.Reason)
-}
-
-type CommandCompleteEP struct {
-	NumHCICommandPackets uint8
-	CommandOPCode        uint16
-	ReturnParameters     []byte
-}
-
-func (e *CommandCompleteEP) Unmarshal(b []byte) error {
-	buf := bytes.NewBuffer(b)
-	if err := binary.Read(buf, binary.LittleEndian, &e.NumHCICommandPackets); err != nil {
-		return err
-	}
-	if err := binary.Read(buf, binary.LittleEndian, &e.CommandOPCode); err != nil {
-		return err
-	}
-	e.ReturnParameters = buf.Bytes()
-	return nil
-}
-
-type CommandStatusEP struct {
-	Status               uint8
-	NumHCICommandPackets uint8
-	CommandOpcode        uint16
-}
-
-func (e *CommandStatusEP) Unmarshal(b []byte) error {
-	buf := bytes.NewBuffer(b)
-	binary.Read(buf, binary.LittleEndian, &e.Status)
-	binary.Read(buf, binary.LittleEndian, &e.NumHCICommandPackets)
-	return binary.Read(buf, binary.LittleEndian, &e.CommandOpcode)
-}
-
-type NumOfCompletedPkt struct {
-	ConnectionHandle   uint16
-	NumOfCompletedPkts uint16
-}
-
-type NumberOfCompletedPktsEP struct {
-	NumberOfHandles uint8
-	Packets         []NumOfCompletedPkt
-}
-
-func (e *NumberOfCompletedPktsEP) Unmarshal(b []byte) error {
-	e.NumberOfHandles = b[0]
-	n := int(e.NumberOfHandles)
-	buf := bytes.NewBuffer(b[1:])
-	e.Packets = make([]NumOfCompletedPkt, n)
-	for i := 0; i < n; i++ {
-		binary.Read(buf, binary.LittleEndian, &e.Packets[i].ConnectionHandle)
-		binary.Read(buf, binary.LittleEndian, &e.Packets[i].NumOfCompletedPkts)
-
-		e.Packets[i].ConnectionHandle &= 0xfff
-	}
-	return nil
-}
-
-// LE Meta Subevents
-type LEConnectionCompleteEP struct {
-	SubeventCode        uint8
-	Status              uint8
-	ConnectionHandle    uint16
-	Role                uint8
-	PeerAddressType     uint8
-	PeerAddress         [6]byte
-	ConnInterval        uint16
-	ConnLatency         uint16
-	SupervisionTimeout  uint16
-	MasterClockAccuracy uint8
-}
-
-func (e *LEConnectionCompleteEP) Unmarshal(b []byte) error {
-	e.SubeventCode = o.Uint8(b[0:])
-	e.Status = o.Uint8(b[1:])
-	e.ConnectionHandle = o.Uint16(b[2:])
-	e.Role = o.Uint8(b[4:])
-	e.PeerAddressType = o.Uint8(b[5:])
-	e.PeerAddress = o.MAC(b[6:])
-	e.ConnInterval = o.Uint16(b[12:])
-	e.ConnLatency = o.Uint16(b[14:])
-	e.SupervisionTimeout = o.Uint16(b[16:])
-	e.MasterClockAccuracy = o.Uint8(b[17:])
-	return nil
-}
-
-type LEAdvertisingReportEP struct {
-	SubeventCode uint8
-	NumReports   uint8
-	EventType    []uint8
-	AddressType  []uint8
-	Address      [][6]byte
-	Length       []uint8
-	Data         [][]byte
-	RSSI         []int8
-}
-
-func (e *LEAdvertisingReportEP) Unmarshal(b []byte) error {
-	e.SubeventCode = o.Uint8(b)
-	b = b[1:]
-	e.NumReports = o.Uint8(b)
-	b = b[1:]
-	n := int(e.NumReports)
-	e.EventType = make([]uint8, n)
-	e.AddressType = make([]uint8, n)
-	e.Address = make([][6]byte, n)
-	e.Length = make([]uint8, n)
-	e.Data = make([][]byte, n)
-	e.RSSI = make([]int8, n)
-
-	for i := 0; i < n; i++ {
-		e.EventType[i] = o.Uint8(b)
-		b = b[1:]
-	}
-	for i := 0; i < n; i++ {
-		e.AddressType[i] = o.Uint8(b)
-		b = b[1:]
-	}
-	for i := 0; i < n; i++ {
-		e.Address[i] = o.MAC(b)
-		b = b[6:]
-	}
-	for i := 0; i < n; i++ {
-		e.Length[i] = o.Uint8(b)
-		b = b[1:]
-	}
-	for i := 0; i < n; i++ {
-		e.Data[i] = make([]byte, e.Length[i])
-		copy(e.Data[i], b)
-		b = b[e.Length[i]:]
-	}
-	for i := 0; i < n; i++ {
-		e.RSSI[i] = o.Int8(b)
-		b = b[1:]
-	}
-	return nil
-}
-
-type LEConnectionUpdateCompleteEP struct {
-	SubeventCode       uint8
-	Status             uint8
-	ConnectionHandle   uint16
-	ConnInterval       uint16
-	ConnLatency        uint16
-	SupervisionTimeout uint16
-}
-
-func (e *LEConnectionUpdateCompleteEP) Unmarshal(b []byte) error {
-	return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, e)
-}
-
-type LEReadRemoteUsedFeaturesCompleteEP struct {
-	SubeventCode     uint8
-	Status           uint8
-	ConnectionHandle uint16
-	LEFeatures       uint64
-}
-
-func (e *LEReadRemoteUsedFeaturesCompleteEP) Unmarshal(b []byte) error {
-	return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, e)
-}
-
-type LELTKRequestEP struct {
-	SubeventCode          uint8
-	ConnectionHandle      uint16
-	RandomNumber          uint64
-	EncryptionDiversifier uint16
-}
-
-func (e *LELTKRequestEP) Unmarshal(b []byte) error {
-	return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, e)
-}
-
-type LERemoteConnectionParameterRequestEP struct {
-	SubeventCode     uint8
-	ConnectionHandle uint16
-	IntervalMin      uint16
-	IntervalMax      uint16
-	Latency          uint16
-	Timeout          uint16
-}
-
-func (e *LERemoteConnectionParameterRequestEP) Unmarshal(b []byte) error {
-	return binary.Read(bytes.NewBuffer(b), binary.LittleEndian, e)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/LICENSE.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/LICENSE.md b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/LICENSE.md
deleted file mode 100644
index 1e1b7cd..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/LICENSE.md
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 Mark Wolfe
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/README.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/README.md b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/README.md
deleted file mode 100644
index 837fa03..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# gioctl [![GoDoc](https://img.shields.io/badge/godoc-Reference-brightgreen.svg?style=flat)](http://godoc.org/github.com/wolfeidau/gioctl)
-
-Simple library which provides golang versions of the ioctl macros in linux.
-
-# References
-
-* https://github.com/luismesas/goPi started with the IOCTL stuff from this project initally.
-* http://www.circlemud.org/jelson/software/fusd/docs/node31.html good information on IOCTL macros.
-
-# License
-
-This code is Copyright (c) 2014 Mark Wolfe and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/ioctl.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/ioctl.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/ioctl.go
deleted file mode 100644
index 0097459..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/gioctl/ioctl.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package gioctl
-
-import "syscall"
-
-const (
-	typeBits      = 8
-	numberBits    = 8
-	sizeBits      = 14
-	directionBits = 2
-
-	typeMask      = (1 << typeBits) - 1
-	numberMask    = (1 << numberBits) - 1
-	sizeMask      = (1 << sizeBits) - 1
-	directionMask = (1 << directionBits) - 1
-
-	directionNone  = 0
-	directionWrite = 1
-	directionRead  = 2
-
-	numberShift    = 0
-	typeShift      = numberShift + numberBits
-	sizeShift      = typeShift + typeBits
-	directionShift = sizeShift + sizeBits
-)
-
-func ioc(dir, t, nr, size uintptr) uintptr {
-	return (dir << directionShift) | (t << typeShift) | (nr << numberShift) | (size << sizeShift)
-}
-
-// Io used for a simple ioctl that sends nothing but the type and number, and receives back nothing but an (integer) retval.
-func Io(t, nr uintptr) uintptr {
-	return ioc(directionNone, t, nr, 0)
-}
-
-// IoR used for an ioctl that reads data from the device driver. The driver will be allowed to return sizeof(data_type) bytes to the user.
-func IoR(t, nr, size uintptr) uintptr {
-	return ioc(directionRead, t, nr, size)
-}
-
-// IoW used for an ioctl that writes data to the device driver.
-func IoW(t, nr, size uintptr) uintptr {
-	return ioc(directionWrite, t, nr, size)
-}
-
-// IoRW  a combination of IoR and IoW. That is, data is both written to the driver and then read back from the driver by the client.
-func IoRW(t, nr, size uintptr) uintptr {
-	return ioc(directionRead|directionWrite, t, nr, size)
-}
-
-// Ioctl simplified ioct call
-func Ioctl(fd, op, arg uintptr) error {
-	_, _, ep := syscall.Syscall(syscall.SYS_IOCTL, fd, op, arg)
-	if ep != 0 {
-		return syscall.Errno(ep)
-	}
-	return nil
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
deleted file mode 100644
index c41d0bf..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
+++ /dev/null
@@ -1,400 +0,0 @@
-package linux
-
-import (
-	"fmt"
-	"io"
-	"log"
-	"sync"
-
-	"github.com/runtimeinc/gatt/linux/cmd"
-	"github.com/runtimeinc/gatt/linux/evt"
-)
-
-type HCI struct {
-	AcceptMasterHandler  func(pd *PlatData)
-	AcceptSlaveHandler   func(pd *PlatData)
-	AdvertisementHandler func(pd *PlatData)
-
-	d io.ReadWriteCloser
-	c *cmd.Cmd
-	e *evt.Evt
-
-	plist   map[bdaddr]*PlatData
-	plistmu *sync.Mutex
-
-	bufCnt  chan struct{}
-	bufSize int
-
-	maxConn int
-	connsmu *sync.Mutex
-	conns   map[uint16]*conn
-
-	adv   bool
-	advmu *sync.Mutex
-}
-
-type bdaddr [6]byte
-
-type PlatData struct {
-	Name        string
-	AddressType uint8
-	Address     [6]byte
-	Data        []byte
-	Connectable bool
-	RSSI        int8
-
-	Conn io.ReadWriteCloser
-}
-
-func NewHCI(devID int, chk bool, maxConn int) (*HCI, error) {
-	d, err := newDevice(devID, chk)
-	if err != nil {
-		return nil, err
-	}
-	c := cmd.NewCmd(d)
-	e := evt.NewEvt()
-
-	h := &HCI{
-		d: d,
-		c: c,
-		e: e,
-
-		plist:   make(map[bdaddr]*PlatData),
-		plistmu: &sync.Mutex{},
-
-		bufCnt:  make(chan struct{}, 15-1),
-		bufSize: 27,
-
-		maxConn: maxConn,
-		connsmu: &sync.Mutex{},
-		conns:   map[uint16]*conn{},
-
-		advmu: &sync.Mutex{},
-	}
-
-	e.HandleEvent(evt.LEMeta, evt.HandlerFunc(h.handleLEMeta))
-	e.HandleEvent(evt.DisconnectionComplete, evt.HandlerFunc(h.handleDisconnectionComplete))
-	e.HandleEvent(evt.NumberOfCompletedPkts, evt.HandlerFunc(h.handleNumberOfCompletedPkts))
-	e.HandleEvent(evt.CommandComplete, evt.HandlerFunc(c.HandleComplete))
-	e.HandleEvent(evt.CommandStatus, evt.HandlerFunc(c.HandleStatus))
-
-	go h.mainLoop()
-	h.resetDevice()
-	return h, nil
-}
-
-func (h *HCI) Close() error {
-	for _, c := range h.conns {
-		c.Close()
-	}
-	return h.d.Close()
-}
-
-func (h *HCI) SetAdvertiseEnable(en bool) error {
-	h.advmu.Lock()
-	h.adv = en
-	h.advmu.Unlock()
-	return h.setAdvertiseEnable(en)
-}
-
-func (h *HCI) setAdvertiseEnable(en bool) error {
-	h.advmu.Lock()
-	defer h.advmu.Unlock()
-	if en && h.adv && (len(h.conns) == h.maxConn) {
-		return nil
-	}
-	return h.c.SendAndCheckResp(
-		cmd.LESetAdvertiseEnable{
-			AdvertisingEnable: btoi(en),
-		}, []byte{0x00})
-}
-
-func (h *HCI) SendCmdWithAdvOff(c cmd.CmdParam) error {
-	h.setAdvertiseEnable(false)
-	err := h.c.SendAndCheckResp(c, nil)
-	if h.adv {
-		h.setAdvertiseEnable(true)
-	}
-	return err
-}
-
-func (h *HCI) SetScanEnable(en bool, dup bool) error {
-	return h.c.SendAndCheckResp(
-		cmd.LESetScanEnable{
-			LEScanEnable:     btoi(en),
-			FilterDuplicates: btoi(!dup),
-		}, []byte{0x00})
-}
-
-func (h *HCI) Connect(pd *PlatData) error {
-	h.c.Send(
-		cmd.LECreateConn{
-			LEScanInterval:        0x0004,         // N x 0.625ms
-			LEScanWindow:          0x0004,         // N x 0.625ms
-			InitiatorFilterPolicy: 0x00,           // white list not used
-			PeerAddressType:       pd.AddressType, // public or random
-			PeerAddress:           pd.Address,     //
-			OwnAddressType:        0x00,           // public
-			ConnIntervalMin:       6,         // N x 0.125ms
-			ConnIntervalMax:       7,         // N x 0.125ms
-			ConnLatency:           0x0000,         //
-			SupervisionTimeout:    0x00100,         // N x 10ms
-			MinimumCELength:       0x0000,         // N x 0.625ms
-			MaximumCELength:       0x0000,         // N x 0.625ms
-		})
-	return nil
-}
-
-func (h *HCI) CancelConnection(pd *PlatData) error {
-	return pd.Conn.Close()
-}
-
-func (h *HCI) SendRawCommand(c cmd.CmdParam) ([]byte, error) {
-	return h.c.Send(c)
-}
-
-func btoi(b bool) uint8 {
-	if b {
-		return 1
-	}
-	return 0
-}
-
-func (h *HCI) mainLoop() {
-	b := make([]byte, 4096)
-	for {
-		n, err := h.d.Read(b)
-		if err != nil {
-			return
-		}
-		if n == 0 {
-			return
-		}
-		p := make([]byte, n)
-		copy(p, b)
-		h.handlePacket(p)
-	}
-}
-
-func (h *HCI) handlePacket(b []byte) {
-	t, b := packetType(b[0]), b[1:]
-	var err error
-	switch t {
-	case typCommandPkt:
-		op := uint16(b[0]) | uint16(b[1])<<8
-		log.Printf("unmanaged cmd: opcode (%04x) [ % X ]\n", op, b)
-	case typACLDataPkt:
-		err = h.handleL2CAP(b)
-	case typSCODataPkt:
-		err = fmt.Errorf("SCO packet not supported")
-	case typEventPkt:
-		go func() {
-			err := h.e.Dispatch(b)
-			if err != nil {
-				log.Printf("hci: %s, [ % X]", err, b)
-			}
-		}()
-	case typVendorPkt:
-		err = fmt.Errorf("Vendor packet not supported")
-	default:
-		log.Fatalf("Unknown event: 0x%02X [ % X ]\n", t, b)
-	}
-	if err != nil {
-		log.Printf("hci: %s, [ % X]", err, b)
-	}
-}
-
-func (h *HCI) resetDevice() error {
-	seq := []cmd.CmdParam{
-		cmd.Reset{},
-		cmd.SetEventMask{EventMask: 0x3dbff807fffbffff},
-		cmd.LESetEventMask{LEEventMask: 0x000000000000001F},
-		cmd.WriteSimplePairingMode{SimplePairingMode: 1},
-		cmd.WriteLEHostSupported{LESupportedHost: 1, SimultaneousLEHost: 0},
-		cmd.WriteInquiryMode{InquiryMode: 2},
-		cmd.WritePageScanType{PageScanType: 1},
-		cmd.WriteInquiryScanType{ScanType: 1},
-		cmd.WriteClassOfDevice{ClassOfDevice: [3]byte{0x40, 0x02, 0x04}},
-		cmd.WritePageTimeout{PageTimeout: 0x2000},
-		cmd.WriteDefaultLinkPolicy{DefaultLinkPolicySettings: 0x5},
-		cmd.HostBufferSize{
-			HostACLDataPacketLength:            0x1000,
-			HostSynchronousDataPacketLength:    0xff,
-			HostTotalNumACLDataPackets:         0x0014,
-			HostTotalNumSynchronousDataPackets: 0x000a},
-		cmd.LESetScanParameters{
-			LEScanType:           0x01,   // [0x00]: passive, 0x01: active
-			LEScanInterval:       0x0010, // [0x10]: 0.625ms * 16
-			LEScanWindow:         0x0010, // [0x10]: 0.625ms * 16
-			OwnAddressType:       0x00,   // [0x00]: public, 0x01: random
-			ScanningFilterPolicy: 0x00,   // [0x00]: accept all, 0x01: ignore non-white-listed.
-		},
-	}
-	for _, s := range seq {
-		if err := h.c.SendAndCheckResp(s, []byte{0x00}); err != nil {
-			return err
-		}
-	}
-	return nil
-}
-
-func (h *HCI) handleAdvertisement(b []byte) {
-	// If no one is interested, don't bother.
-	if h.AdvertisementHandler == nil {
-		return
-	}
-	ep := &evt.LEAdvertisingReportEP{}
-	if err := ep.Unmarshal(b); err != nil {
-		return
-	}
-	for i := 0; i < int(ep.NumReports); i++ {
-		addr := bdaddr(ep.Address[i])
-		et := ep.EventType[i]
-		connectable := et == advInd || et == advDirectInd
-		scannable := et == advInd || et == advScanInd
-
-		if et == scanRsp {
-			h.plistmu.Lock()
-			pd, ok := h.plist[addr]
-			h.plistmu.Unlock()
-			if ok {
-				pd.Data = append(pd.Data, ep.Data[i]...)
-				h.AdvertisementHandler(pd)
-			}
-			continue
-		}
-
-		pd := &PlatData{
-			AddressType: ep.AddressType[i],
-			Address:     ep.Address[i],
-			Data:        ep.Data[i],
-			Connectable: connectable,
-			RSSI:        ep.RSSI[i],
-		}
-		h.plistmu.Lock()
-		h.plist[addr] = pd
-		h.plistmu.Unlock()
-		if scannable {
-			continue
-		}
-		h.AdvertisementHandler(pd)
-	}
-}
-
-func (h *HCI) handleNumberOfCompletedPkts(b []byte) error {
-	ep := &evt.NumberOfCompletedPktsEP{}
-	if err := ep.Unmarshal(b); err != nil {
-		return err
-	}
-	for _, r := range ep.Packets {
-		for i := 0; i < int(r.NumOfCompletedPkts); i++ {
-			<-h.bufCnt
-		}
-	}
-	return nil
-}
-
-func (h *HCI) handleConnection(b []byte) {
-	ep := &evt.LEConnectionCompleteEP{}
-	if err := ep.Unmarshal(b); err != nil {
-		return // FIXME
-	}
-	hh := ep.ConnectionHandle
-	c := newConn(h, hh)
-	h.connsmu.Lock()
-	h.conns[hh] = c
-	h.connsmu.Unlock()
-	h.setAdvertiseEnable(true)
-
-	// FIXME: sloppiness. This call should be called by the package user once we
-	// flesh out the support of l2cap signaling packets (CID:0x0001,0x0005)
-	if ep.ConnLatency != 0 || ep.ConnInterval > 0x18 {
-		c.updateConnection()
-	}
-
-	// master connection
-	if ep.Role == 0x01 {
-		pd := &PlatData{
-			Address: ep.PeerAddress,
-			Conn:    c,
-		}
-		h.AcceptMasterHandler(pd)
-		return
-	}
-	h.plistmu.Lock()
-	pd := h.plist[ep.PeerAddress]
-	h.plistmu.Unlock()
-	pd.Conn = c
-	h.AcceptSlaveHandler(pd)
-}
-
-func (h *HCI) handleDisconnectionComplete(b []byte) error {
-	ep := &evt.DisconnectionCompleteEP{}
-	if err := ep.Unmarshal(b); err != nil {
-		return err
-	}
-	hh := ep.ConnectionHandle
-	h.connsmu.Lock()
-	defer h.connsmu.Unlock()
-	c, found := h.conns[hh]
-	if !found {
-		// should not happen, just be cautious for now.
-		log.Printf("l2conn: disconnecting a disconnected 0x%04X connection", hh)
-		return nil
-	}
-	delete(h.conns, hh)
-	close(c.aclc)
-	h.setAdvertiseEnable(true)
-	return nil
-}
-
-func (h *HCI) handleLEMeta(b []byte) error {
-	code := evt.LEEventCode(b[0])
-	switch code {
-	case evt.LEConnectionComplete:
-		go h.handleConnection(b)
-	case evt.LEConnectionUpdateComplete:
-		// anything to do here?
-	case evt.LEAdvertisingReport:
-		go h.handleAdvertisement(b)
-	// case evt.LEReadRemoteUsedFeaturesComplete:
-	// case evt.LELTKRequest:
-	// case evt.LERemoteConnectionParameterRequest:
-	default:
-		return fmt.Errorf("Unhandled LE event: %s, [ % X ]", code, b)
-	}
-	return nil
-}
-
-func (h *HCI) handleL2CAP(b []byte) error {
-        a := &aclData{}
-	if err := a.unmarshal(b); err != nil {
-		return err
-	}
-	h.connsmu.Lock()
-	defer h.connsmu.Unlock()
-	c, found := h.conns[a.attr]
-
-        if a.flags != 0x002 {
-	    if !found {
-		    // should not happen, just be cautious for now.
-		    log.Printf("l2conn: got data for disconnected handle: 0x%04x", a.attr)
-		    return nil
-	        if len(a.b) < 4 {
-		    log.Printf("l2conn: l2cap packet is too short/corrupt, length is %d", len(a.b))
-		    return nil
-	        }
-	        cid := uint16(a.b[2]) | (uint16(a.b[3]) << 8)
-	        if cid == 5 {
-		    c.handleSignal(a)
-		    return nil
-	        }
-            }
-        }
-	c.aclc <- a
-	return nil
-}
-
-func (h *HCI) trace(fmt string, v ...interface{}) {
-	log.Printf(fmt, v)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/l2cap.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/l2cap.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/l2cap.go
deleted file mode 100644
index 19c2968..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/l2cap.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package linux
-
-import (
-	"fmt"
-	"io"
-	"log"
-
-	"github.com/runtimeinc/gatt/linux/cmd"
-)
-
-type aclData struct {
-	attr  uint16
-	flags uint8
-	dlen  uint16
-	b     []byte
-}
-
-func (a *aclData) unmarshal(b []byte) error {
-	if len(b) < 4 {
-		return fmt.Errorf("malformed acl packet")
-	}
-	attr := uint16(b[0]) | (uint16(b[1]&0x0f) << 8)
-	flags := b[1] >> 4
-	dlen := uint16(b[2]) | (uint16(b[3]) << 8)
-	if len(b) != 4+int(dlen) {
-		return fmt.Errorf("malformed acl packet")
-	}
-
-	*a = aclData{attr: attr, flags: flags, dlen: dlen, b: b[4:]}
-	return nil
-}
-
-type conn struct {
-	hci  *HCI
-	attr uint16
-	aclc chan *aclData
-}
-
-func newConn(hci *HCI, hh uint16) *conn {
-	return &conn{
-		hci:  hci,
-		attr: hh,
-		aclc: make(chan *aclData),
-	}
-}
-
-func (c *conn) updateConnection() (int, error) {
-	b := []byte{
-		0x12,       // Code (Connection Param Update)
-		0x02,       // ID
-		0x08, 0x00, // DataLength
-		0x08, 0x00, // IntervalMin
-		0x18, 0x00, // IntervalMax
-		0x00, 0x00, // SlaveLatency
-		0xC8, 0x00} // TimeoutMultiplier
-	return c.write(0x05, b)
-}
-
-// write writes the l2cap payload to the controller.
-// It first prepend the l2cap header (4-bytes), and diassemble the payload
-// if it is larger than the HCI LE buffer size that the conntroller can support.
-func (c *conn) write(cid int, b []byte) (int, error) {
-	flag := uint8(0) // ACL data continuation flag
-	tlen := len(b)   // Total length of the l2cap payload
-
-	// log.Printf("W: [ % X ]", b)
-	w := append(
-		[]byte{
-			0,    // packet type
-			0, 0, // attr
-			0, 0, // dlen
-			uint8(tlen), uint8(tlen >> 8), // l2cap header
-			uint8(cid), uint8(cid >> 8), // l2cap header
-		}, b...)
-
-	n := 4 + tlen // l2cap header + l2cap payload
-	for n > 0 {
-		dlen := n
-		if dlen > c.hci.bufSize {
-			dlen = c.hci.bufSize
-		}
-		w[0] = 0x02 // packetTypeACL
-		w[1] = uint8(c.attr)
-		w[2] = uint8(c.attr>>8) | flag
-		w[3] = uint8(dlen)
-		w[4] = uint8(dlen >> 8)
-
-		// make sure we don't send more buffers than the controller can handdle
-		c.hci.bufCnt <- struct{}{}
-
-		c.hci.d.Write(w[:5+dlen])
-		w = w[dlen:] // advance the pointer to the next segment, if any.
-		flag = 0x10  // the rest of iterations attr continued segments, if any.
-		n -= dlen
-	}
-
-	return len(b), nil
-}
-
-func (c *conn) Read(b []byte) (int, error) {
-	a, ok := <-c.aclc
-	if !ok {
-		return 0, io.EOF
-	}
-	tlen := int(uint16(a.b[0]) | uint16(a.b[1])<<8)
-	if tlen > len(b) {
-		return 0, io.ErrShortBuffer
-	}
-	d := a.b[4:] // skip l2cap header
-	copy(b, d)
-	n := len(d)
-
-	// Keep receiving and reassemble continued l2cap segments
-	for n != tlen {
-		if a, ok = <-c.aclc; !ok || (a.flags&0x1) == 0 {
-			return n, io.ErrUnexpectedEOF
-		}
-		copy(b[n:], a.b)
-		n += len(a.b)
-	}
-	// log.Printf("R: [ % X ]", b[:n])
-	return n, nil
-}
-
-func (c *conn) Write(b []byte) (int, error) {
-	return c.write(0x04, b)
-}
-
-// Close disconnects the connection by sending HCI disconnect command to the device.
-func (c *conn) Close() error {
-	h := c.hci
-	hh := c.attr
-	h.connsmu.Lock()
-	defer h.connsmu.Unlock()
-	_, found := h.conns[hh]
-	if !found {
-		// log.Printf("l2conn: 0x%04x already disconnected", hh)
-		return nil
-	}
-	if err, _ := h.c.Send(cmd.Disconnect{ConnectionHandle: hh, Reason: 0x13}); err != nil {
-		return fmt.Errorf("l2conn: failed to disconnect, %s", err)
-	}
-	return nil
-}
-
-// Signal Packets
-// 0x00 Reserved								Any
-// 0x01 Command reject							0x0001 and 0x0005
-// 0x02 Connection request						0x0001
-// 0x03 Connection response 					0x0001
-// 0x04 Configure request						0x0001
-// 0x05 Configure response						0x0001
-// 0x06 Disconnection request					0x0001 and 0x0005
-// 0x07 Disconnection response					0x0001 and 0x0005
-// 0x08 Echo request							0x0001
-// 0x09 Echo response							0x0001
-// 0x0A Information request						0x0001
-// 0x0B Information response					0x0001
-// 0x0C Create Channel request					0x0001
-// 0x0D Create Channel response					0x0001
-// 0x0E Move Channel request					0x0001
-// 0x0F Move Channel response					0x0001
-// 0x10 Move Channel Confirmation				0x0001
-// 0x11 Move Channel Confirmation response		0x0001
-// 0x12 Connection Parameter Update request		0x0005
-// 0x13 Connection Parameter Update response	0x0005
-// 0x14 LE Credit Based Connection request		0x0005
-// 0x15 LE Credit Based Connection response		0x0005
-// 0x16 LE Flow Control Credit					0x0005
-func (c *conn) handleSignal(a *aclData) error {
-	log.Printf("ignore l2cap signal:[ % X ]", a.b)
-	// FIXME: handle LE signaling channel (CID: 5)
-	return nil
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm.s
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm.s b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm.s
deleted file mode 100644
index d4ca868..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm.s
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2014 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-TEXT ·use(SB),NOSPLIT,$0
-	RET

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm_linux_386.s
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm_linux_386.s b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm_linux_386.s
deleted file mode 100644
index 5d3ad9a..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/asm_linux_386.s
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
-	JMP	syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
-	JMP	syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
-	JMP	syscall·seek(SB)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket.go
deleted file mode 100644
index ffc49a6..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Package socket implements a minimal set of function of the HCI Socket,
-// which is not yet supported by the Go standard library. Most of the code
-// follow suit the existing code in the standard library. Once it gets
-// supported officially, we can get rid of this package entirely.
-
-package socket
-
-import (
-	"errors"
-	"syscall"
-	"time"
-	"unsafe"
-)
-
-// Bluetooth Protocols
-const (
-	BTPROTO_L2CAP  = 0
-	BTPROTO_HCI    = 1
-	BTPROTO_SCO    = 2
-	BTPROTO_RFCOMM = 3
-	BTPROTO_BNEP   = 4
-	BTPROTO_CMTP   = 5
-	BTPROTO_HIDP   = 6
-	BTPROTO_AVDTP  = 7
-)
-
-const (
-	HCI_CHANNEL_RAW     = 0
-	HCI_CHANNEL_USER    = 1
-	HCI_CHANNEL_MONITOR = 2
-	HCI_CHANNEL_CONTROL = 3
-)
-
-var (
-	ErrSocketOpenFailed  = errors.New("unable to open bluetooth socket to device")
-	ErrSocketBindTimeout = errors.New("timeout occured binding to bluetooth device")
-)
-
-type _Socklen uint32
-
-type Sockaddr interface {
-	sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs
-}
-
-type rawSockaddrHCI struct {
-	Family  uint16
-	Dev     uint16
-	Channel uint16
-}
-
-type SockaddrHCI struct {
-	Dev     int
-	Channel uint16
-	raw     rawSockaddrHCI
-}
-
-const sizeofSockaddrHCI = unsafe.Sizeof(rawSockaddrHCI{})
-
-func (sa *SockaddrHCI) sockaddr() (unsafe.Pointer, _Socklen, error) {
-	if sa.Dev < 0 || sa.Dev > 0xFFFF {
-		return nil, 0, syscall.EINVAL
-	}
-	if sa.Channel < 0 || sa.Channel > 0xFFFF {
-		return nil, 0, syscall.EINVAL
-	}
-	sa.raw.Family = AF_BLUETOOTH
-	sa.raw.Dev = uint16(sa.Dev)
-	sa.raw.Channel = sa.Channel
-	return unsafe.Pointer(&sa.raw), _Socklen(sizeofSockaddrHCI), nil
-}
-
-func Socket(domain, typ, proto int) (int, error) {
-	for i := 0; i < 5; i++ {
-		if fd, err := syscall.Socket(domain, typ, proto); err == nil || err != syscall.EBUSY {
-			return fd, err
-		}
-		time.Sleep(time.Second)
-	}
-	return 0, ErrSocketOpenFailed
-}
-
-func Bind(fd int, sa Sockaddr) (err error) {
-	ptr, n, err := sa.sockaddr()
-	if err != nil {
-		return err
-	}
-	for i := 0; i < 5; i++ {
-		if err = bind(fd, ptr, n); err == nil || err != syscall.EBUSY {
-			return err
-		}
-		time.Sleep(time.Second)
-	}
-	return ErrSocketBindTimeout
-}
-
-// Socket Level
-const (
-	SOL_HCI    = 0
-	SOL_L2CAP  = 6
-	SOL_SCO    = 17
-	SOL_RFCOMM = 18
-
-	SOL_BLUETOOTH = 274
-)
-
-// HCI Socket options
-const (
-	HCI_DATA_DIR   = 1
-	HCI_FILTER     = 2
-	HCI_TIME_STAMP = 3
-)
-
-type HCIFilter struct {
-	TypeMask  uint32
-	EventMask [2]uint32
-	opcode    uint16
-}
-
-func SetsockoptFilter(fd int, f *HCIFilter) (err error) {
-	return setsockopt(fd, SOL_HCI, HCI_FILTER, unsafe.Pointer(f), unsafe.Sizeof(*f))
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_common.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_common.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_common.go
deleted file mode 100644
index b01ceeb..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_common.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build !386
-
-package socket
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
-	_, _, e1 := syscall.Syscall(syscall.SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
-func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
-	_, _, e1 := syscall.Syscall6(syscall.SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_darwin.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_darwin.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_darwin.go
deleted file mode 100644
index abb96a5..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_darwin.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// +build darwin
-
-package socket
-
-// For compile time compatibility
-const AF_BLUETOOTH = 0

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux.go
deleted file mode 100644
index 4793915..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build linux
-
-package socket
-
-import "syscall"
-
-const AF_BLUETOOTH = syscall.AF_BLUETOOTH

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/abf65d3a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux_386.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux_386.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux_386.go
deleted file mode 100644
index 05ca65c..0000000
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/socket/socket_linux_386.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build linux,386
-
-package socket
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-const (
-	BIND         = 2
-	SETSOCKETOPT = 14
-)
-
-func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
-	_, e1 := socketcall(BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
-func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
-	_, e1 := socketcall(SETSOCKETOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
-	if e1 != 0 {
-		err = e1
-	}
-	return
-}
-
-func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)



Mime
View raw message