mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [23/50] incubator-mynewt-newt git commit: newtmgr; also do oic with newtmgr over ble.
Date Thu, 10 Nov 2016 22:38:35 GMT
newtmgr; also do oic with newtmgr over ble.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/22cf2700
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/22cf2700
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/22cf2700

Branch: refs/heads/master
Commit: 22cf27005d16c278e03c3d75c94aa7294e8e9fa5
Parents: c2fe805
Author: Marko Kiiskila <marko@runtime.io>
Authored: Tue Nov 1 12:18:33 2016 -0700
Committer: Marko Kiiskila <marko@runtime.io>
Committed: Tue Nov 1 12:18:33 2016 -0700

----------------------------------------------------------------------
 newtmgr/transport/connble.go | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/22cf2700/newtmgr/transport/connble.go
----------------------------------------------------------------------
diff --git a/newtmgr/transport/connble.go b/newtmgr/transport/connble.go
index f0ad978..e8bcb66 100644
--- a/newtmgr/transport/connble.go
+++ b/newtmgr/transport/connble.go
@@ -36,6 +36,10 @@ var CharDisc = make(chan bool)
 
 var newtmgrServiceId = gatt.MustParseUUID("8D53DC1D-1DB7-4CD3-868B-8A527460AA84")
 var newtmgrServiceCharId = gatt.MustParseUUID("DA2E7828-FBCE-4E01-AE9E-261174997C48")
+
+var newtmgrCoapServiceId = gatt.MustParseUUID("e3f9f9c4-8a83-4055-b647-728b769745d6")
+var newtmgrCoapServiceCharId = gatt.MustParseUUID("e467fee6-d6bb-4956-94df-0090350631f5")
+
 var deviceName string
 var deviceAddress []byte
 var deviceAddressType uint8
@@ -110,15 +114,25 @@ func onPeriphConnected(p gatt.Peripheral, err error) {
 		return
 	}
 
+	var isCoap bool = false
+
 	for _, service := range services {
 
-		if service.UUID().Equal(newtmgrServiceId) {
+		if service.UUID().Equal(newtmgrServiceId) ||
+		   service.UUID().Equal(newtmgrCoapServiceId) {
 			log.Debugf("Newtmgr Service Found %s", service.Name())
 
+			if service.UUID().Equal(newtmgrCoapServiceId) {
+				isCoap = true
+			}
+
 			cs, _ := p.DiscoverCharacteristics(nil, service)
 
 			for _, c := range cs {
-				if c.UUID().Equal(newtmgrServiceCharId) {
+				if (isCoap == false &&
+				    c.UUID().Equal(newtmgrServiceCharId)) ||
+				   (isCoap == true &&
+				    c.UUID().Equal(newtmgrCoapServiceCharId)) {
 					log.Debugf("Newtmgr Characteristic Found")
 					p.SetNotifyValue(c, newtmgrNotifyCB)
 					deviceChar = c


Mime
View raw message