Turn on the alsa_sink sink.

        This is done automatically when the sink is instantiated, so you'll
        only need to call this method if you ever call :meth:`off` and want to
        turn the sink back on.
199268
def on(self):
        
        assert spotifyconnect._session_instance.player.num_listeners(
            spotifyconnect.PlayerEvent.MUSIC_DELIVERY) == 0
        spotifyconnect._session_instance.player.on(
            spotifyconnect.PlayerEvent.MUSIC_DELIVERY, self._on_music_delivery)
186645
public void run() {
//    todo    if (logger.isDebugEnabled()) {
//            logger.debug("start running PooledDataSourceCleaner");
//        }

        state = STATE_CLEANER.RUNNING;
        while (state != STATE_CLEANER.SHUTDOWN) {
            try {
                Thread.sleep(interval * 1000);
            } catch (InterruptedException e) {
//              todo  if (logger.isDebugEnabled()) {
//                    logger.debug("Get interrupted, shutdown the PooledDataSourceCleaner");
//                }
                break;//get out if anyone interrupt
            }
            this.manager.cleanDataSources();

            //if no pool at all, going to stop itself
            if (this.manager.getDbmsPoolSize() == 0) {
//             todo   if (logger.isDebugEnabled()) {
//                    logger.debug("Empty pools, shutdown the PooledDataSourceCleaner");
//                }
                state = STATE_CLEANER.SHUTDOWN;//stop spinning
                break; //get out
            }
        }
    }
895637
@Override
  public void toSink(Sink<R> sink) {
    checkNotNull(sink, "sink cannot be null");

    SinkStreamlet<R> sinkStreamlet = new SinkStreamlet<>(this, sink);
    addChild(sinkStreamlet);
  }
1243049
def manage_pump(self, operation):
        
        if operation == "on":
            self.controls["pump"] = "on"
        elif operation == "off":
            self.controls["pump"] = "off"

        return True
737530
public void activated(Pipe pipe)
    {
        //  Move the pipe from passive to eligible state.
        Collections.swap(pipes, pipes.indexOf(pipe), eligible);
        eligible++;

        //  If there's no message being sent at the moment, move it to
        //  the active state.
        if (!more) {
            Collections.swap(pipes, eligible - 1, active);
            active++;
        }
    }
1180217
def stop(self):
        
        should_sleep = self._is_running
        super(Sensor, self).stop()
        if should_sleep:
            # Make sure everything has enough time to exit
            time.sleep(max(self._select_timeout, self._retransmit_timeout) + 1)
        if self._listen_socket is not None:
            self._shutdown_listen_socket()
240672
async def turn_off(self):
        """"""
        _LOGGER.debug("turn_off while %s", self._state)
        if self._state in [State.PLAYING_LIVE_TV, State.PLAYING_RECORDED_TV,
                          State.PLAYING_TIMESHIFT_TV, State.UNKNOWN]:
            await self.send_cmd('Power')
            self._state = State.OFF
        return self._state
160296
def do_server(self, arg):
        
        if arg['on']:
            self.server_on()
        elif arg['off']:
            self.server_off()
        elif arg['restart']:
            self.server_restart()
        elif arg['log']:
            self.server_log()
        else:
            self.help_server()
371193
public void onStateChange() {
        switch (dataChannel.state()) {
            case CONNECTING:
                break;

            case OPEN: {
                    if (null != callReference) {
                        RespokeCall call = callReference.get();
                        if (null != call) {
                            call.directConnectionDidOpen(this);
                        }
                    }

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    public void run() {
                        if (null != listenerReference) {
                            Listener listener = listenerReference.get();
                            if (null != listener) {
                                listener.onOpen(RespokeDirectConnection.this);
                            }
                        }
                    }
                });
                }
                break;

            case CLOSING:
                break;

            case CLOSED: {
                    if (null != callReference) {
                        RespokeCall call = callReference.get();
                        if (null != call) {
                            call.directConnectionDidClose(this);
                        }
                    }

                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        public void run() {
                            if (null != listenerReference) {
                                Listener listener = listenerReference.get();
                                if (null != listener) {
                                    listener.onClose(RespokeDirectConnection.this);
                                }
                            }
                        }
                    });
                }
                break;
        }
    }
