Used new SDK Management event.
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 23 Jan 2018 14:35:32 +0000 (15:35 +0100)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Tue, 23 Jan 2018 14:35:32 +0000 (15:35 +0100)
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
.vscode/settings.json
cmd-sdks.go

index ca53749..d78342b 100644 (file)
@@ -1,15 +1,11 @@
 // Place your settings in this file to overwrite default and user settings.
 {
-
     // The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
     "editor.tabSize": 4,
-
     // Insert spaces when pressing Tab. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
     "editor.insertSpaces": true,
-
     // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
     "editor.detectIndentation": false,
-
     // Configure glob patterns for excluding files and folders.
     "files.exclude": {
         "**/.tmp": true,
     },
     // Words to add to dictionary for a workspace.
     "cSpell.words": [
-        "apiv", "iosk", "zhouhui", "ldflags", "socketio", "xdsconfig", "sdkid",
-        "godotenv", "crosssdk", "prjs", "xaapiv", "urfave", "sebd", "golib",
-        "joho", "XDSAGENT", "reflectme", "franciscocpg", "gerrit"
+        "apiv",
+        "iosk",
+        "zhouhui",
+        "ldflags",
+        "socketio",
+        "xdsconfig",
+        "sdkid",
+        "godotenv",
+        "crosssdk",
+        "prjs",
+        "xaapiv",
+        "urfave",
+        "sebd",
+        "golib",
+        "joho",
+        "XDSAGENT",
+        "reflectme",
+        "franciscocpg",
+        "gerrit",
+        "EVTSDK"
     ]
 }
index 066e1dd..34f5409 100644 (file)
@@ -235,13 +235,18 @@ func sdksInstall(ctx *cli.Context) error {
                exitChan <- exitResult{errMsg, 2}
        })
 
-       IOsk.On(xaapiv1.EVTSDKInstall, func(ev xaapiv1.EventMsg) {
-               sdkEvt, _ := ev.DecodeSDKMsg()
+       IOsk.On(xaapiv1.EVTSDKManagement, func(ev xaapiv1.EventMsg) {
+               sdkEvt, _ := ev.DecodeSDKMgtMsg()
 
-               if sdkEvt.Stdout != "" {
+               if sdkEvt.Action != xaapiv1.SdkMgtActionInstall {
+                       Log.Debugf("EVTSDKManagement (action %s) IGNORED", sdkEvt.Action)
+                       return
+               }
+
+               if !shortOut && sdkEvt.Stdout != "" {
                        fmt.Printf("%s", sdkEvt.Stdout)
                }
-               if sdkEvt.Stderr != "" {
+               if !shortOut && sdkEvt.Stderr != "" {
                        fmt.Fprintf(os.Stderr, "%s", sdkEvt.Stderr)
                }
 
@@ -250,7 +255,12 @@ func sdksInstall(ctx *cli.Context) error {
                }
        })
 
-       evReg := xaapiv1.EventRegisterArgs{Name: xaapiv1.EVTSDKInstall}
+       IOsk.On(xaapiv1.EVTSDKStateChange, func(ev xaapiv1.EventMsg) {
+               sdk, _ := ev.DecodeSDKEvent()
+               Log.Debugf("EVTSDKStateChange: %v", sdk)
+       })
+
+       evReg := xaapiv1.EventRegisterArgs{Name: xaapiv1.EVTAll}
        if err := HTTPCli.Post("/events/register", &evReg, nil); err != nil {
                return cli.NewExitError(err, 1)
        }