From 8c7a142e07394f2be86392b44f9634ccdefff9a8 Mon Sep 17 00:00:00 2001 From: Bryan Kim Date: Mon, 18 Sep 2023 13:06:20 +1200 Subject: [PATCH] cli: Fix gateway antenna --- .../commands/applications_downlink.go | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/ttn-lw-cli/commands/applications_downlink.go b/cmd/ttn-lw-cli/commands/applications_downlink.go index 4a7e06df1c..e4b85990c2 100644 --- a/cmd/ttn-lw-cli/commands/applications_downlink.go +++ b/cmd/ttn-lw-cli/commands/applications_downlink.go @@ -37,7 +37,7 @@ var ( return err } var downlink ttnpb.ApplicationDownlink - paths, err := downlink.SetFromFlags(cmd.Flags(), "") + _, err = downlink.SetFromFlags(cmd.Flags(), "") if err != nil { return err } @@ -45,8 +45,12 @@ var ( if err != nil { return err } - if len(antennas) > 0 { - paths = append(paths, "class-b-c.gateways") + for i, antenna := range antennas { + gateway := ttnpb.ClassBCGatewayIdentifiers{ + GatewayIds: antenna.GatewayIds, + GroupIndex: uint32(i), + } + downlink.ClassBC.Gateways = append(downlink.ClassBC.Gateways, &gateway) } as, err := api.Dial(ctx, config.ApplicationServerGRPCAddress) if err != nil { @@ -73,7 +77,7 @@ var ( } var downlink ttnpb.ApplicationDownlink - paths, err := downlink.SetFromFlags(cmd.Flags(), "") + _, err = downlink.SetFromFlags(cmd.Flags(), "") if err != nil { return err } @@ -81,8 +85,12 @@ var ( if err != nil { return err } - if len(antennas) > 0 { - paths = append(paths, "class-b-c.gateways") + for i, antenna := range antennas { + gateway := ttnpb.ClassBCGatewayIdentifiers{ + GatewayIds: antenna.GatewayIds, + GroupIndex: uint32(i), + } + downlink.ClassBC.Gateways = append(downlink.ClassBC.Gateways, &gateway) } as, err := api.Dial(ctx, config.ApplicationServerGRPCAddress) if err != nil {