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/05/20 01:22:22 UTC

[13/13] incubator-mynewt-newt git commit: This closes #9. Merge branch 'newtmgr-add' of https://github.com/vrahane/incubator-mynewt-newt into develop

This closes #9.
Merge branch 'newtmgr-add' of https://github.com/vrahane/incubator-mynewt-newt into develop


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/01f44210
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/01f44210
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/01f44210

Branch: refs/heads/develop
Commit: 01f442104b9fb60134f068ec185a5cb3df6381cb
Parents: cab3a2d 2bd923b
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu May 19 18:19:13 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu May 19 18:19:13 2016 -0700

----------------------------------------------------------------------
 newtmgr/cli/logs.go       | 247 ++++++++++++++++++++++++++++++++++++++---
 newtmgr/cli/stats.go      |  57 ++++++++++
 newtmgr/protocol/logs.go  | 155 +++++++++++++++++++++++++-
 newtmgr/protocol/stats.go |  46 ++++++++
 4 files changed, 485 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/01f44210/newtmgr/cli/stats.go
----------------------------------------------------------------------
diff --cc newtmgr/cli/stats.go
index d7d963b,6174182..714a0bb
--- a/newtmgr/cli/stats.go
+++ b/newtmgr/cli/stats.go
@@@ -25,10 -25,58 +25,59 @@@ import 
  	"mynewt.apache.org/newt/newtmgr/config"
  	"mynewt.apache.org/newt/newtmgr/protocol"
  	"mynewt.apache.org/newt/newtmgr/transport"
 +
 +	"github.com/spf13/cobra"
  )
  
+ func statsListRunCmd(cmd *cobra.Command, args []string) {
+ 	cpm, err := config.NewConnProfileMgr()
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	profile, err := cpm.GetConnProfile(ConnProfileName)
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	conn, err := transport.NewConn(profile)
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	runner, err := protocol.NewCmdRunner(conn)
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	slr, err := protocol.NewStatsListReq()
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	nmr, err := slr.Encode()
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	if err := runner.WriteReq(nmr); err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	rsp, err := runner.ReadResp()
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	slrsp, err := protocol.DecodeStatsListResponse(rsp.Data)
+ 	if err != nil {
+ 		nmUsage(cmd, err)
+ 	}
+ 
+ 	fmt.Println(slrsp.List)
+ 	fmt.Printf("Return Code = %d\n", slrsp.ReturnCode)
+ }
+ 
  func statsRunCmd(cmd *cobra.Command, args []string) {
  	cpm, err := config.NewConnProfileMgr()
  	if err != nil {