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/08/21 21:12:58 UTC
[mynewt-newtmgr] branch master updated (bb09891 -> 4a1b8d3)
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git.
from bb09891 newtmgr - revendor
new 22a29a4 nmxact - Send CoAP responses in Go routine.
new 4a1b8d3 newtmgr - revendor
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
newtmgr/Godeps/Godeps.json | 56 +++++++++++-----------
.../newtmgr/nmxact/nmble/ble_oic_svr.go | 39 ++++++++-------
nmxact/nmble/ble_oic_svr.go | 39 ++++++++-------
3 files changed, 74 insertions(+), 60 deletions(-)
--
To stop receiving notification emails like this one, please contact
['"commits@mynewt.apache.org" <co...@mynewt.apache.org>'].
[mynewt-newtmgr] 01/02: nmxact - Send CoAP responses in Go routine.
Posted by cc...@apache.org.
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
commit 22a29a4fb8780ff322ca32f4b87852aa7b6c9e20
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Aug 21 14:08:53 2017 -0700
nmxact - Send CoAP responses in Go routine.
This unblocks blehostd while nmxact is generating its CoAP response.
Prior to this change, the host is waiting for an ATT error code to send
in response to the incoming characteristic write. Now, nmxact
immediately indicates an error code of 0, and the notification
containing the CoAP response gets sent later.
---
nmxact/nmble/ble_oic_svr.go | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/nmxact/nmble/ble_oic_svr.go b/nmxact/nmble/ble_oic_svr.go
index c0c6d9f..9cdbed3 100644
--- a/nmxact/nmble/ble_oic_svr.go
+++ b/nmxact/nmble/ble_oic_svr.go
@@ -30,31 +30,31 @@ func (b *BleOicSvr) AddResource(r oic.Resource) error {
return b.s.AddResource(r)
}
-func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
+func (b *BleOicSvr) processCoap(access BleGattAccess) {
+ s := b.x.findSesn(access.ConnHandle)
+ if s == nil {
+ // The sender is no longer connected.
+ log.Debugf("Failed to send CoAP response; peer no longer "+
+ "connected (conn_handle=%d)", access.ConnHandle)
+ return
+ }
+
ml, err := b.s.Rx(access.Data)
if err != nil {
log.Debugf("Error processing incoming CoAP message: %s", err.Error())
- return 0
+ return
}
if ml == nil {
// Partial CoAP message; remainder forthcoming.
- return 0
- }
-
- s := b.x.findSesn(access.ConnHandle)
- if s == nil {
- // The sender is no longer connected.
- log.Debugf("Failed to send CoAP response; peer no longer "+
- "connected (conn_handle=%d)", access.ConnHandle)
- return ERR_CODE_ATT_UNLIKELY
+ return
}
data, err := ml.MarshalBinary()
if err != nil {
log.Debugf("Failed to send CoAP response; error marshalling "+
"response: %s", err.Error())
- return ERR_CODE_ATT_UNLIKELY
+ return
}
_, valHandle, err := FindChrXact(b.x, b.rspSvcUuid, b.rspChrUuid)
@@ -62,20 +62,27 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
log.Debugf("Failed to send CoAP response; cannot find response "+
"characteristic: (s=%s c=%s)",
b.rspSvcUuid.String(), b.rspChrUuid.String())
- return ERR_CODE_ATT_UNLIKELY
+ return
}
mtu := s.MtuOut()
frags := nmxutil.Fragment(data, mtu)
- for _, frag := range frags {
+ for i, frag := range frags {
if err := NotifyXact(b.x, access.ConnHandle, valHandle,
frag); err != nil {
log.Debugf("Failed to send CoAP response; failed to send "+
- "fragment: %s", err.Error())
- return ERR_CODE_ATT_UNLIKELY
+ "fragment %d/%d: %s", err.Error(), i, len(frags))
+ return
}
}
+}
+
+func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
+ // Process the CoAP request and send a response via notification in the
+ // background.
+ go b.processCoap(access)
+ // Indicate success to BLE server.
return 0
}
--
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.
[mynewt-newtmgr] 02/02: newtmgr - revendor
Posted by cc...@apache.org.
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
commit 4a1b8d376ab5c084c70c3d65ccfc08da461564b5
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Aug 21 14:11:09 2017 -0700
newtmgr - revendor
---
newtmgr/Godeps/Godeps.json | 56 +++++++++++-----------
.../newtmgr/nmxact/nmble/ble_oic_svr.go | 39 ++++++++-------
2 files changed, 51 insertions(+), 44 deletions(-)
diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index 37f67fe..2671c02 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -127,73 +127,73 @@
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/adv",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/bledefs",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/mgmt",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmble",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmp",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmserial",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/nmxutil",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/oic",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/omp",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/scan",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/sesn",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/udp",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xact",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
},
{
"ImportPath": "mynewt.apache.org/newtmgr/nmxact/xport",
- "Comment": "mynewt_1_1_0_tag-60-g92c6387",
- "Rev": "92c6387867ea52d83b0572d06a2fc2a63d201c61"
+ "Comment": "mynewt_1_1_0_tag-62-gff451f7",
+ "Rev": "ff451f7f35625b615e8d152dd55ad86c86e04423"
}
]
}
diff --git a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
index c0c6d9f..9cdbed3 100644
--- a/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
+++ b/newtmgr/vendor/mynewt.apache.org/newtmgr/nmxact/nmble/ble_oic_svr.go
@@ -30,31 +30,31 @@ func (b *BleOicSvr) AddResource(r oic.Resource) error {
return b.s.AddResource(r)
}
-func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
+func (b *BleOicSvr) processCoap(access BleGattAccess) {
+ s := b.x.findSesn(access.ConnHandle)
+ if s == nil {
+ // The sender is no longer connected.
+ log.Debugf("Failed to send CoAP response; peer no longer "+
+ "connected (conn_handle=%d)", access.ConnHandle)
+ return
+ }
+
ml, err := b.s.Rx(access.Data)
if err != nil {
log.Debugf("Error processing incoming CoAP message: %s", err.Error())
- return 0
+ return
}
if ml == nil {
// Partial CoAP message; remainder forthcoming.
- return 0
- }
-
- s := b.x.findSesn(access.ConnHandle)
- if s == nil {
- // The sender is no longer connected.
- log.Debugf("Failed to send CoAP response; peer no longer "+
- "connected (conn_handle=%d)", access.ConnHandle)
- return ERR_CODE_ATT_UNLIKELY
+ return
}
data, err := ml.MarshalBinary()
if err != nil {
log.Debugf("Failed to send CoAP response; error marshalling "+
"response: %s", err.Error())
- return ERR_CODE_ATT_UNLIKELY
+ return
}
_, valHandle, err := FindChrXact(b.x, b.rspSvcUuid, b.rspChrUuid)
@@ -62,20 +62,27 @@ func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
log.Debugf("Failed to send CoAP response; cannot find response "+
"characteristic: (s=%s c=%s)",
b.rspSvcUuid.String(), b.rspChrUuid.String())
- return ERR_CODE_ATT_UNLIKELY
+ return
}
mtu := s.MtuOut()
frags := nmxutil.Fragment(data, mtu)
- for _, frag := range frags {
+ for i, frag := range frags {
if err := NotifyXact(b.x, access.ConnHandle, valHandle,
frag); err != nil {
log.Debugf("Failed to send CoAP response; failed to send "+
- "fragment: %s", err.Error())
- return ERR_CODE_ATT_UNLIKELY
+ "fragment %d/%d: %s", err.Error(), i, len(frags))
+ return
}
}
+}
+
+func (b *BleOicSvr) Rx(access BleGattAccess) uint8 {
+ // Process the CoAP request and send a response via notification in the
+ // background.
+ go b.processCoap(access)
+ // Indicate success to BLE server.
return 0
}
--
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.