909008
def turn_off(self) -> "Signal":
        
        if _logger is not None:
            self._log(INFO, "turn-off")
        self._is_on = False
        return self
904230
public void setAutoResetToZero(final boolean AUTO_RESET_TO_ZERO) {
        model.setAutoResetToZero(AUTO_RESET_TO_ZERO);

        if (model.isAutoResetToZero()) {
            setThresholdVisible(false);
            setLedVisible(false);
        }
    }
1263386
public function onHandshake()
    {
        if (!isset($this->route)) {
            return;
        }
        $this->route->onWakeup();
        try {
            $this->route->onHandshake();
        } catch (\Exception $e) {
            Daemon::uncaughtExceptionHandler($e);
        }
        $this->route->onSleep();
    }
555481
def turn_on(host, did, token=None):
    """"""
    urllib3.disable_warnings()
    if token:
        scheme = "https"
    if not token:
        scheme = "http"
        token = "1234567890"
    url = (
            scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>1</value></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if response.status_code == '200':
        return True
    else:
        return False
447333
def start(self):
        
        #  demonize
        if self.run_as_daemon:
            if not self.demonize():
                self.delete_pid()
                sys.exit(0)
        # recreate the DB connection
        if connection.connection is not None:
            connection.connection.close()
            connection.connection = None
        master_process = BackgroundProcess.objects.filter(parent_process__isnull=True,
                                                          label=self.label,
                                                          enabled=True).first()
        self.pid = getpid()
        if not master_process:
            self.delete_pid(force_del=True)
            logger.debug('no such process in BackgroundProcesses\n')
            sys.exit(0)

        self.process_id = master_process.pk
        master_process.pid = self.pid
        master_process.last_update = now()
        master_process.running_since = now()
        master_process.done = False
        master_process.failed = False
        master_process.message = 'init master process'
        master_process.save()
        BackgroundProcess.objects.filter(parent_process__pk=self.process_id, done=False).update(message='stopped')
        for parent_process in BackgroundProcess.objects.filter(parent_process__pk=self.process_id, done=False):
            for process in BackgroundProcess.objects.filter(parent_process__pk=parent_process.pk, done=False):
                try:
                    kill(process.pid, 0)
                except OSError as e:
                    if e.errno == errno.ESRCH:
                        process.delete()
                        continue
                logger.debug('process %d is alive' % process.pk)
                process.stop()

            # clean up
            BackgroundProcess.objects.filter(parent_process__pk=parent_process.pk, done=False).delete()

        # register signals
        [signal.signal(s, self.signal) for s in self.SIGNALS]
        #signal.signal(signal.SIGCHLD, self.handle_chld)
        # start the main loop
        self.run()
        self.delete_pid()
        sys.exit(0)
1108621
public function reset()
  {
    $this->turnOff();
    $this->counter            = null;
    $this->startedAt          = null;
    $this->expiresAt          = null;
    $this->name               = $this->origStatus['name'];
    $this->metric             = $this->origStatus['metric'];
    $this->globalThreshold    = $this->origStatus['globalThreshold'];
    $this->componentThreshold = $this->origStatus['componentThreshold'];
    $this->metricFactor       = $this->origStatus['metricFactor'];
    $this->components         = $this->origStatus['components'];
  }
402310
@Override
  public void onActive()
  {
    _isReplay = false;
    
    if (_isActive) {
      return;
    }
    _isActive = true;
    
    _serviceSelf = ServiceRef.current();
    
    if (_journalDelay > 0) {
      Services manager = _serviceSelf.services();
      
      _timerService = manager.service("timer:").as(Timers.class);
      Consumer<Cancel> startSave = h->startSave();
      
      _startSaveRef = (Consumer<Cancel>) _serviceSelf.pin(startSave).as(Consumer.class);
    }
    
    super.onActive();
    
    startSave();
  }
696785
public void store(DataSink sink) {
        try {
            localControlChannel.resetReplyCount();
            TransferContext context= createTransferContext();

            if (session.serverMode == Session.SERVER_PASSIVE) {
                runTask(createPassiveConnectTask(sink, context));
            } else {
                runTask(createActiveConnectTask(sink, context));
            }
        } catch (Exception e) {
            exceptionToControlChannel(e, "ocurred during store()");
        }
    }