code: func SetDownlinkTXInfoDataRate(txInfo *gw.DownlinkTXInfo, dr int, b band.Band) error {
  	dataRate, err := b.GetDataRate(dr)
  	if err != nil {
  		return errors.Wrap(err, "get data-rate error")
  	}
  
  	switch dataRate.Modulation {
  	case band.LoRaModulation:
  		txInfo.Modulation = common.Modulation_LORA
  		txInfo.ModulationInfo = &gw.DownlinkTXInfo_LoraModulationInfo{
  			LoraModulationInfo: &gw.LoRaModulationInfo{
  				SpreadingFactor:       uint32(dataRate.SpreadFactor),
  				Bandwidth:             uint32(dataRate.Bandwidth),
  				CodeRate:              defaultCodeRate,
  				PolarizationInversion: true,
  			},
  		}
  	case band.FSKModulation:
  		txInfo.Modulation = common.Modulation_FSK
  		txInfo.ModulationInfo = &gw.DownlinkTXInfo_FskModulationInfo{
  			FskModulationInfo: &gw.FSKModulationInfo{
  				Bitrate:   uint32(dataRate.BitRate),
  				Bandwidth: uint32(dataRate.Bandwidth),
  			},
  		}
  	default:
  		return fmt.Errorf("unknown modulation: %s", dataRate.Modulation)
  	}
  
  	return nil
  }
docs: // SetDownlinkTXInfoDataRate sets the DownlinkTXInfo data-rate.