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/04/03 23:54:01 UTC

[4/6] incubator-mynewt-newtmgr git commit: nmxact - Update ble example.

nmxact - Update ble example.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/2f088b4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/2f088b4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/2f088b4b

Branch: refs/heads/master
Commit: 2f088b4b40897a8fe01855a1a3d89ec2517ef939
Parents: 2aeb4da
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Apr 3 16:38:21 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Apr 3 16:52:30 2017 -0700

----------------------------------------------------------------------
 nmxact/example/ble_plain/ble_plain.go | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/2f088b4b/nmxact/example/ble_plain/ble_plain.go
----------------------------------------------------------------------
diff --git a/nmxact/example/ble_plain/ble_plain.go b/nmxact/example/ble_plain/ble_plain.go
index 722083b..a91285c 100644
--- a/nmxact/example/ble_plain/ble_plain.go
+++ b/nmxact/example/ble_plain/ble_plain.go
@@ -31,11 +31,11 @@ import (
 
 func main() {
 	// Initialize the BLE transport.
-	params := nmble.XportCfg{
-		SockPath:     "/tmp/blehostd-uds",
-		BlehostdPath: "blehostd",
-		DevPath:      "/dev/cu.usbserial-A600ANJ1",
-	}
+	params := nmble.NewXportCfg()
+	params.SockPath = "/tmp/blehostd-uds"
+	params.BlehostdPath = "blehostd.elf"
+	params.DevPath = "/dev/cu.usbmodem142111"
+
 	x, err := nmble.NewBleXport(params)
 	if err != nil {
 		fmt.Fprintf(os.Stderr, "error creating BLE transport: %s\n",
@@ -52,18 +52,13 @@ func main() {
 	defer x.Stop()
 
 	// Prepare a BLE session:
+	//     * Plain NMP (not tunnelled over OIC).
 	//     * We use a random address.
-	//     * Peer has public address 0b:0a:0b:0a:0b:0a.
+	//     * Peer has name "nimble-bleprph".
 	sc := sesn.NewSesnCfg()
 	sc.MgmtProto = sesn.MGMT_PROTO_NMP
-
 	sc.Ble.OwnAddrType = bledefs.BLE_ADDR_TYPE_RANDOM
-	sc.Ble.PeerSpec = sesn.BlePeerSpecDev(bledefs.BleDev{
-		AddrType: bledefs.BLE_ADDR_TYPE_PUBLIC,
-		Addr: bledefs.BleAddr{
-			Bytes: [6]byte{0x0b, 0x0a, 0x0b, 0x0a, 0x0b, 0x0a},
-		},
-	})
+	sc.Ble.PeerSpec = sesn.BlePeerSpecName("nimble-bleprph")
 
 	s, err := x.BuildSesn(sc)
 	if err != nil {