appEUI, err := types.ParseAppEUI(in) if err != nil { ctx.Fatalf("Invalid AppEUI: %s", err) } dev.GetLorawanDevice().AppEui = &appEUI } if in, err := cmd.Flags().GetString("dev-eui"); err == nil && in != "" { ctx.Warn("Manually changing the DevEUI of a device might break routing for this device") if override, _ := cmd.Flags().GetBool("override"); !override { ctx.Warnf("Use the --override flag if you're really sure you want to do this") os.Exit(0) } devEUI, err := types.ParseDevEUI(in) if err != nil { ctx.Fatalf("Invalid DevEUI: %s", err) } dev.GetLorawanDevice().DevEui = &devEUI } if in, err := cmd.Flags().GetString("dev-addr"); err == nil && in != "" { ctx.Warn("Manually changing the DevAddr of a device might break routing for this device") if override, _ := cmd.Flags().GetBool("override"); !override { ctx.Warnf("Use the --override flag if you're really sure you want to do this") os.Exit(0) } devAddr, err := types.ParseDevAddr(in)
Hidden: true, Use: "join [AppEUI] [DevEUI] [AppKey] [DevNonce]", Short: "Simulate an join message to the network", Long: `ttnctl join simulates an join message to the network`, Run: func(cmd *cobra.Command, args []string) { if len(args) != 4 { cmd.UsageFunc()(cmd) return } appEUI, err := types.ParseAppEUI(args[0]) if err != nil { ctx.WithError(err).Fatal("Could not parse AppEUI") } devEUI, err := types.ParseDevEUI(args[1]) if err != nil { ctx.WithError(err).Fatal("Could not parse DevEUI") } appKey, err := types.ParseAppKey(args[2]) if err != nil { ctx.WithError(err).Fatal("Could not parse AppKey") } devNonceSlice, err := types.ParseHEX(args[3], 2) if err != nil { ctx.WithError(err).Fatal("Could not parse DevNonce") } devNonce := [2]byte{devNonceSlice[0], devNonceSlice[1]}