code: func ScheduleDeviceQueueToPingSlotsForDevEUI(db sqlx.Ext, dp storage.DeviceProfile, ds storage.DeviceSession) error {
  	queueItems, err := storage.GetDeviceQueueItemsForDevEUI(db, ds.DevEUI)
  	if err != nil {
  		return errors.Wrap(err, "get device-queue items error")
  	}
  
  	scheduleAfterGPSEpochTS := gps.Time(time.Now().Add(scheduleMargin)).TimeSinceGPSEpoch()
  
  	for _, qi := range queueItems {
  		if qi.IsPending {
  			continue
  		}
  
  		gpsEpochTS, err := GetNextPingSlotAfter(scheduleAfterGPSEpochTS, ds.DevAddr, ds.PingSlotNb)
  		if err != nil {
  			return errors.Wrap(err, "get next ping-slot after error")
  		}
  
  		timeoutTime := time.Time(gps.NewFromTimeSinceGPSEpoch(gpsEpochTS)).Add(time.Second * time.Duration(dp.ClassBTimeout))
  		qi.EmitAtTimeSinceGPSEpoch = &gpsEpochTS
  		qi.TimeoutAfter = &timeoutTime
  
  		if err := storage.UpdateDeviceQueueItem(db, &qi); err != nil {
  			return errors.Wrap(err, "update device-queue item error")
  		}
  
  		scheduleAfterGPSEpochTS = gpsEpochTS
  	}
  
  	log.WithFields(log.Fields{
  		"dev_eui": ds.DevEUI,
  		"count":   len(queueItems),
  	}).Info("device-queue items scheduled to ping-slots")
  
  	return nil
  }
docs: // ScheduleDeviceQueueToPingSlotsForDevEUI schedules the device-queue for the given
  // DevEUI to Class-B ping slots.