You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/01/13 20:36:54 UTC
[2/2] incubator-mynewt-newt git commit: Use const ids in image
commands.
Use const ids in image commands.
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/f18ce641
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/f18ce641
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/f18ce641
Branch: refs/heads/master
Commit: f18ce641a0faac5f6b7a78c2d834fdaa03a82681
Parents: d96a975
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Jan 13 11:21:28 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Jan 13 11:21:28 2016 -0800
----------------------------------------------------------------------
newtmgr/protocol/imageboot.go | 2 +-
newtmgr/protocol/imagelist.go | 8 +++++++-
newtmgr/protocol/imageupload.go | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f18ce641/newtmgr/protocol/imageboot.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/imageboot.go b/newtmgr/protocol/imageboot.go
index 5bd3fd8..f3e3152 100644
--- a/newtmgr/protocol/imageboot.go
+++ b/newtmgr/protocol/imageboot.go
@@ -48,7 +48,7 @@ func (i *ImageBoot) EncodeWriteRequest() (*NmgrReq, error) {
nmr.Op = NMGR_OP_READ
nmr.Flags = 0
nmr.Group = NMGR_GROUP_ID_IMAGE
- nmr.Id = 2
+ nmr.Id = IMGMGR_NMGR_OP_BOOT
nmr.Len = 0
if i.BootTarget != "" {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f18ce641/newtmgr/protocol/imagelist.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/imagelist.go b/newtmgr/protocol/imagelist.go
index fcc22eb..6598e40 100644
--- a/newtmgr/protocol/imagelist.go
+++ b/newtmgr/protocol/imagelist.go
@@ -24,6 +24,12 @@ type ImageList struct {
Images []string
}
+const (
+ IMGMGR_NMGR_OP_LIST = 0
+ IMGMGR_NMGR_OP_UPLOAD = 1
+ IMGMGR_NMGR_OP_BOOT = 2
+)
+
func NewImageList() (*ImageList, error) {
s := &ImageList{}
s.Images = []string{}
@@ -49,7 +55,7 @@ func (i *ImageList) EncodeWriteRequest() (*NmgrReq, error) {
nmr.Op = NMGR_OP_READ
nmr.Flags = 0
nmr.Group = NMGR_GROUP_ID_IMAGE
- nmr.Id = 0
+ nmr.Id = IMGMGR_NMGR_OP_LIST
nmr.Len = 0
return nmr, nil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f18ce641/newtmgr/protocol/imageupload.go
----------------------------------------------------------------------
diff --git a/newtmgr/protocol/imageupload.go b/newtmgr/protocol/imageupload.go
index e85bdf2..ee0577d 100644
--- a/newtmgr/protocol/imageupload.go
+++ b/newtmgr/protocol/imageupload.go
@@ -54,7 +54,7 @@ func (i *ImageUpload) EncodeWriteRequest() (*NmgrReq, error) {
nmr.Op = NMGR_OP_WRITE
nmr.Flags = 0
nmr.Group = NMGR_GROUP_ID_IMAGE
- nmr.Id = 1
+ nmr.Id = IMGMGR_NMGR_OP_UPLOAD
nmr.Len = uint16(len(data) + 4)
data, err = i.SerializeImageUploadReq([]byte{})
if err != nil {