newtmgr - Allow BLE conn prof to specify peer name Prior to this commit, the connection profile had to specify the peer's address type and address.
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/3637a5ae Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/3637a5ae Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/3637a5ae Branch: refs/heads/master Commit: 3637a5ae9473eb27d01162fb1c3190adf01845ef Parents: 2c153c2 Author: Christopher Collins <[email protected]> Authored: Mon Mar 27 19:46:09 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Tue Mar 28 15:38:36 2017 -0700 ---------------------------------------------------------------------- newtmgr/config/ble_config.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/3637a5ae/newtmgr/config/ble_config.go ---------------------------------------------------------------------- diff --git a/newtmgr/config/ble_config.go b/newtmgr/config/ble_config.go index dbdf3dc..e614d7a 100644 --- a/newtmgr/config/ble_config.go +++ b/newtmgr/config/ble_config.go @@ -33,6 +33,7 @@ import ( type BleConfig struct { PeerAddrType bledefs.BleAddrType PeerAddr bledefs.BleAddr + PeerName string OwnAddrType bledefs.BleAddrType OwnAddr bledefs.BleAddr @@ -77,6 +78,8 @@ func ParseBleConnString(cs string) (*BleConfig, error) { return nil, einvalBleConnString("Invalid peer_addr; %s", err.Error()) } + case "peer_name": + bc.PeerName = v case "own_addr_type": bc.OwnAddrType, err = bledefs.BleAddrTypeFromString(v) if err != nil { @@ -102,9 +105,12 @@ func ParseBleConnString(cs string) (*BleConfig, error) { func FillSesnCfg(bc *BleConfig, sc *sesn.SesnCfg) { sc.Ble.OwnAddrType = bc.OwnAddrType - sc.Ble.Peer = bledefs.BleDev{ - AddrType: bc.PeerAddrType, - Addr: bc.PeerAddr, + sc.Ble.Peer = bledefs.BlePeerSpec{ + Dev: bledefs.BleDev{ + AddrType: bc.PeerAddrType, + Addr: bc.PeerAddr, + }, + Name: bc.PeerName, } // We don't need to stick around until a connection closes.
