code: func appendMetaDataToUplinkHistory(ctx *dataContext) error {
  	var maxSNR float64
  	for i, rxInfo := range ctx.RXPacket.RXInfoSet {
  		// as the default value is 0 and the LoRaSNR can be negative, we always
  		// set it when i == 0 (the first item from the slice)
  		if i == 0 || rxInfo.LoraSnr > maxSNR {
  			maxSNR = rxInfo.LoraSnr
  		}
  	}
  
  	ctx.DeviceSession.AppendUplinkHistory(storage.UplinkHistory{
  		FCnt:         ctx.MACPayload.FHDR.FCnt,
  		GatewayCount: len(ctx.RXPacket.RXInfoSet),
  		MaxSNR:       maxSNR,
  		TXPowerIndex: ctx.DeviceSession.TXPowerIndex,
  	})
  
  	return nil
  }
docs: // appendMetaDataToUplinkHistory appends uplink related meta-data to the
  // uplink history in the device-session.
  // As this also stores the TXPower, this function must be called after
  // processing the mac-commands (we might have asked the device to change
  // its TXPower and if one of the mac-commands contains a LinkADRReq ACK
  // this will update the TXPowerIndex on the device-session).