You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/03/28 22:42:03 UTC

[66/67] [abbrv] incubator-mynewt-newtmgr git commit: newtmgr - use newtmgr repo, not newt repo.

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_util.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_util.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_util.go
deleted file mode 100644
index 08eb8d9..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_util.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package nmble
-
-import (
-	"fmt"
-	"strconv"
-	"sync/atomic"
-
-	log "github.com/Sirupsen/logrus"
-
-	. "mynewt.apache.org/newt/nmxact/bledefs"
-	"mynewt.apache.org/newt/nmxact/nmxutil"
-)
-
-const NmpPlainSvcUuid = "8D53DC1D-1DB7-4CD3-868B-8A527460AA84"
-const NmpPlainChrUuid = "DA2E7828-FBCE-4E01-AE9E-261174997C48"
-const NmpOicSvcUuid = "ADE3D529-C784-4F63-A987-EB69F70EE816"
-const NmpOicReqChrUuid = "AD7B334F-4637-4B86-90B6-9D787F03D218"
-const NmpOicRspChrUuid = "E9241982-4580-42C4-8831-95048216B256"
-
-const WRITE_CMD_BASE_SZ = 3
-const NOTIFY_CMD_BASE_SZ = 3
-
-var nextSeq uint32
-
-func NextSeq() int {
-	return int(atomic.AddUint32(&nextSeq, 1))
-}
-
-func ParseUuid(uuidStr string) (BleUuid, error) {
-	bu := BleUuid{}
-
-	if len(uuidStr) != 36 {
-		return bu, fmt.Errorf("Invalid UUID: %s", uuidStr)
-	}
-
-	boff := 0
-	for i := 0; i < 36; {
-		switch i {
-		case 8, 13, 18, 23:
-			if uuidStr[i] != '-' {
-				return bu, fmt.Errorf("Invalid UUID: %s", uuidStr)
-			}
-			i++
-
-		default:
-			u64, err := strconv.ParseUint(uuidStr[i:i+2], 16, 8)
-			if err != nil {
-				return bu, fmt.Errorf("Invalid UUID: %s", uuidStr)
-			}
-			bu.Bytes[boff] = byte(u64)
-			i += 2
-			boff++
-		}
-	}
-
-	return bu, nil
-}
-
-func BhdTimeoutError(rspType MsgType) error {
-	str := fmt.Sprintf("Timeout waiting for blehostd to send %s response",
-		MsgTypeToString(rspType))
-
-	log.Debug(str)
-	return nmxutil.NewXportTimeoutError(str)
-}
-
-func StatusError(op MsgOp, msgType MsgType, status int) error {
-	str := fmt.Sprintf("%s %s indicates error: %s (%d)",
-		MsgOpToString(op),
-		MsgTypeToString(msgType),
-		ErrCodeToString(status),
-		status)
-
-	log.Debug(str)
-	return nmxutil.NewBleHostError(status, str)
-}
-
-func NewBleConnectReq() *BleConnectReq {
-	return &BleConnectReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_CONNECT,
-		Seq:  NextSeq(),
-
-		OwnAddrType:  BLE_ADDR_TYPE_PUBLIC,
-		PeerAddrType: BLE_ADDR_TYPE_PUBLIC,
-		PeerAddr:     BleAddr{},
-
-		DurationMs:         30000,
-		ScanItvl:           0x0010,
-		ScanWindow:         0x0010,
-		ItvlMin:            24,
-		ItvlMax:            40,
-		Latency:            0,
-		SupervisionTimeout: 0x0200,
-		MinCeLen:           0x0010,
-		MaxCeLen:           0x0300,
-	}
-}
-
-func NewBleTerminateReq() *BleTerminateReq {
-	return &BleTerminateReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_TERMINATE,
-		Seq:  NextSeq(),
-
-		ConnHandle: 0,
-		HciReason:  0,
-	}
-}
-
-func NewBleConnCancelReq() *BleConnCancelReq {
-	return &BleConnCancelReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_CONN_CANCEL,
-		Seq:  NextSeq(),
-	}
-}
-
-func NewBleDiscSvcUuidReq() *BleDiscSvcUuidReq {
-	return &BleDiscSvcUuidReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_DISC_SVC_UUID,
-		Seq:  NextSeq(),
-
-		ConnHandle: 0,
-		Uuid:       BleUuid{},
-	}
-}
-
-func NewBleDiscAllChrsReq() *BleDiscAllChrsReq {
-	return &BleDiscAllChrsReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_DISC_ALL_CHRS,
-		Seq:  NextSeq(),
-	}
-}
-
-func NewBleExchangeMtuReq() *BleExchangeMtuReq {
-	return &BleExchangeMtuReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_EXCHANGE_MTU,
-		Seq:  NextSeq(),
-
-		ConnHandle: 0,
-	}
-}
-
-func NewBleWriteCmdReq() *BleWriteCmdReq {
-	return &BleWriteCmdReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_WRITE_CMD,
-		Seq:  NextSeq(),
-
-		ConnHandle: 0,
-		AttrHandle: 0,
-		Data:       BleBytes{},
-	}
-}
-
-func NewBleScanReq() *BleScanReq {
-	return &BleScanReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_SCAN,
-		Seq:  NextSeq(),
-	}
-}
-
-func NewBleScanCancelReq() *BleScanCancelReq {
-	return &BleScanCancelReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_SCAN_CANCEL,
-		Seq:  NextSeq(),
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_xport.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_xport.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_xport.go
deleted file mode 100644
index 483bfd1..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/ble_xport.go
+++ /dev/null
@@ -1,319 +0,0 @@
-package nmble
-
-import (
-	"encoding/hex"
-	"encoding/json"
-	"fmt"
-	"sync/atomic"
-	"time"
-
-	log "github.com/Sirupsen/logrus"
-
-	"mynewt.apache.org/newt/nmxact/nmxutil"
-	"mynewt.apache.org/newt/nmxact/sesn"
-	"mynewt.apache.org/newt/util/unixchild"
-)
-
-type XportCfg struct {
-	// Path of Unix domain socket to create and listen on.
-	SockPath string
-
-	// Path of the blehostd executable.
-	BlehostdPath string
-
-	// How long to wait for the blehostd process to connect to the Unix domain
-	// socket.
-	BlehostdAcceptTimeout time.Duration
-
-	// Whether to restart the blehostd process if it terminates.
-	BlehostdRestart bool
-
-	// How long to wait for a JSON response from the blehostd process.
-	BlehostdRspTimeout time.Duration
-
-	// Path of the BLE controller device (e.g., /dev/ttyUSB0).
-	DevPath string
-}
-
-func NewXportCfg() XportCfg {
-	return XportCfg{
-		BlehostdAcceptTimeout: time.Second,
-		BlehostdRestart:       true,
-		BlehostdRspTimeout:    time.Second,
-	}
-}
-
-type BleXportState uint32
-
-const (
-	BLE_XPORT_STATE_STOPPED BleXportState = iota
-	BLE_XPORT_STATE_STARTING
-	BLE_XPORT_STATE_STARTED
-)
-
-// Implements xport.Xport.
-type BleXport struct {
-	Bd     *BleDispatcher
-	client *unixchild.Client
-	state  BleXportState
-
-	syncTimeout time.Duration
-	rspTimeout  time.Duration
-}
-
-func NewBleXport(cfg XportCfg) (*BleXport, error) {
-	config := unixchild.Config{
-		SockPath:      cfg.SockPath,
-		ChildPath:     cfg.BlehostdPath,
-		ChildArgs:     []string{cfg.DevPath, cfg.SockPath},
-		Depth:         10,
-		MaxMsgSz:      10240,
-		AcceptTimeout: cfg.BlehostdAcceptTimeout,
-		Restart:       cfg.BlehostdRestart,
-	}
-
-	c := unixchild.New(config)
-
-	bx := &BleXport{
-		client:      c,
-		Bd:          NewBleDispatcher(),
-		syncTimeout: 10 * time.Second,
-		rspTimeout:  cfg.BlehostdRspTimeout,
-	}
-
-	return bx, nil
-}
-
-func (bx *BleXport) BuildSesn(cfg sesn.SesnCfg) (sesn.Sesn, error) {
-	switch cfg.MgmtProto {
-	case sesn.MGMT_PROTO_NMP:
-		return NewBlePlainSesn(bx, cfg), nil
-	case sesn.MGMT_PROTO_OMP:
-		return NewBleOicSesn(bx, cfg), nil
-	default:
-		return nil, fmt.Errorf(
-			"Invalid management protocol: %d; expected NMP or OMP",
-			cfg.MgmtProto)
-	}
-}
-
-func (bx *BleXport) addSyncListener() (*BleListener, error) {
-	bl := NewBleListener()
-	base := BleMsgBase{
-		Op:         MSG_OP_EVT,
-		Type:       MSG_TYPE_SYNC_EVT,
-		Seq:        -1,
-		ConnHandle: -1,
-	}
-	if err := bx.Bd.AddListener(base, bl); err != nil {
-		return nil, err
-	}
-
-	return bl, nil
-}
-
-func (bx *BleXport) removeSyncListener() {
-	base := BleMsgBase{
-		Op:         MSG_OP_EVT,
-		Type:       MSG_TYPE_SYNC_EVT,
-		Seq:        -1,
-		ConnHandle: -1,
-	}
-	bx.Bd.RemoveListener(base)
-}
-
-func (bx *BleXport) querySyncStatus() (bool, error) {
-	req := &BleSyncReq{
-		Op:   MSG_OP_REQ,
-		Type: MSG_TYPE_SYNC,
-		Seq:  NextSeq(),
-	}
-
-	j, err := json.Marshal(req)
-	if err != nil {
-		return false, err
-	}
-
-	bl := NewBleListener()
-	base := BleMsgBase{
-		Op:         -1,
-		Type:       -1,
-		Seq:        req.Seq,
-		ConnHandle: -1,
-	}
-	if err := bx.Bd.AddListener(base, bl); err != nil {
-		return false, err
-	}
-	defer bx.Bd.RemoveListener(base)
-
-	bx.txNoSync(j)
-	for {
-		select {
-		case err := <-bl.ErrChan:
-			return false, err
-		case bm := <-bl.BleChan:
-			switch msg := bm.(type) {
-			case *BleSyncRsp:
-				return msg.Synced, nil
-			}
-		}
-	}
-}
-
-func (bx *BleXport) initialSyncCheck() (bool, *BleListener, error) {
-	bl, err := bx.addSyncListener()
-	if err != nil {
-		return false, nil, err
-	}
-
-	synced, err := bx.querySyncStatus()
-	if err != nil {
-		bx.removeSyncListener()
-		return false, nil, err
-	}
-
-	return synced, bl, nil
-}
-
-func (bx *BleXport) onError(err error) {
-	if !bx.setStateFrom(BLE_XPORT_STATE_STARTED, BLE_XPORT_STATE_STOPPED) &&
-		!bx.setStateFrom(BLE_XPORT_STATE_STARTING, BLE_XPORT_STATE_STOPPED) {
-
-		// Stop already in progress.
-		return
-	}
-	bx.Bd.ErrorAll(err)
-	if bx.client != nil {
-		bx.client.Stop()
-		bx.client.FromChild <- nil
-	}
-}
-
-func (bx *BleXport) setStateFrom(from BleXportState, to BleXportState) bool {
-	return atomic.CompareAndSwapUint32(
-		(*uint32)(&bx.state), uint32(from), uint32(to))
-}
-
-func (bx *BleXport) getState() BleXportState {
-	u32 := atomic.LoadUint32((*uint32)(&bx.state))
-	return BleXportState(u32)
-}
-
-func (bx *BleXport) Stop() error {
-	bx.onError(nil)
-	return nil
-}
-
-func (bx *BleXport) Start() error {
-	if !bx.setStateFrom(BLE_XPORT_STATE_STOPPED, BLE_XPORT_STATE_STARTING) {
-		return nmxutil.NewXportError("BLE xport started twice")
-	}
-
-	if err := bx.client.Start(); err != nil {
-		return nmxutil.NewXportError(
-			"Failed to start child child process: " + err.Error())
-	}
-
-	go func() {
-		err := <-bx.client.ErrChild
-		if unixchild.IsUcAcceptError(err) {
-			err = fmt.Errorf("blehostd did not connect to socket; " +
-				"controller not attached?")
-		}
-		bx.onError(err)
-		return
-	}()
-
-	go func() {
-		for {
-			if _, err := bx.rx(); err != nil {
-				// The error should have been reported to everyone interested.
-				break
-			}
-		}
-	}()
-
-	synced, bl, err := bx.initialSyncCheck()
-	if err != nil {
-		bx.Stop()
-		return err
-	}
-
-	if !synced {
-		// Not synced yet.  Wait for sync event.
-
-	SyncLoop:
-		for {
-			select {
-			case err := <-bl.ErrChan:
-				return err
-			case bm := <-bl.BleChan:
-				switch msg := bm.(type) {
-				case *BleSyncEvt:
-					if msg.Synced {
-						break SyncLoop
-					}
-				}
-			case <-time.After(bx.syncTimeout):
-				bx.Stop()
-				return nmxutil.NewXportError(
-					"Timeout waiting for host <-> controller sync")
-			}
-		}
-	}
-
-	// Host and controller are synced.  Listen for sync loss in the background.
-	go func() {
-		for {
-			select {
-			case err := <-bl.ErrChan:
-				bx.onError(err)
-				return
-			case bm := <-bl.BleChan:
-				switch msg := bm.(type) {
-				case *BleSyncEvt:
-					if !msg.Synced {
-						bx.onError(nmxutil.NewXportError(
-							"BLE host <-> controller sync lost"))
-						return
-					}
-				}
-			}
-		}
-	}()
-
-	if !bx.setStateFrom(BLE_XPORT_STATE_STARTING, BLE_XPORT_STATE_STARTED) {
-		return nmxutil.NewXportError(
-			"Internal error; BLE transport in unexpected state")
-	}
-
-	return nil
-}
-
-func (bx *BleXport) txNoSync(data []byte) {
-	log.Debugf("Tx to blehostd:\n%s", hex.Dump(data))
-	bx.client.ToChild <- data
-}
-
-func (bx *BleXport) Tx(data []byte) error {
-	if bx.getState() != BLE_XPORT_STATE_STARTED {
-		return nmxutil.NewXportError("Attempt to transmit before BLE xport " +
-			"fully started")
-	}
-
-	bx.txNoSync(data)
-	return nil
-}
-
-func (bx *BleXport) rx() ([]byte, error) {
-	select {
-	case err := <-bx.client.ErrChild:
-		return nil, err
-	case buf := <-bx.client.FromChild:
-		if len(buf) != 0 {
-			log.Debugf("Receive from blehostd:\n%s", hex.Dump(buf))
-			bx.Bd.Dispatch(buf)
-		}
-		return buf, nil
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/dispatch.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/dispatch.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/dispatch.go
deleted file mode 100644
index 546fc11..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmble/dispatch.go
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmble
-
-import (
-	"encoding/json"
-	"fmt"
-	"sync"
-	"time"
-
-	log "github.com/Sirupsen/logrus"
-)
-
-type OpTypePair struct {
-	Op   MsgOp
-	Type MsgType
-}
-
-type BleMsgBase struct {
-	// Header
-	Op   MsgOp   `json:"op"`
-	Type MsgType `json:"type"`
-	Seq  int     `json:"seq"`
-
-	// Optional
-	ConnHandle int `json:"conn_handle" json:",omitempty"`
-}
-
-type BleListener struct {
-	BleChan chan BleMsg
-	ErrChan chan error
-	TmoChan chan time.Time
-	Acked   bool
-
-	timer *time.Timer
-}
-
-func NewBleListener() *BleListener {
-	return &BleListener{
-		BleChan: make(chan BleMsg, 16),
-		ErrChan: make(chan error, 4),
-		TmoChan: make(chan time.Time, 1),
-	}
-}
-
-func (bl *BleListener) AfterTimeout(tmo time.Duration) <-chan time.Time {
-	fn := func() {
-		if !bl.Acked {
-			bl.TmoChan <- time.Now()
-		}
-	}
-	bl.timer = time.AfterFunc(tmo, fn)
-	return bl.TmoChan
-}
-
-func (bl *BleListener) Stop() {
-	if bl.timer != nil {
-		bl.timer.Stop()
-	}
-}
-
-type BleDispatcher struct {
-	seqMap  map[int]*BleListener
-	baseMap map[BleMsgBase]*BleListener
-	mutex   sync.Mutex
-}
-
-type msgCtor func() BleMsg
-
-func errRspCtor() BleMsg         { return &BleErrRsp{} }
-func syncRspCtor() BleMsg        { return &BleSyncRsp{} }
-func connectRspCtor() BleMsg     { return &BleConnectRsp{} }
-func terminateRspCtor() BleMsg   { return &BleTerminateRsp{} }
-func discSvcUuidRspCtor() BleMsg { return &BleDiscSvcUuidRsp{} }
-func discAllChrsRspCtor() BleMsg { return &BleDiscAllChrsRsp{} }
-func discChrUuidRspCtor() BleMsg { return &BleDiscChrUuidRsp{} }
-func writeCmdRspCtor() BleMsg    { return &BleWriteCmdRsp{} }
-func exchangeMtuRspCtor() BleMsg { return &BleExchangeMtuRsp{} }
-func connCancelRspCtor() BleMsg  { return &BleConnCancelRsp{} }
-func scanRspCtor() BleMsg        { return &BleScanRsp{} }
-func scanCancelRspCtor() BleMsg  { return &BleScanCancelRsp{} }
-
-func syncEvtCtor() BleMsg       { return &BleSyncEvt{} }
-func connectEvtCtor() BleMsg    { return &BleConnectEvt{} }
-func disconnectEvtCtor() BleMsg { return &BleDisconnectEvt{} }
-func discSvcEvtCtor() BleMsg    { return &BleDiscSvcEvt{} }
-func discChrEvtCtor() BleMsg    { return &BleDiscChrEvt{} }
-func notifyRxEvtCtor() BleMsg   { return &BleNotifyRxEvt{} }
-func mtuChangeEvtCtor() BleMsg  { return &BleMtuChangeEvt{} }
-func scanEvtCtor() BleMsg       { return &BleScanEvt{} }
-
-var msgCtorMap = map[OpTypePair]msgCtor{
-	{MSG_OP_RSP, MSG_TYPE_ERR}:           errRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_SYNC}:          syncRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_CONNECT}:       connectRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_TERMINATE}:     terminateRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_DISC_SVC_UUID}: discSvcUuidRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_DISC_CHR_UUID}: discChrUuidRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_DISC_ALL_CHRS}: discAllChrsRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_WRITE_CMD}:     writeCmdRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_EXCHANGE_MTU}:  exchangeMtuRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_CONN_CANCEL}:   connCancelRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_SCAN}:          scanRspCtor,
-	{MSG_OP_RSP, MSG_TYPE_SCAN_CANCEL}:   scanCancelRspCtor,
-
-	{MSG_OP_EVT, MSG_TYPE_SYNC_EVT}:       syncEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_CONNECT_EVT}:    connectEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_DISCONNECT_EVT}: disconnectEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_DISC_SVC_EVT}:   discSvcEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_DISC_CHR_EVT}:   discChrEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_NOTIFY_RX_EVT}:  notifyRxEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_MTU_CHANGE_EVT}: mtuChangeEvtCtor,
-	{MSG_OP_EVT, MSG_TYPE_SCAN_EVT}:       scanEvtCtor,
-}
-
-func NewBleDispatcher() *BleDispatcher {
-	return &BleDispatcher{
-		seqMap:  map[int]*BleListener{},
-		baseMap: map[BleMsgBase]*BleListener{},
-	}
-}
-
-func (bd *BleDispatcher) findBaseListener(base BleMsgBase) (
-	BleMsgBase, *BleListener) {
-
-	for k, v := range bd.baseMap {
-		if k.Op != -1 && base.Op != -1 && k.Op != base.Op {
-			continue
-		}
-		if k.Type != -1 && base.Type != -1 && k.Type != base.Type {
-			continue
-		}
-		if k.ConnHandle != -1 && base.ConnHandle != -1 &&
-			k.ConnHandle != base.ConnHandle {
-
-			continue
-		}
-
-		return k, v
-	}
-
-	return base, nil
-}
-
-func (bd *BleDispatcher) findDupListener(base BleMsgBase) (
-	BleMsgBase, *BleListener) {
-
-	if base.Seq != -1 {
-		return base, bd.seqMap[base.Seq]
-	}
-
-	return bd.findBaseListener(base)
-}
-
-func (bd *BleDispatcher) findListener(base BleMsgBase) (
-	BleMsgBase, *BleListener) {
-
-	if base.Seq != -1 {
-		if bl := bd.seqMap[base.Seq]; bl != nil {
-			return base, bl
-		}
-	}
-
-	return bd.findBaseListener(base)
-}
-
-func (bd *BleDispatcher) AddListener(base BleMsgBase,
-	listener *BleListener) error {
-
-	bd.mutex.Lock()
-	defer bd.mutex.Unlock()
-
-	if ob, old := bd.findDupListener(base); old != nil {
-		return fmt.Errorf(
-			"Duplicate BLE listener;\n"+
-				"    old=op=%d type=%d seq=%d connHandle=%d\n"+
-				"    new=op=%d type=%d seq=%d connHandle=%d",
-			ob.Op, ob.Type, ob.Seq, ob.ConnHandle,
-			base.Op, base.Type, base.Seq, base.ConnHandle)
-	}
-
-	if base.Seq != -1 {
-		if base.Op != -1 ||
-			base.Type != -1 ||
-			base.ConnHandle != -1 {
-			return fmt.Errorf(
-				"Invalid listener base; non-wild seq with wild fields")
-		}
-
-		bd.seqMap[base.Seq] = listener
-	} else {
-		bd.baseMap[base] = listener
-	}
-
-	return nil
-}
-
-func (bd *BleDispatcher) RemoveListener(base BleMsgBase) *BleListener {
-	bd.mutex.Lock()
-	defer bd.mutex.Unlock()
-
-	base, bl := bd.findListener(base)
-	if bl != nil {
-		bl.Stop()
-		if base.Seq != -1 {
-			delete(bd.seqMap, base.Seq)
-		} else {
-			delete(bd.baseMap, base)
-		}
-	}
-
-	return bl
-}
-
-func decodeBleBase(data []byte) (BleMsgBase, error) {
-	base := BleMsgBase{}
-	if err := json.Unmarshal(data, &base); err != nil {
-		return base, err
-	}
-
-	return base, nil
-}
-
-func decodeBleMsg(data []byte) (BleMsgBase, BleMsg, error) {
-	base, err := decodeBleBase(data)
-	if err != nil {
-		return base, nil, err
-	}
-
-	opTypePair := OpTypePair{base.Op, base.Type}
-	cb := msgCtorMap[opTypePair]
-	if cb == nil {
-		return base, nil, fmt.Errorf(
-			"Unrecognized op+type pair: %s, %s",
-			MsgOpToString(base.Op), MsgTypeToString(base.Type))
-	}
-
-	msg := cb()
-	if err := json.Unmarshal(data, msg); err != nil {
-		return base, nil, err
-	}
-
-	return base, msg, nil
-}
-
-func (bd *BleDispatcher) Dispatch(data []byte) {
-	base, msg, err := decodeBleMsg(data)
-	if err != nil {
-		log.Warnf("BLE dispatch error: %s", err.Error())
-		return
-	}
-
-	_, listener := bd.findListener(base)
-	if listener == nil {
-		log.Debugf(
-			"No BLE listener for op=%d type=%d seq=%d connHandle=%d",
-			base.Op, base.Type, base.Seq, base.ConnHandle)
-		return
-	}
-
-	listener.BleChan <- msg
-}
-
-func (bd *BleDispatcher) ErrorAll(err error) {
-	bd.mutex.Lock()
-
-	listeners := make([]*BleListener, 0, len(bd.seqMap)+len(bd.baseMap))
-	for _, v := range bd.seqMap {
-		listeners = append(listeners, v)
-	}
-	for _, v := range bd.baseMap {
-		listeners = append(listeners, v)
-	}
-
-	bd.mutex.Unlock()
-
-	for _, listener := range listeners {
-		listener.ErrChan <- err
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/config.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/config.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/config.go
deleted file mode 100644
index dc00df5..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/config.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $read                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type ConfigReadReq struct {
-	NmpBase `structs:"-"`
-	Name    string `codec:"name"`
-}
-
-type ConfigReadRsp struct {
-	NmpBase
-	Rc  int    `codec:"rc" codec:",omitempty"`
-	Val string `codec:"val"`
-}
-
-func NewConfigReadReq() *ConfigReadReq {
-	r := &ConfigReadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_CONFIG, NMP_ID_CONFIG_VAL)
-	return r
-}
-
-func (r *ConfigReadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewConfigReadRsp() *ConfigReadRsp {
-	return &ConfigReadRsp{}
-}
-
-func (r *ConfigReadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $write                                                                   //
-//////////////////////////////////////////////////////////////////////////////
-
-type ConfigWriteReq struct {
-	NmpBase
-	Name string `codec:"name"`
-	Val  string `codec:"val"`
-}
-
-type ConfigWriteRsp struct {
-	NmpBase
-	Rc int `codec:"rc" codec:",omitempty"`
-}
-
-func NewConfigWriteReq() *ConfigWriteReq {
-	r := &ConfigWriteReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_CONFIG, NMP_ID_CONFIG_VAL)
-	return r
-}
-
-func (r *ConfigWriteReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewConfigWriteRsp() *ConfigWriteRsp {
-	return &ConfigWriteRsp{}
-}
-
-func (r *ConfigWriteRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/crash.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/crash.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/crash.go
deleted file mode 100644
index 5711d7f..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/crash.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-type CrashReq struct {
-	NmpBase
-	CrashType string `codec:"t"`
-}
-
-type CrashRsp struct {
-	NmpBase
-	Rc int `codec:"rc" codec:",omitempty"`
-}
-
-func NewCrashReq() *CrashReq {
-	r := &CrashReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_CRASH, NMP_ID_CRASH_TRIGGER)
-	return r
-}
-
-func (r *CrashReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewCrashRsp() *CrashRsp {
-	return &CrashRsp{}
-}
-
-func (r *CrashRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/datetime.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/datetime.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/datetime.go
deleted file mode 100644
index ce52d8b..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/datetime.go
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-///////////////////////////////////////////////////////////////////////////////
-// $read                                                                     //
-///////////////////////////////////////////////////////////////////////////////
-
-type DateTimeReadReq struct {
-	NmpBase
-}
-
-type DateTimeReadRsp struct {
-	NmpBase
-	DateTime string `codec:"datetime"`
-	Rc       int    `codec:"rc" codec:",omitempty"`
-}
-
-func NewDateTimeReadReq() *DateTimeReadReq {
-	r := &DateTimeReadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_DEFAULT, NMP_ID_DEF_DATETIME_STR)
-	return r
-}
-
-func (r *DateTimeReadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewDateTimeReadRsp() *DateTimeReadRsp {
-	return &DateTimeReadRsp{}
-}
-
-func (r *DateTimeReadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-///////////////////////////////////////////////////////////////////////////////
-// $write                                                                    //
-///////////////////////////////////////////////////////////////////////////////
-
-type DateTimeWriteReq struct {
-	NmpBase
-	DateTime string `codec:"datetime"`
-}
-
-type DateTimeWriteRsp struct {
-	NmpBase
-	Rc int `codec:"rc" codec:",omitempty"`
-}
-
-func NewDateTimeWriteReq() *DateTimeWriteReq {
-	r := &DateTimeWriteReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_DEFAULT, NMP_ID_DEF_DATETIME_STR)
-	return r
-}
-
-func (r *DateTimeWriteReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewDateTimeWriteRsp() *DateTimeWriteRsp {
-	return &DateTimeWriteRsp{}
-}
-
-func (r *DateTimeWriteRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/decode.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/decode.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/decode.go
deleted file mode 100644
index 748d13d..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/decode.go
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import (
-	"fmt"
-
-	"github.com/ugorji/go/codec"
-)
-
-// These aliases just allow the ctor map to fit within 79 columns.
-const op_wr = NMP_OP_WRITE_RSP
-const op_rr = NMP_OP_READ_RSP
-const gr_def = NMP_GROUP_DEFAULT
-const gr_img = NMP_GROUP_IMAGE
-const gr_sta = NMP_GROUP_STAT
-const gr_cfg = NMP_GROUP_CONFIG
-const gr_log = NMP_GROUP_LOG
-const gr_cra = NMP_GROUP_CRASH
-const gr_run = NMP_GROUP_RUN
-const gr_fil = NMP_GROUP_FS
-
-// Op-Group-Id
-type Ogi struct {
-	Op    uint8
-	Group uint16
-	Id    uint8
-}
-
-type rspCtor func() NmpRsp
-
-func echoRspCtor() NmpRsp          { return NewEchoRsp() }
-func taskStatRspCtor() NmpRsp      { return NewTaskStatRsp() }
-func mpStatRspCtor() NmpRsp        { return NewMempoolStatRsp() }
-func dateTimeReadRspCtor() NmpRsp  { return NewDateTimeReadRsp() }
-func dateTimeWriteRspCtor() NmpRsp { return NewDateTimeWriteRsp() }
-func resetRspCtor() NmpRsp         { return NewResetRsp() }
-func imageUploadRspCtor() NmpRsp   { return NewImageUploadRsp() }
-func imageStateRspCtor() NmpRsp    { return NewImageStateRsp() }
-func coreListRspCtor() NmpRsp      { return NewCoreListRsp() }
-func coreLoadRspCtor() NmpRsp      { return NewCoreLoadRsp() }
-func coreEraseRspCtor() NmpRsp     { return NewCoreEraseRsp() }
-func statReadRspCtor() NmpRsp      { return NewStatReadRsp() }
-func statListRspCtor() NmpRsp      { return NewStatListRsp() }
-func logReadRspCtor() NmpRsp       { return NewLogShowRsp() }
-func logListRspCtor() NmpRsp       { return NewLogListRsp() }
-func logModuleListRspCtor() NmpRsp { return NewLogModuleListRsp() }
-func logLevelListRspCtor() NmpRsp  { return NewLogLevelListRsp() }
-func logClearRspCtor() NmpRsp      { return NewLogClearRsp() }
-func crashRspCtor() NmpRsp         { return NewCrashRsp() }
-func runTestRspCtor() NmpRsp       { return NewRunTestRsp() }
-func runListRspCtor() NmpRsp       { return NewRunListRsp() }
-func fsDownloadRspCtor() NmpRsp    { return NewFsDownloadRsp() }
-func fsUploadRspCtor() NmpRsp      { return NewFsUploadRsp() }
-func configReadRspCtor() NmpRsp    { return NewConfigReadRsp() }
-func configWriteRspCtor() NmpRsp   { return NewConfigWriteRsp() }
-
-var rspCtorMap = map[Ogi]rspCtor{
-	{op_wr, gr_def, NMP_ID_DEF_ECHO}:         echoRspCtor,
-	{op_rr, gr_def, NMP_ID_DEF_TASKSTAT}:     taskStatRspCtor,
-	{op_rr, gr_def, NMP_ID_DEF_MPSTAT}:       mpStatRspCtor,
-	{op_rr, gr_def, NMP_ID_DEF_DATETIME_STR}: dateTimeReadRspCtor,
-	{op_wr, gr_def, NMP_ID_DEF_DATETIME_STR}: dateTimeWriteRspCtor,
-	{op_wr, gr_def, NMP_ID_DEF_RESET}:        resetRspCtor,
-	{op_wr, gr_img, NMP_ID_IMAGE_UPLOAD}:     imageUploadRspCtor,
-	{op_rr, gr_img, NMP_ID_IMAGE_STATE}:      imageStateRspCtor,
-	{op_wr, gr_img, NMP_ID_IMAGE_STATE}:      imageStateRspCtor,
-	{op_rr, gr_img, NMP_ID_IMAGE_CORELIST}:   coreListRspCtor,
-	{op_rr, gr_img, NMP_ID_IMAGE_CORELOAD}:   coreLoadRspCtor,
-	{op_wr, gr_img, NMP_ID_IMAGE_CORELOAD}:   coreEraseRspCtor,
-	{op_rr, gr_sta, NMP_ID_STAT_READ}:        statReadRspCtor,
-	{op_rr, gr_sta, NMP_ID_STAT_LIST}:        statListRspCtor,
-	{op_rr, gr_log, NMP_ID_LOG_SHOW}:         logReadRspCtor,
-	{op_rr, gr_log, NMP_ID_LOG_LIST}:         logListRspCtor,
-	{op_rr, gr_log, NMP_ID_LOG_MODULE_LIST}:  logModuleListRspCtor,
-	{op_rr, gr_log, NMP_ID_LOG_LEVEL_LIST}:   logLevelListRspCtor,
-	{op_wr, gr_log, NMP_ID_LOG_CLEAR}:        logClearRspCtor,
-	{op_wr, gr_cra, NMP_ID_CRASH_TRIGGER}:    crashRspCtor,
-	{op_wr, gr_run, NMP_ID_RUN_TEST}:         runTestRspCtor,
-	{op_rr, gr_run, NMP_ID_RUN_LIST}:         runListRspCtor,
-	{op_rr, gr_fil, NMP_ID_FS_FILE}:          fsDownloadRspCtor,
-	{op_wr, gr_fil, NMP_ID_FS_FILE}:          fsUploadRspCtor,
-	{op_rr, gr_cfg, NMP_ID_CONFIG_VAL}:       configReadRspCtor,
-	{op_wr, gr_cfg, NMP_ID_CONFIG_VAL}:       configWriteRspCtor,
-}
-
-func DecodeRspBody(hdr *NmpHdr, body []byte) (NmpRsp, error) {
-	cb := rspCtorMap[Ogi{hdr.Op, hdr.Group, hdr.Id}]
-	if cb == nil {
-		return nil, fmt.Errorf("Unrecognized NMP op+group+id: %d, %d, %d",
-			hdr.Op, hdr.Group, hdr.Id)
-	}
-
-	r := cb()
-	cborCodec := new(codec.CborHandle)
-	dec := codec.NewDecoderBytes(body, cborCodec)
-
-	if err := dec.Decode(r); err != nil {
-		return nil, fmt.Errorf("Invalid response: %s", err.Error())
-	}
-
-	r.SetHdr(hdr)
-	return r, nil
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/defs.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/defs.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/defs.go
deleted file mode 100644
index d10ffe5..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/defs.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package nmp
-
-const (
-	NMP_OP_READ      = 0
-	NMP_OP_READ_RSP  = 1
-	NMP_OP_WRITE     = 2
-	NMP_OP_WRITE_RSP = 3
-)
-
-const (
-	NMP_ERR_OK       = 0
-	NMP_ERR_EUNKNOWN = 1
-	NMP_ERR_ENOMEM   = 2
-	NMP_ERR_EINVAL   = 3
-	NMP_ERR_ETIMEOUT = 4
-	NMP_ERR_ENOENT   = 5
-)
-
-// First 64 groups are reserved for system level newtmgr commands.
-// Per-user commands are then defined after group 64.
-
-const (
-	NMP_GROUP_DEFAULT = 0
-	NMP_GROUP_IMAGE   = 1
-	NMP_GROUP_STAT    = 2
-	NMP_GROUP_CONFIG  = 3
-	NMP_GROUP_LOG     = 4
-	NMP_GROUP_CRASH   = 5
-	NMP_GROUP_SPLIT   = 6
-	NMP_GROUP_RUN     = 7
-	NMP_GROUP_FS      = 8
-	NMP_GROUP_PERUSER = 64
-)
-
-// Default group (0).
-const (
-	NMP_ID_DEF_ECHO           = 0
-	NMP_ID_DEF_CONS_ECHO_CTRL = 1
-	NMP_ID_DEF_TASKSTAT       = 2
-	NMP_ID_DEF_MPSTAT         = 3
-	NMP_ID_DEF_DATETIME_STR   = 4
-	NMP_ID_DEF_RESET          = 5
-)
-
-// Image group (1).
-const (
-	NMP_ID_IMAGE_STATE    = 0
-	NMP_ID_IMAGE_UPLOAD   = 1
-	NMP_ID_IMAGE_CORELIST = 3
-	NMP_ID_IMAGE_CORELOAD = 4
-)
-
-// Stat group (2).
-const (
-	NMP_ID_STAT_READ = 0
-	NMP_ID_STAT_LIST = 1
-)
-
-// Config group (3).
-const (
-	NMP_ID_CONFIG_VAL = 0
-)
-
-// Log group (4).
-const (
-	NMP_ID_LOG_SHOW        = 0
-	NMP_ID_LOG_CLEAR       = 1
-	NMP_ID_LOG_APPEND      = 2
-	NMP_ID_LOG_MODULE_LIST = 3
-	NMP_ID_LOG_LEVEL_LIST  = 4
-	NMP_ID_LOG_LIST        = 5
-)
-
-// Crash group (5).
-const (
-	NMP_ID_CRASH_TRIGGER = 0
-)
-
-// Run group (7).
-const (
-	NMP_ID_RUN_TEST = 0
-	NMP_ID_RUN_LIST = 1
-)
-
-// File system group (8).
-const (
-	NMP_ID_FS_FILE = 0
-)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/dispatch.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/dispatch.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/dispatch.go
deleted file mode 100644
index 7b1ad11..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/dispatch.go
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import (
-	"encoding/hex"
-	"fmt"
-	"sync"
-	"time"
-
-	log "github.com/Sirupsen/logrus"
-)
-
-type NmpListener struct {
-	RspChan chan NmpRsp
-	ErrChan chan error
-	tmoChan chan time.Time
-	timer   *time.Timer
-}
-
-func NewNmpListener() *NmpListener {
-	return &NmpListener{
-		RspChan: make(chan NmpRsp, 1),
-		ErrChan: make(chan error, 1),
-	}
-}
-
-func (nl *NmpListener) AfterTimeout(tmo time.Duration) <-chan time.Time {
-	fn := func() {
-		nl.tmoChan <- time.Now()
-	}
-	nl.timer = time.AfterFunc(tmo, fn)
-	return nl.tmoChan
-}
-
-func (nl *NmpListener) Stop() {
-	if nl.timer != nil {
-		nl.timer.Stop()
-	}
-}
-
-type NmpDispatcher struct {
-	seqListenerMap map[uint8]*NmpListener
-	reassembler    *Reassembler
-	mutex          sync.Mutex
-}
-
-func NewNmpDispatcher() *NmpDispatcher {
-	return &NmpDispatcher{
-		seqListenerMap: map[uint8]*NmpListener{},
-		reassembler:    NewReassembler(),
-	}
-}
-
-func (nd *NmpDispatcher) AddListener(seq uint8, nl *NmpListener) error {
-	nd.mutex.Lock()
-	defer nd.mutex.Unlock()
-
-	if _, ok := nd.seqListenerMap[seq]; ok {
-		return fmt.Errorf("Duplicate NMP listener; seq=%d", seq)
-	}
-
-	nd.seqListenerMap[seq] = nl
-	return nil
-}
-
-func (nd *NmpDispatcher) removeListenerNoLock(seq uint8) *NmpListener {
-	nl := nd.seqListenerMap[seq]
-	if nl != nil {
-		nl.Stop()
-		delete(nd.seqListenerMap, seq)
-	}
-	return nl
-}
-
-func (nd *NmpDispatcher) RemoveListener(seq uint8) *NmpListener {
-	nd.mutex.Lock()
-	defer nd.mutex.Unlock()
-
-	return nd.removeListenerNoLock(seq)
-}
-
-func (nd *NmpDispatcher) FakeRxError(seq uint8, err error) error {
-	nd.mutex.Lock()
-	defer nd.mutex.Unlock()
-
-	nl := nd.seqListenerMap[seq]
-	if nl == nil {
-		return fmt.Errorf("No NMP listener for seq %d", seq)
-	}
-
-	nl.ErrChan <- err
-
-	return nil
-}
-
-func decodeRsp(pkt []byte) (NmpRsp, error) {
-	hdr, err := DecodeNmpHdr(pkt)
-	if err != nil {
-		return nil, err
-	}
-
-	// Ignore incoming non-responses.  This is necessary for devices that echo
-	// received requests over serial.
-	if hdr.Op != NMP_OP_READ_RSP && hdr.Op != NMP_OP_WRITE_RSP {
-		return nil, nil
-	}
-
-	body := pkt[NMP_HDR_SIZE:]
-	return DecodeRspBody(hdr, body)
-}
-
-// Returns true if the response was dispatched.
-func (nd *NmpDispatcher) DispatchRsp(r NmpRsp) bool {
-	log.Debugf("Received nmp rsp: %+v", r)
-
-	nl := nd.seqListenerMap[r.Hdr().Seq]
-	if nl == nil {
-		return false
-	}
-
-	nl.RspChan <- r
-
-	return true
-}
-
-// Returns true if the response was dispatched.
-func (nd *NmpDispatcher) Dispatch(data []byte) bool {
-	nd.mutex.Lock()
-	defer nd.mutex.Unlock()
-
-	pkt := nd.reassembler.RxFrag(data)
-	if pkt == nil {
-		return false
-	}
-
-	rsp, err := decodeRsp(pkt)
-	if err != nil {
-		log.Printf("Failure decoding NMP rsp: %s\npacket=\n%s", err.Error(),
-			hex.Dump(data))
-		return false
-	}
-
-	if rsp == nil {
-		// Packet wasn't a response.
-		return false
-	}
-
-	return nd.DispatchRsp(rsp)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/echo.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/echo.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/echo.go
deleted file mode 100644
index e8e334b..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/echo.go
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-type EchoReq struct {
-	NmpBase
-	Payload string `codec:"d"`
-}
-
-type EchoRsp struct {
-	NmpBase
-	Payload string `codec:"r"`
-	Rc      int    `codec:"rc" codec:",omitempty"`
-}
-
-func NewEchoReq() *EchoReq {
-	r := &EchoReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_DEFAULT, NMP_ID_DEF_ECHO)
-	return r
-}
-
-func (r *EchoReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewEchoRsp() *EchoRsp {
-	return &EchoRsp{}
-}
-
-func (r *EchoRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/frag.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/frag.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/frag.go
deleted file mode 100644
index 31ee392..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/frag.go
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import (
-	log "github.com/Sirupsen/logrus"
-)
-
-type Reassembler struct {
-	cur []byte
-}
-
-func NewReassembler() *Reassembler {
-	return &Reassembler{}
-}
-
-func (r *Reassembler) RxFrag(frag []byte) []byte {
-	r.cur = append(r.cur, frag...)
-
-	hdr, err := DecodeNmpHdr(r.cur)
-	if err != nil {
-		// Incomplete header.
-		return nil
-	}
-
-	actualLen := len(r.cur) - NMP_HDR_SIZE
-	if actualLen > int(hdr.Len) {
-		// More data than expected.  Discard packet.
-		log.Debugf("received invalid nmp packet; hdr.len=%d actualLen=%d",
-			hdr.Len, actualLen)
-		r.cur = nil
-		return nil
-	}
-
-	if actualLen < int(hdr.Len) {
-		// More fragments to come.
-		return nil
-	}
-
-	// Packet complete
-	pkt := r.cur
-	r.cur = nil
-	return pkt
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/fs.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/fs.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/fs.go
deleted file mode 100644
index 91083de..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/fs.go
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $download                                                                //
-//////////////////////////////////////////////////////////////////////////////
-
-type FsDownloadReq struct {
-	NmpBase
-	Name string `codec:"name"`
-	Off  uint32 `codec:"off"`
-}
-
-type FsDownloadRsp struct {
-	NmpBase
-	Rc   int    `codec:"rc" codec:",omitempty"`
-	Off  uint32 `codec:"off"`
-	Len  uint32 `codec:"len"`
-	Data []byte `codec:"data"`
-}
-
-func NewFsDownloadReq() *FsDownloadReq {
-	r := &FsDownloadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_FS, NMP_ID_FS_FILE)
-	return r
-}
-
-func (r *FsDownloadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewFsDownloadRsp() *FsDownloadRsp {
-	return &FsDownloadRsp{}
-}
-
-func (r *FsDownloadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $upload                                                                  //
-//////////////////////////////////////////////////////////////////////////////
-
-type FsUploadReq struct {
-	NmpBase
-	Name string `codec:"name" codec:",omitempty"`
-	Len  uint32 `codec:"len" codec:",omitempty"`
-	Off  uint32 `codec:"off"`
-	Data []byte `codec:"data"`
-}
-
-type FsUploadRsp struct {
-	NmpBase
-	Rc  int    `codec:"rc" codec:",omitempty"`
-	Off uint32 `codec:"off"`
-}
-
-func NewFsUploadReq() *FsUploadReq {
-	r := &FsUploadReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_FS, NMP_ID_FS_FILE)
-	return r
-}
-
-func (r *FsUploadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewFsUploadRsp() *FsUploadRsp {
-	return &FsUploadRsp{}
-}
-
-func (r *FsUploadRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/image.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/image.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/image.go
deleted file mode 100644
index ac2d9a0..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/image.go
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $upload                                                                  //
-//////////////////////////////////////////////////////////////////////////////
-
-type ImageUploadReq struct {
-	NmpBase
-	Off  uint32 `codec:"off"`
-	Len  uint32 `codec:"len" codec:",omitempty"`
-	Data []byte `codec:"data"`
-}
-
-type ImageUploadRsp struct {
-	NmpBase
-	Rc  int    `codec:"rc" codec:",omitempty"`
-	Off uint32 `codec:"off"`
-}
-
-func NewImageUploadReq() *ImageUploadReq {
-	r := &ImageUploadReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_IMAGE, NMP_ID_IMAGE_UPLOAD)
-	return r
-}
-
-func (r *ImageUploadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewImageUploadRsp() *ImageUploadRsp {
-	return &ImageUploadRsp{}
-}
-
-func (r *ImageUploadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $state                                                                   //
-//////////////////////////////////////////////////////////////////////////////
-
-type SplitStatus int
-
-const (
-	NOT_APPLICABLE SplitStatus = iota
-	NOT_MATCHING
-	MATCHING
-)
-
-/* returns the enum as a string */
-func (sm SplitStatus) String() string {
-	names := map[SplitStatus]string{
-		NOT_APPLICABLE: "N/A",
-		NOT_MATCHING:   "non-matching",
-		MATCHING:       "matching",
-	}
-
-	str := names[sm]
-	if str == "" {
-		return "Unknown!"
-	}
-	return str
-}
-
-type ImageStateEntry struct {
-	NmpBase
-	Slot      int    `codec:"slot"`
-	Version   string `codec:"version"`
-	Hash      []byte `codec:"hash"`
-	Bootable  bool   `codec:"bootable"`
-	Pending   bool   `codec:"pending"`
-	Confirmed bool   `codec:"confirmed"`
-	Active    bool   `codec:"active"`
-	Permanent bool   `codec:"permanent"`
-}
-
-type ImageStateReadReq struct {
-	NmpBase
-}
-
-type ImageStateWriteReq struct {
-	NmpBase
-	Hash    []byte `codec:"hash"`
-	Confirm bool   `codec:"confirm"`
-}
-
-type ImageStateRsp struct {
-	NmpBase
-	Rc          int               `codec:"rc"`
-	Images      []ImageStateEntry `codec:"images"`
-	SplitStatus SplitStatus       `codec:"splitStatus"`
-}
-
-func NewImageStateReadReq() *ImageStateReadReq {
-	r := &ImageStateReadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_IMAGE, NMP_ID_IMAGE_STATE)
-	return r
-}
-
-func (r *ImageStateReadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewImageStateWriteReq() *ImageStateWriteReq {
-	r := &ImageStateWriteReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_IMAGE, NMP_ID_IMAGE_STATE)
-	return r
-}
-
-func (r *ImageStateWriteReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewImageStateRsp() *ImageStateRsp {
-	return &ImageStateRsp{}
-}
-
-func (r *ImageStateRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $corelist                                                                //
-//////////////////////////////////////////////////////////////////////////////
-
-type CoreListReq struct {
-	NmpBase
-}
-
-type CoreListRsp struct {
-	NmpBase
-	Rc int `codec:"rc"`
-}
-
-func NewCoreListReq() *CoreListReq {
-	r := &CoreListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_IMAGE, NMP_ID_IMAGE_CORELIST)
-	return r
-}
-
-func (r *CoreListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewCoreListRsp() *CoreListRsp {
-	return &CoreListRsp{}
-}
-
-func (r *CoreListRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $coreload                                                                //
-//////////////////////////////////////////////////////////////////////////////
-
-type CoreLoadReq struct {
-	NmpBase
-	Off uint32 `codec:"off"`
-}
-
-type CoreLoadRsp struct {
-	NmpBase
-	Rc   int    `codec:"rc"`
-	Off  uint32 `codec:"off"`
-	Data []byte `codec:"data"`
-}
-
-func NewCoreLoadReq() *CoreLoadReq {
-	r := &CoreLoadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_IMAGE, NMP_ID_IMAGE_CORELOAD)
-	return r
-}
-
-func (r *CoreLoadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewCoreLoadRsp() *CoreLoadRsp {
-	return &CoreLoadRsp{}
-}
-
-func (r *CoreLoadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $coreerase                                                               //
-//////////////////////////////////////////////////////////////////////////////
-
-type CoreEraseReq struct {
-	NmpBase
-}
-
-type CoreEraseRsp struct {
-	NmpBase
-	Rc int `codec:"rc"`
-}
-
-func NewCoreEraseReq() *CoreEraseReq {
-	r := &CoreEraseReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_IMAGE, NMP_ID_IMAGE_CORELOAD)
-	return r
-}
-
-func (r *CoreEraseReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewCoreEraseRsp() *CoreEraseRsp {
-	return &CoreEraseRsp{}
-}
-
-func (r *CoreEraseRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go
deleted file mode 100644
index e03376f..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $defs                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-const (
-	LEVEL_DEBUG    int = 0
-	LEVEL_INFO         = 1
-	LEVEL_WARN         = 2
-	LEVEL_ERROR        = 3
-	LEVEL_CRITICAL     = 4
-	/* Upto 7 custom loglevels */
-	LEVEL_MAX = 255
-)
-
-const (
-	STREAM_LOG  int = 0
-	MEMORY_LOG      = 1
-	STORAGE_LOG     = 2
-)
-
-const (
-	MODULE_DEFAULT     int = 0
-	MODULE_OS              = 1
-	MODULE_NEWTMGR         = 2
-	MODULE_NIMBLE_CTLR     = 3
-	MODULE_NIMBLE_HOST     = 4
-	MODULE_NFFS            = 5
-	MODULE_REBOOT          = 6
-	MODULE_TEST            = 8
-	MODULE_MAX             = 255
-)
-
-var LogModuleNameMap = map[int]string{
-	MODULE_DEFAULT:     "DEFAULT",
-	MODULE_OS:          "OS",
-	MODULE_NEWTMGR:     "NEWTMGR",
-	MODULE_NIMBLE_CTLR: "NIMBLE_CTLR",
-	MODULE_NIMBLE_HOST: "NIMBLE_HOST",
-	MODULE_NFFS:        "NFFS",
-	MODULE_REBOOT:      "REBOOT",
-	MODULE_TEST:        "TEST",
-}
-
-var LogLevelNameMap = map[int]string{
-	LEVEL_DEBUG:    "DEBUG",
-	LEVEL_INFO:     "INFO",
-	LEVEL_WARN:     "WARN",
-	LEVEL_ERROR:    "ERROR",
-	LEVEL_CRITICAL: "CRITICAL",
-}
-
-var LogTypeNameMap = map[int]string{
-	STREAM_LOG:  "STREAM",
-	MEMORY_LOG:  "MEMORY",
-	STORAGE_LOG: "STORAGE",
-}
-
-func LogModuleToString(lm int) string {
-	name := LogModuleNameMap[lm]
-	if name == "" {
-		name = "CUSTOM"
-	}
-	return name
-}
-
-func LogLevelToString(lm int) string {
-	name := LogLevelNameMap[lm]
-	if name == "" {
-		name = "CUSTOM"
-	}
-	return name
-}
-
-func LogTypeToString(lm int) string {
-	name := LogTypeNameMap[lm]
-	if name == "" {
-		name = "UNDEFINED"
-	}
-	return name
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// $show                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type LogShowReq struct {
-	NmpBase
-	Name      string `codec:"log_name"`
-	Timestamp int64  `codec:"ts"`
-	Index     uint32 `codec:"index"`
-}
-
-type LogEntry struct {
-	Index     uint32 `codec:"index"`
-	Timestamp int64  `codec:"ts"`
-	Module    uint8  `codec:"module"`
-	Level     uint8  `codec:"level"`
-	Msg       string `codec:"msg"`
-}
-
-type LogShowLog struct {
-	Name    string     `codec:"name"`
-	Type    int        `codec:"type"`
-	Entries []LogEntry `codec:"entries"`
-}
-
-type LogShowRsp struct {
-	NmpBase
-	Rc        int          `codec:"rc" codec:",omitempty"`
-	NextIndex uint32       `codec:"next_index"`
-	Logs      []LogShowLog `codec:"logs"`
-}
-
-func NewLogShowReq() *LogShowReq {
-	r := &LogShowReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_LOG, NMP_ID_LOG_SHOW)
-	return r
-}
-
-func (r *LogShowReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewLogShowRsp() *LogShowRsp {
-	return &LogShowRsp{}
-}
-
-func (r *LogShowRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $list                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type LogListReq struct {
-	NmpBase
-}
-
-type LogListRsp struct {
-	NmpBase
-	Rc   int      `codec:"rc" codec:",omitempty"`
-	List []string `codec:"log_list"`
-}
-
-func NewLogListReq() *LogListReq {
-	r := &LogListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_LOG, NMP_ID_LOG_LIST)
-	return r
-}
-
-func (r *LogListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewLogListRsp() *LogListRsp {
-	return &LogListRsp{}
-}
-
-func (r *LogListRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $module list                                                             //
-//////////////////////////////////////////////////////////////////////////////
-
-type LogModuleListReq struct {
-	NmpBase
-}
-
-type LogModuleListRsp struct {
-	NmpBase
-	Rc  int            `codec:"rc" codec:",omitempty"`
-	Map map[string]int `codec:"module_map"`
-}
-
-func NewLogModuleListReq() *LogModuleListReq {
-	r := &LogModuleListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_LOG, NMP_ID_LOG_MODULE_LIST)
-	return r
-}
-
-func (r *LogModuleListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewLogModuleListRsp() *LogModuleListRsp {
-	return &LogModuleListRsp{}
-}
-
-func (r *LogModuleListRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $level list                                                              //
-//////////////////////////////////////////////////////////////////////////////
-
-type LogLevelListReq struct {
-	NmpBase
-}
-
-type LogLevelListRsp struct {
-	NmpBase
-	Rc  int            `codec:"rc" codec:",omitempty"`
-	Map map[string]int `codec:"module_map"`
-}
-
-func NewLogLevelListReq() *LogLevelListReq {
-	r := &LogLevelListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_LOG, NMP_ID_LOG_LEVEL_LIST)
-	return r
-}
-
-func (r *LogLevelListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewLogLevelListRsp() *LogLevelListRsp {
-	return &LogLevelListRsp{}
-}
-
-func (r *LogLevelListRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $clear                                                                   //
-//////////////////////////////////////////////////////////////////////////////
-
-type LogClearReq struct {
-	NmpBase
-}
-
-type LogClearRsp struct {
-	NmpBase
-	Rc int `codec:"rc" codec:",omitempty"`
-}
-
-func NewLogClearReq() *LogClearReq {
-	r := &LogClearReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_LOG, NMP_ID_LOG_CLEAR)
-	return r
-}
-
-func (r *LogClearReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewLogClearRsp() *LogClearRsp {
-	return &LogClearRsp{}
-}
-
-func (r *LogClearRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/mpstat.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/mpstat.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/mpstat.go
deleted file mode 100644
index f2313e9..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/mpstat.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-type MempoolStatReq struct {
-	NmpBase
-}
-
-type MempoolStatRsp struct {
-	NmpBase
-	Rc     int                       `codec:"rc"`
-	Mpools map[string]map[string]int `codec:"mpools"`
-}
-
-func NewMempoolStatReq() *MempoolStatReq {
-	r := &MempoolStatReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_DEFAULT, NMP_ID_DEF_MPSTAT)
-	return r
-}
-
-func (r *MempoolStatReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewMempoolStatRsp() *MempoolStatRsp {
-	return &MempoolStatRsp{}
-}
-
-func (r *MempoolStatRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/nmp.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/nmp.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/nmp.go
deleted file mode 100644
index b868e25..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/nmp.go
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import (
-	"encoding/binary"
-	"encoding/hex"
-	"fmt"
-
-	log "github.com/Sirupsen/logrus"
-	"github.com/ugorji/go/codec"
-
-	"mynewt.apache.org/newt/nmxact/nmxutil"
-	"mynewt.apache.org/newt/util"
-)
-
-const NMP_HDR_SIZE = 8
-
-type NmpHdr struct {
-	Op    uint8 /* 3 bits of opcode */
-	Flags uint8
-	Len   uint16
-	Group uint16
-	Seq   uint8
-	Id    uint8
-}
-
-type NmpMsg struct {
-	Hdr  NmpHdr
-	Body interface{}
-}
-
-// Combine req + rsp.
-type NmpReq interface {
-	Hdr() *NmpHdr
-	SetHdr(hdr *NmpHdr)
-
-	Msg() *NmpMsg
-}
-
-type NmpRsp interface {
-	Hdr() *NmpHdr
-	SetHdr(msg *NmpHdr)
-
-	Msg() *NmpMsg
-}
-
-type NmpBase struct {
-	hdr NmpHdr `codec:"-"`
-}
-
-func (b *NmpBase) Hdr() *NmpHdr {
-	return &b.hdr
-}
-
-func (b *NmpBase) SetHdr(h *NmpHdr) {
-	b.hdr = *h
-}
-
-func MsgFromReq(r NmpReq) *NmpMsg {
-	return &NmpMsg{
-		*r.Hdr(),
-		r,
-	}
-}
-
-func NewNmpMsg() *NmpMsg {
-	return &NmpMsg{}
-}
-
-func DecodeNmpHdr(data []byte) (*NmpHdr, error) {
-	if len(data) < NMP_HDR_SIZE {
-		return nil, util.NewNewtError(fmt.Sprintf(
-			"Newtmgr request buffer too small %d bytes", len(data)))
-	}
-
-	hdr := &NmpHdr{}
-
-	hdr.Op = uint8(data[0])
-	hdr.Flags = uint8(data[1])
-	hdr.Len = binary.BigEndian.Uint16(data[2:4])
-	hdr.Group = binary.BigEndian.Uint16(data[4:6])
-	hdr.Seq = uint8(data[6])
-	hdr.Id = uint8(data[7])
-
-	return hdr, nil
-}
-
-func (hdr *NmpHdr) Bytes() []byte {
-	buf := make([]byte, 0, NMP_HDR_SIZE)
-
-	buf = append(buf, byte(hdr.Op))
-	buf = append(buf, byte(hdr.Flags))
-
-	u16b := make([]byte, 2)
-	binary.BigEndian.PutUint16(u16b, hdr.Len)
-	buf = append(buf, u16b...)
-
-	binary.BigEndian.PutUint16(u16b, hdr.Group)
-	buf = append(buf, u16b...)
-
-	buf = append(buf, byte(hdr.Seq))
-	buf = append(buf, byte(hdr.Id))
-
-	return buf
-}
-
-func BodyBytes(body interface{}) ([]byte, error) {
-	data := make([]byte, 0)
-
-	enc := codec.NewEncoderBytes(&data, new(codec.CborHandle))
-	if err := enc.Encode(body); err != nil {
-		return nil, fmt.Errorf("Failed to encode message %s", err.Error())
-	}
-
-	log.Debugf("Encoded %+v to:\n%s", body, hex.Dump(data))
-
-	return data, nil
-}
-
-func EncodeNmpPlain(nmr *NmpMsg) ([]byte, error) {
-	bb, err := BodyBytes(nmr.Body)
-	if err != nil {
-		return nil, err
-	}
-
-	nmr.Hdr.Len = uint16(len(bb))
-
-	hb := nmr.Hdr.Bytes()
-	data := append(hb, bb...)
-
-	log.Debugf("Encoded:\n%s", hex.Dump(data))
-
-	return data, nil
-}
-
-func fillNmpReq(req NmpReq, op uint8, group uint16, id uint8) {
-	hdr := NmpHdr{
-		Op:    op,
-		Flags: 0,
-		Len:   0,
-		Group: group,
-		Seq:   nmxutil.NextNmpSeq(),
-		Id:    id,
-	}
-
-	req.SetHdr(&hdr)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/reset.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/reset.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/reset.go
deleted file mode 100644
index 9b8cbad..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/reset.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-type ResetReq struct {
-	NmpBase
-}
-
-type ResetRsp struct {
-	NmpBase
-}
-
-func NewResetReq() *ResetReq {
-	r := &ResetReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_DEFAULT, NMP_ID_DEF_RESET)
-	return r
-}
-
-func (r *ResetReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewResetRsp() *ResetRsp {
-	return &ResetRsp{}
-}
-
-func (r *ResetRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/run.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/run.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/run.go
deleted file mode 100644
index 3672b0f..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/run.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $test                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type RunTestReq struct {
-	NmpBase
-	Testname string `codec:"testname"`
-	Token    string `codec:"token"`
-}
-
-type RunTestRsp struct {
-	NmpBase
-	Rc int `codec:"rc" codec:",omitempty"`
-}
-
-func NewRunTestReq() *RunTestReq {
-	r := &RunTestReq{}
-	fillNmpReq(r, NMP_OP_WRITE, NMP_GROUP_RUN, NMP_ID_RUN_TEST)
-	return r
-}
-
-func (r *RunTestReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewRunTestRsp() *RunTestRsp {
-	return &RunTestRsp{}
-}
-
-func (r *RunTestRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $list                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type RunListReq struct {
-	NmpBase
-}
-
-type RunListRsp struct {
-	NmpBase
-	Rc   int      `codec:"rc" codec:",omitempty"`
-	List []string `codec:"run_list"`
-}
-
-func NewRunListReq() *RunListReq {
-	r := &RunListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_RUN, NMP_ID_RUN_LIST)
-	return r
-}
-
-func (r *RunListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewRunListRsp() *RunListRsp {
-	return &RunListRsp{}
-}
-
-func (r *RunListRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/stat.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/stat.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/stat.go
deleted file mode 100644
index 2839c02..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/stat.go
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-//////////////////////////////////////////////////////////////////////////////
-// $read                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type StatReadReq struct {
-	NmpBase
-	Name string `codec:"name"`
-}
-
-type StatReadRsp struct {
-	NmpBase
-	Rc     int                    `codec:"rc"`
-	Name   string                 `codec:"name"`
-	Group  string                 `codec:"group"`
-	Fields map[string]interface{} `codec:"fields"`
-}
-
-func NewStatReadReq() *StatReadReq {
-	r := &StatReadReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_STAT, NMP_ID_STAT_READ)
-	return r
-}
-
-func (r *StatReadReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewStatReadRsp() *StatReadRsp {
-	return &StatReadRsp{}
-}
-
-func (r *StatReadRsp) Msg() *NmpMsg { return MsgFromReq(r) }
-
-//////////////////////////////////////////////////////////////////////////////
-// $list                                                                    //
-//////////////////////////////////////////////////////////////////////////////
-
-type StatListReq struct {
-	NmpBase
-}
-
-type StatListRsp struct {
-	NmpBase
-	Rc   int      `codec:"rc"`
-	List []string `codec:"stat_list"`
-}
-
-func NewStatListReq() *StatListReq {
-	r := &StatListReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_STAT, NMP_ID_STAT_LIST)
-	return r
-}
-
-func (r *StatListReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewStatListRsp() *StatListRsp {
-	return &StatListRsp{}
-}
-
-func (r *StatListRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/taskstat.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/taskstat.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/taskstat.go
deleted file mode 100644
index 6dda49d..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/taskstat.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package nmp
-
-import ()
-
-type TaskStatReq struct {
-	NmpBase
-}
-
-type TaskStatRsp struct {
-	NmpBase
-	Rc    int                       `codec:"rc" codec:",omitempty"`
-	Tasks map[string]map[string]int `codec:"tasks"`
-}
-
-func NewTaskStatReq() *TaskStatReq {
-	r := &TaskStatReq{}
-	fillNmpReq(r, NMP_OP_READ, NMP_GROUP_DEFAULT, NMP_ID_DEF_TASKSTAT)
-	return r
-}
-
-func (r *TaskStatReq) Msg() *NmpMsg { return MsgFromReq(r) }
-
-func NewTaskStatRsp() *TaskStatRsp {
-	return &TaskStatRsp{}
-}
-
-func (r *TaskStatRsp) Msg() *NmpMsg { return MsgFromReq(r) }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/packet.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/packet.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/packet.go
deleted file mode 100644
index e25bc2e..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/packet.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package nmserial
-
-import (
-	"bytes"
-)
-
-type Packet struct {
-	expectedLen uint16
-	buffer      *bytes.Buffer
-}
-
-func NewPacket(expectedLen uint16) (*Packet, error) {
-	pkt := &Packet{
-		expectedLen: expectedLen,
-		buffer:      bytes.NewBuffer([]byte{}),
-	}
-
-	return pkt, nil
-}
-
-func (pkt *Packet) AddBytes(bytes []byte) bool {
-	pkt.buffer.Write(bytes)
-	if pkt.buffer.Len() >= int(pkt.expectedLen) {
-		return true
-	} else {
-		return false
-	}
-}
-
-func (pkt *Packet) GetBytes() []byte {
-	return pkt.buffer.Bytes()
-}
-
-func (pkt *Packet) TrimEnd(count int) {
-
-	if pkt.buffer.Len() < count {
-		count = pkt.buffer.Len()
-	}
-	pkt.buffer.Truncate(pkt.buffer.Len() - count)
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_plain_sesn.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_plain_sesn.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_plain_sesn.go
deleted file mode 100644
index a407a98..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_plain_sesn.go
+++ /dev/null
@@ -1,137 +0,0 @@
-package nmserial
-
-import (
-	"fmt"
-	"sync"
-
-	"mynewt.apache.org/newt/nmxact/nmp"
-	"mynewt.apache.org/newt/nmxact/nmxutil"
-	"mynewt.apache.org/newt/nmxact/sesn"
-)
-
-type SerialPlainSesn struct {
-	sx     *SerialXport
-	nd     *nmp.NmpDispatcher
-	isOpen bool
-
-	// This mutex ensures:
-	//     * each response get matched up with its corresponding request.
-	//     * accesses to isOpen are protected.
-	m sync.Mutex
-}
-
-func NewSerialPlainSesn(sx *SerialXport) *SerialPlainSesn {
-	return &SerialPlainSesn{
-		sx: sx,
-		nd: nmp.NewNmpDispatcher(),
-	}
-}
-
-func (sps *SerialPlainSesn) Open() error {
-	sps.m.Lock()
-	defer sps.m.Unlock()
-
-	if sps.isOpen {
-		return nmxutil.NewSesnAlreadyOpenError(
-			"Attempt to open an already-open serial session")
-	}
-
-	sps.isOpen = true
-	return nil
-}
-
-func (sps *SerialPlainSesn) Close() error {
-	sps.m.Lock()
-	defer sps.m.Unlock()
-
-	if !sps.isOpen {
-		return nmxutil.NewSesnClosedError(
-			"Attempt to close an unopened serial session")
-	}
-	sps.isOpen = false
-	return nil
-}
-
-func (sps *SerialPlainSesn) IsOpen() bool {
-	sps.m.Lock()
-	defer sps.m.Unlock()
-
-	return sps.isOpen
-}
-
-func (sps *SerialPlainSesn) MtuIn() int {
-	return 1024
-}
-
-func (sps *SerialPlainSesn) MtuOut() int {
-	// Mynewt commands have a default chunk buffer size of 512.  Account for
-	// base64 encoding.
-	return 512 * 3 / 4
-}
-
-func (sps *SerialPlainSesn) AbortRx(seq uint8) error {
-	return sps.nd.FakeRxError(seq, fmt.Errorf("Rx aborted"))
-}
-
-func (sps *SerialPlainSesn) addNmpListener(seq uint8) (
-	*nmp.NmpListener, error) {
-
-	nl := nmp.NewNmpListener()
-	if err := sps.nd.AddListener(seq, nl); err != nil {
-		return nil, err
-	}
-
-	return nl, nil
-}
-
-func (sps *SerialPlainSesn) removeNmpListener(seq uint8) {
-	sps.nd.RemoveListener(seq)
-}
-
-func (sps *SerialPlainSesn) EncodeNmpMsg(m *nmp.NmpMsg) ([]byte, error) {
-	return nmp.EncodeNmpPlain(m)
-}
-
-func (sps *SerialPlainSesn) TxNmpOnce(m *nmp.NmpMsg, opt sesn.TxOptions) (
-	nmp.NmpRsp, error) {
-
-	sps.m.Lock()
-	defer sps.m.Unlock()
-
-	if !sps.isOpen {
-		return nil, nmxutil.NewSesnClosedError(
-			"Attempt to transmit over closed serial session")
-	}
-
-	nl, err := sps.addNmpListener(m.Hdr.Seq)
-	if err != nil {
-		return nil, err
-	}
-	defer sps.removeNmpListener(m.Hdr.Seq)
-
-	reqb, err := sps.EncodeNmpMsg(m)
-	if err != nil {
-		return nil, err
-	}
-
-	if err := sps.sx.Tx(reqb); err != nil {
-		return nil, err
-	}
-
-	for {
-		rspb, err := sps.sx.Rx()
-		if err != nil {
-			return nil, err
-		}
-
-		// Now wait for newtmgr response.
-		if sps.nd.Dispatch(rspb) {
-			select {
-			case err := <-nl.ErrChan:
-				return nil, err
-			case rsp := <-nl.RspChan:
-				return rsp, nil
-			}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_xport.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_xport.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_xport.go
deleted file mode 100644
index 6f5aa7c..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmserial/serial_xport.go
+++ /dev/null
@@ -1,217 +0,0 @@
-package nmserial
-
-import (
-	"bufio"
-	"encoding/base64"
-	"encoding/binary"
-	"encoding/hex"
-	"fmt"
-	"time"
-
-	log "github.com/Sirupsen/logrus"
-	"github.com/joaojeronimo/go-crc16"
-	"github.com/tarm/serial"
-
-	"mynewt.apache.org/newt/nmxact/nmxutil"
-	"mynewt.apache.org/newt/nmxact/sesn"
-	"mynewt.apache.org/newt/util"
-)
-
-type XportCfg struct {
-	DevPath     string
-	Baud        int
-	ReadTimeout time.Duration
-}
-
-func NewXportCfg() *XportCfg {
-	return &XportCfg{
-		ReadTimeout: 10 * time.Second,
-	}
-}
-
-type SerialXport struct {
-	cfg     *XportCfg
-	port    *serial.Port
-	scanner *bufio.Scanner
-
-	pkt *Packet
-}
-
-func NewSerialXport(cfg *XportCfg) *SerialXport {
-	return &SerialXport{
-		cfg: cfg,
-	}
-}
-
-func (sx *SerialXport) BuildSesn(cfg sesn.SesnCfg) (sesn.Sesn, error) {
-	switch cfg.MgmtProto {
-	case sesn.MGMT_PROTO_NMP:
-		return NewSerialPlainSesn(sx), nil
-	case sesn.MGMT_PROTO_OMP:
-		return nil, fmt.Errorf("OMP over serial currently unsupported")
-	default:
-		return nil, fmt.Errorf(
-			"Invalid management protocol: %d; expected NMP or OMP",
-			cfg.MgmtProto)
-	}
-}
-
-func (sx *SerialXport) Start() error {
-	c := &serial.Config{
-		Name:        sx.cfg.DevPath,
-		Baud:        sx.cfg.Baud,
-		ReadTimeout: sx.cfg.ReadTimeout,
-	}
-
-	var err error
-	sx.port, err = serial.OpenPort(c)
-	if err != nil {
-		return err
-	}
-
-	// Most of the reading will be done line by line, use the
-	// bufio.Scanner to do this
-	sx.scanner = bufio.NewScanner(sx.port)
-
-	return nil
-}
-
-func (sx *SerialXport) Stop() error {
-	return sx.port.Close()
-}
-
-func (sx *SerialXport) txRaw(bytes []byte) error {
-	log.Debugf("Tx serial\n%s", hex.Dump(bytes))
-
-	_, err := sx.port.Write(bytes)
-	if err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func (sx *SerialXport) Tx(bytes []byte) error {
-	log.Debugf("Base64 encoding request:\n%s", hex.Dump(bytes))
-
-	pktData := make([]byte, 2)
-
-	crc := crc16.Crc16(bytes)
-	binary.BigEndian.PutUint16(pktData, crc)
-	bytes = append(bytes, pktData...)
-
-	dLen := uint16(len(bytes))
-	binary.BigEndian.PutUint16(pktData, dLen)
-	pktData = append(pktData, bytes...)
-
-	base64Data := make([]byte, base64.StdEncoding.EncodedLen(len(pktData)))
-
-	base64.StdEncoding.Encode(base64Data, pktData)
-
-	written := 0
-	totlen := len(base64Data)
-
-	for written < totlen {
-		/* write the packet stat designators. They are
-		 * different whether we are starting a new packet or continuing one */
-		if written == 0 {
-			sx.txRaw([]byte{6, 9})
-		} else {
-			/* slower platforms take some time to process each segment
-			 * and have very small receive buffers.  Give them a bit of
-			 * time here */
-			time.Sleep(20 * time.Millisecond)
-			sx.txRaw([]byte{4, 20})
-		}
-
-		/* ensure that the total frame fits into 128 bytes.
-		 * base 64 is 3 ascii to 4 base 64 byte encoding.  so
-		 * the number below should be a multiple of 4.  Also,
-		 * we need to save room for the header (2 byte) and
-		 * carriage return (and possibly LF 2 bytes), */
-
-		/* all totaled, 124 bytes should work */
-		writeLen := util.Min(124, totlen-written)
-
-		writeBytes := base64Data[written : written+writeLen]
-		sx.txRaw(writeBytes)
-		sx.txRaw([]byte{'\n'})
-
-		written += writeLen
-	}
-
-	return nil
-}
-
-// Blocking receive.
-func (sx *SerialXport) Rx() ([]byte, error) {
-	for sx.scanner.Scan() {
-		line := []byte(sx.scanner.Text())
-
-		for {
-			if len(line) > 1 && line[0] == '\r' {
-				line = line[1:]
-			} else {
-				break
-			}
-		}
-		log.Debugf("Rx serial:\n%s", hex.Dump(line))
-		if len(line) < 2 || ((line[0] != 4 || line[1] != 20) &&
-			(line[0] != 6 || line[1] != 9)) {
-			continue
-		}
-
-		base64Data := string(line[2:])
-
-		data, err := base64.StdEncoding.DecodeString(base64Data)
-		if err != nil {
-			return nil, fmt.Errorf("Couldn't decode base64 string:"+
-				" %s\nPacket hex dump:\n%s",
-				base64Data, hex.Dump(line))
-		}
-
-		if line[0] == 6 && line[1] == 9 {
-			if len(data) < 2 {
-				continue
-			}
-
-			pktLen := binary.BigEndian.Uint16(data[0:2])
-			sx.pkt, err = NewPacket(pktLen)
-			if err != nil {
-				return nil, err
-			}
-			data = data[2:]
-		}
-
-		if sx.pkt == nil {
-			continue
-		}
-
-		full := sx.pkt.AddBytes(data)
-		if full {
-			if crc16.Crc16(sx.pkt.GetBytes()) != 0 {
-				return nil, fmt.Errorf("CRC error")
-			}
-
-			/*
-			 * Trim away the 2 bytes of CRC
-			 */
-			sx.pkt.TrimEnd(2)
-			b := sx.pkt.GetBytes()
-			sx.pkt = nil
-
-			log.Debugf("Decoded input:\n%s", hex.Dump(b))
-			return b, nil
-		}
-	}
-
-	err := sx.scanner.Err()
-	if err == nil {
-		// Scanner hit EOF, so we'll need to create a new one.  This only
-		// happens on timeouts.
-		err = nmxutil.NewXportTimeoutError(
-			"Timeout reading from serial connection")
-		sx.scanner = bufio.NewScanner(sx.port)
-	}
-	return nil, err
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxerr.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxerr.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxerr.go
deleted file mode 100644
index aa9da23..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxerr.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package nmxutil
-
-import (
-	"fmt"
-)
-
-// Represents an NMP timeout; request sent, but no response received.
-type NmpTimeoutError struct {
-	Text string
-}
-
-func NewNmpTimeoutError(text string) *NmpTimeoutError {
-	return &NmpTimeoutError{
-		Text: text,
-	}
-}
-
-func FmtNmpTimeoutError(format string, args ...interface{}) *NmpTimeoutError {
-	return NewNmpTimeoutError(fmt.Sprintf(format, args...))
-}
-
-func (e *NmpTimeoutError) Error() string {
-	return e.Text
-}
-
-func IsNmpTimeout(err error) bool {
-	_, ok := err.(*NmpTimeoutError)
-	return ok
-}
-
-type BleSesnDisconnectError struct {
-	Text   string
-	Reason int
-}
-
-func NewBleSesnDisconnectError(reason int,
-	text string) *BleSesnDisconnectError {
-
-	return &BleSesnDisconnectError{
-		Reason: reason,
-		Text:   text,
-	}
-}
-
-func (e *BleSesnDisconnectError) Error() string {
-	return e.Text
-}
-
-func IsBleSesnDisconnect(err error) bool {
-	_, ok := err.(*BleSesnDisconnectError)
-	return ok
-}
-
-type SesnAlreadyOpenError struct {
-	Text string
-}
-
-func NewSesnAlreadyOpenError(text string) *SesnAlreadyOpenError {
-	return &SesnAlreadyOpenError{
-		Text: text,
-	}
-}
-
-func (e *SesnAlreadyOpenError) Error() string {
-	return e.Text
-}
-
-func IsSesnAlreadyOpen(err error) bool {
-	_, ok := err.(*SesnAlreadyOpenError)
-	return ok
-}
-
-type SesnClosedError struct {
-	Text string
-}
-
-func NewSesnClosedError(text string) *SesnClosedError {
-	return &SesnClosedError{
-		Text: text,
-	}
-}
-
-func (e *SesnClosedError) Error() string {
-	return e.Text
-}
-
-func IsSesnClosed(err error) bool {
-	_, ok := err.(*SesnClosedError)
-	return ok
-}
-
-// Represents a low-level transport error.
-type XportError struct {
-	Text string
-}
-
-func NewXportError(text string) *XportError {
-	return &XportError{text}
-}
-
-func (e *XportError) Error() string {
-	return e.Text
-}
-
-func IsXport(err error) bool {
-	_, ok := err.(*XportError)
-	return ok
-}
-
-type XportTimeoutError struct {
-	Text string
-}
-
-func NewXportTimeoutError(text string) *XportTimeoutError {
-	return &XportTimeoutError{text}
-}
-
-func (e *XportTimeoutError) Error() string {
-	return e.Text
-}
-
-func IsXportTimeout(err error) bool {
-	_, ok := err.(*XportTimeoutError)
-	return ok
-}
-
-type BleHostError struct {
-	Text   string
-	Status int
-}
-
-func NewBleHostError(status int, text string) *BleHostError {
-	return &BleHostError{
-		Status: status,
-		Text:   text,
-	}
-}
-
-func FmtBleHostError(status int, format string,
-	args ...interface{}) *BleHostError {
-
-	return NewBleHostError(status, fmt.Sprintf(format, args...))
-}
-
-func (e *BleHostError) Error() string {
-	return e.Text
-}
-
-func IsBleHost(err error) bool {
-	_, ok := err.(*BleHostError)
-	return ok
-}
-
-func ToBleHost(err error) *BleHostError {
-	if berr, ok := err.(*BleHostError); ok {
-		return berr
-	} else {
-		return nil
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/15498bdc/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxutil.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxutil.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxutil.go
deleted file mode 100644
index ef1ecd4..0000000
--- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmxutil/nmxutil.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package nmxutil
-
-import (
-	"math/rand"
-	"sync"
-)
-
-var nextNmpSeq uint8
-var beenRead bool
-var seqMutex sync.Mutex
-
-func NextNmpSeq() uint8 {
-	seqMutex.Lock()
-	defer seqMutex.Unlock()
-
-	if !beenRead {
-		nextNmpSeq = uint8(rand.Uint32())
-		beenRead = true
-	}
-
-	val := nextNmpSeq
-	nextNmpSeq++
-
-	return val
-}