// Bounce tells drone to start/stop performing the bouncing action
338277
func (d *Driver) Bounce() (err error) {
	buf, _ := d.createPacket(bounceCommand, 0x68, 1)
	d.seq++
	binary.Write(buf, binary.LittleEndian, d.seq)
	if d.bouncing {
		binary.Write(buf, binary.LittleEndian, byte(0x31))
	} else {
		binary.Write(buf, binary.LittleEndian, byte(0x30))
	}
	binary.Write(buf, binary.LittleEndian, CalculateCRC16(buf.Bytes()))
	_, err = d.cmdConn.Write(buf.Bytes())
	d.bouncing = !d.bouncing
	return
}
226004
func (dj *DefaultJitter) Jitter(d time.Duration) time.Duration {
	// this is only called by the core supervisor loop, so it is
	// single-thread safe.
	if dj.rand == nil {
		dj.rand = rand.New(rand.NewSource(time.Now().UnixNano()))
	}
	jitter := dj.rand.Float64() / 2
	return d + time.Duration(float64(d)*jitter)
}
511063
func (b *AccelerometerDriver) Start() (err error) {
	// subscribe to accelerometer notifications
	b.adaptor().Subscribe(accelerometerCharacteristic, func(data []byte, e error) {
		a := &RawAccelerometerData{X: 0, Y: 0, Z: 0}

		buf := bytes.NewBuffer(data)
		binary.Read(buf, binary.LittleEndian, &a.X)
		binary.Read(buf, binary.LittleEndian, &a.Y)
		binary.Read(buf, binary.LittleEndian, &a.Z)

		result := &AccelerometerData{
			X: float32(a.X) / 1000.0,
			Y: float32(a.Y) / 1000.0,
			Z: float32(a.Z) / 1000.0}

		b.Publish(b.Event(Accelerometer), result)
	})

	return
}
388366
func (a *Driver) Up(speed int) {
	a.adaptor().drone.Up(speed)
}
687624
func (c *Server) Stop() error {
	c.Lock()
	defer c.Unlock()
	if err := stop(); err != nil {
		glog.Errorf("err running stop %v", err)
		return err
	}
	c.cleanupBindMounts()
	return nil
}
797358
func (b *Driver) Stop() error {
	b.pcmdMutex.Lock()
	defer b.pcmdMutex.Unlock()

	b.Pcmd = Pcmd{
		Flag:  0,
		Roll:  0,
		Pitch: 0,
		Yaw:   0,
		Gaz:   0,
		Psi:   0,
	}

	return nil
}
791209
func (a *Driver) Outdoor(outdoor bool) error {
	return a.adaptor().drone.Outdoor(outdoor)
}
609177
func (s *Stream) Stop() error {
	s.l.Lock()
	switch s.state {
	case StateStopped, StateInitial:
		s.l.Unlock()
		return errors.New("gumbleffmpeg: stream is not playing nor paused")
	}
	s.cleanup()
	s.Wait()
	return nil
}
916721
func (d *Driver) Halt() (err error) {
	// send a landing command when we disconnect, and give it 500ms to be received before we shutdown
	d.Land()
	time.Sleep(500 * time.Millisecond)

	// TODO: cleanly shutdown the goroutines that are handling the UDP connections before closing
	d.cmdConn.Close()
	d.videoConn.Close()
	return
}
1164096
func (a *Driver) VideoEnable(enable bool) error {
	return a.adaptor().drone.VideoEnable(enable)
}
595120
func (spin *Spinner) Yield() {
	if spin.count >= 100 {
		spin.count = 0
		// Always call Gosched if suspending is disabled to prevent stuck go
		// routines with GOMAXPROCS=1 and to be nice to the scheduler
		if spin.suspendFor == 0 {
			runtime.Gosched()
		} else {
			time.Sleep(spin.suspendFor)
		}
		return // ### return, suspended ###
	}

	spin.count++

}
801643
func (s *SendBounceInput) SetBounceSenderArn(v string) *SendBounceInput {
	s.BounceSenderArn = &v
	return s
}
393896
func (rl *MemoryReplayLog) Stop() error {
	if rl.entries == nil || rl.batches == nil {
		return errReplayLogNotStarted
	}

	rl.batches = nil
	rl.entries = nil
	return nil
}
376275
func (b *Driver) Halt() (err error) {
	b.Land()

	time.Sleep(500 * time.Millisecond)
	return
}
130765
func (p *Provider) Stop() error {
	p.stopOnce.Do(p.stopInit)

	p.stopMu.Lock()
	defer p.stopMu.Unlock()

	p.stopCtxCancel()
	return nil
}
1364241
func (ci *BouncesIterator) Next(ctx context.Context, items *[]Bounce) bool {
	if ci.err != nil {
		return false
	}
	ci.err = ci.fetch(ctx, ci.Paging.Next)
	if ci.err != nil {
		return false
	}
	cpy := make([]Bounce, len(ci.Items))
	copy(cpy, ci.Items)
	*items = cpy
	if len(ci.Items) == 0 {
		return false
	}
	return true
}
34088
func (task *UDPListenerTask) StopFunc(perform func()) {
	task.LoopTask.StopFunc(func() {
		task.stop()
		perform()
	})
}