This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git


The following commit(s) were added to refs/heads/master by this push:
     new 17c44f0  nmxact - use newtmgr, not OIC res reads for hwid.
17c44f0 is described below

commit 17c44f071d326b1e82954aa19a3ab5fe308c29be
Author: Christopher Collins <[email protected]>
AuthorDate: Thu Jul 6 18:39:16 2017 -0700

    nmxact - use newtmgr, not OIC res reads for hwid.
---
 nmxact/nmble/ble_scanner.go | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/nmxact/nmble/ble_scanner.go b/nmxact/nmble/ble_scanner.go
index 1214f04..478f1dd 100644
--- a/nmxact/nmble/ble_scanner.go
+++ b/nmxact/nmble/ble_scanner.go
@@ -11,6 +11,7 @@ import (
        "mynewt.apache.org/newtmgr/nmxact/nmxutil"
        "mynewt.apache.org/newtmgr/nmxact/scan"
        "mynewt.apache.org/newtmgr/nmxact/sesn"
+       "mynewt.apache.org/newtmgr/nmxact/xact"
 )
 
 // Implements scan.Scanner.
@@ -83,22 +84,20 @@ func (s *BleScanner) connect(dev BleDev) error {
 }
 
 func (s *BleScanner) readHwId() (string, error) {
-       rsp, err := sesn.GetResource(s.bos, "/mynewt/hwid", sesn.NewTxOptions())
-       if err != nil {
-               return "", err
-       }
+       c := xact.NewConfigReadCmd()
+       c.Name = "id/hwid"
 
-       m, err := nmxutil.DecodeCborMap(rsp)
+       res, err := c.Run(s.bos)
        if err != nil {
                return "", err
        }
-
-       hwid, ok := m["hwid"].(string)
-       if !ok {
-               return "", fmt.Errorf("device reports invalid hwid: %#v", hwid)
+       if res.Status() != 0 {
+               return "",
+                       fmt.Errorf("failed to read hardware ID; NMP 
status=%discoverer",
+                               res.Status())
        }
-
-       return hwid, nil
+       cres := res.(*xact.ConfigReadResult)
+       return cres.Rsp.Val, nil
 }
 
 func (s *BleScanner) scan() (*scan.ScanPeer, error) {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to