When the drone stops, update the result for monitoring software
16634
function onChildRestart (monitor, data) {
      haibu.emit(['drone', 'stop'], 'info', {
        process: result.data,
        pkg: result.pkg
      });
      
      haibu.emit(['drone', 'start'], 'info', {
        process: data,
        pkg: result.pkg
      });
    }
903782
def on_finished(self):
        """"""
        self.controller.is_running = False

        error = self.controller.current_error
        if error is not None:
            self.info(self.tr("Stopped due to error(s), see Terminal."))
        else:
            self.info(self.tr("Finished successfully!"))
529461
def _tracker(self, _observer_, _self_, *args, **kwds):
        
        self.track_object(_self_,
                          name=_observer_.name,
                          resolution_level=_observer_.detail,
                          keep=_observer_.keep,
                          trace=_observer_.trace)
        _observer_.init(_self_, *args, **kwds)
339000
def finish(self):
        ''

        self.finished = True
        self.update(self.maxval)
        self.fd.write('\n')
        if self.signal_set:
            signal.signal(signal.SIGWINCH, signal.SIG_DFL)
378411
def update(self, config, force_cache=False, **kwargs):
        """"""
        # force = kwargs.pop('force', False)
        self.name = config['name']
        self.camera_id = str(config['id'])
        self.network_id = str(config['network_id'])
        self.serial = config['serial']
        self.motion_enabled = config['enabled']
        self.battery_voltage = config['battery_voltage']
        self.battery_state = config['battery_state']
        self.temperature = config['temperature']
        self.wifi_strength = config['wifi_strength']

        # Retrieve calibrated temperature from special endpoint
        resp = api.request_camera_sensors(self.sync.blink,
                                          self.network_id,
                                          self.camera_id)
        try:
            self.temperature_calibrated = resp['temp']
        except KeyError:
            self.temperature_calibrated = self.temperature
            _LOGGER.warning("Could not retrieve calibrated temperature.")

        # Check if thumbnail exists in config, if not try to
        # get it from the homescreen info in teh sync module
        # otherwise set it to None and log an error
        new_thumbnail = None
        if config['thumbnail']:
            thumb_addr = config['thumbnail']
        else:
            thumb_addr = self.get_thumb_from_homescreen()

        if thumb_addr is not None:
            new_thumbnail = "{}{}.jpg".format(self.sync.urls.base_url,
                                              thumb_addr)

        try:
            self.motion_detected = self.sync.motion[self.name]
        except KeyError:
            self.motion_detected = False

        clip_addr = None
        if self.name in self.sync.last_record:
            clip_addr = self.sync.last_record[self.name]['clip']
            self.last_record = self.sync.last_record[self.name]['time']
            self.clip = "{}{}".format(self.sync.urls.base_url,
                                      clip_addr)

        # If the thumbnail or clip have changed, update the cache
        update_cached_image = False
        if new_thumbnail != self.thumbnail or self._cached_image is None:
            update_cached_image = True
        self.thumbnail = new_thumbnail

        update_cached_video = False
        if self._cached_video is None or self.motion_detected:
            update_cached_video = True

        if new_thumbnail is not None and (update_cached_image or force_cache):
            self._cached_image = api.http_get(self.sync.blink,
                                              url=self.thumbnail,
                                              stream=True,
                                              json=False)
        if clip_addr is not None and (update_cached_video or force_cache):
            self._cached_video = api.http_get(self.sync.blink,
                                              url=self.clip,
                                              stream=True,
                                              json=False)
505197
def set_trace(self, frame=None):
        """"""
        self.reset()

        if frame is None:
            frame = sys._getframe().f_back

        while frame:
            frame.f_trace = self.trace_dispatch
            self.botframe = frame
            frame = frame.f_back

        # Automatically proceed to next break point
        self.set_continue()

        sys.settrace(self.trace_dispatch)
758858
def on_idle(self, event):
        ''''''
        # Check for resize
        self.checkReszie()
        
        if self.resized:
            # Fix Window Scales 
            self.rescaleX()
            self.calcFontScaling()
            
            # Recalculate Horizon Polygons
            self.calcHorizonPoints()
            
            # Update Roll, Pitch, Yaw Text Locations
            self.updateRPYLocations()
            
            # Update Airpseed, Altitude, Climb Rate Locations
            self.updateAARLocations()
            
            # Update Pitch Markers
            self.adjustPitchmarkers()
            
            # Update Heading and North Pointer
            self.adjustHeadingPointer()
            self.adjustNorthPointer()
            
            # Update Battery Bar
            self.updateBatteryBar()
            
            # Update Mode and State
            self.updateStateText()
            
            # Update Waypoint Text
            self.updateWPText()
            
            # Adjust Waypoint Pointer
            self.adjustWPPointer()
            
            # Update History Plot
            self.updateAltHistory()
            
            # Update Matplotlib Plot
            self.canvas.draw()
            self.canvas.Refresh()
            
            self.resized = False
        
        time.sleep(0.05)
748911
def add(self, cmd):
        '''
        
        '''
        self.wait_ready()
        self._vehicle._handler.fix_targets(cmd)
        self._vehicle._wploader.add(cmd, comment='Added by DroneKit')
        self._vehicle._wpts_dirty = True
1007004
def update_status(self, reset=False):
        """"""
        if self.healthy_update_timer and not reset:
            return

        # get device features only once
        if not self.device_features:
            self.handle_features(self.get_features())

        # Get status from device to register/keep alive UDP
        self.handle_status()

        # Schedule next execution
        self.setup_update_timer()
406260
private void stopRoundTripMeasurement() {
        if (keepAliveTask != null) {
            boolean cancelled = keepAliveTask.cancel(true);
            keepAliveTask = null;
            if (cancelled && log.isDebugEnabled()) {
                log.debug("Keep alive was cancelled for {}", sessionId);
            }
        }
    }
389833
def ensure_stop
      applog(self, :warn, "#{self.name} ensuring stop...")

      unless self.pid
        applog(self, :warn, "#{self.name} stop called but pid is uknown")
        return
      end

      # Poll to see if it's dead
      @stop_timeout.times do
        begin
          ::Process.kill(0, self.pid)
        rescue Errno::ESRCH
          # It died. Good.
          return
        end

        sleep 1
      end

      # last resort
      ::Process.kill('KILL', self.pid) rescue nil
      applog(self, :warn, "#{self.name} still alive after #{@stop_timeout}s; sent SIGKILL")
    end
323409
def finish(self, message_id):
        """"""
        self.send(nsq.finish(message_id))
        self.finish_inflight()
        self.on_finish.send(self, message_id=message_id)
73419
def update(self):
        """"""
        current_time = int(time.time())
        last_refresh = 0 if self._last_refresh is None else self._last_refresh

        if current_time >= (last_refresh + self._refresh_rate):
            self.get_cameras_properties()
            self.get_ambient_sensor_data()
            self.get_camera_extended_properties()
            self._attrs = self._session.refresh_attributes(self.name)
            self._attrs = assert_is_dict(self._attrs)
            _LOGGER.debug("Called base station update of camera properties: "
                          "Scan Interval: %s, New Properties: %s",
                          self._refresh_rate, self.camera_properties)
337718
def update_status(self, progress):
        

        # interval at which the gui will be updated, if requests come in faster than they will be ignored
        update_interval = 0.2

        now = datetime.datetime.now()

        if not self._last_progress_update is None and now-self._last_progress_update < datetime.timedelta(seconds=update_interval):
            return

        self._last_progress_update = now

        self.progressBar.setValue(progress)

        script = self.current_script

        # Estimate remaining time if progress has been made
        if progress:
            remaining_time = str(datetime.timedelta(seconds=script.remaining_time.seconds))
            self.lbl_time_estimate.setText('time remaining: {:s}'.format(remaining_time))
        if script is not str(self.tabWidget.tabText(self.tabWidget.currentIndex())).lower() in ['scripts', 'instruments']:
            self.plot_script(script)
89304
function startDrone(pkg, userid, appid, callback) {
    var drone_port = getPort();

    if (drone_port) {
      pkg.env = pkg.env || {};
      pkg.env['PORT'] = drone_port;

      //ensure package user and name match internally
      pkg.user = userid;
      pkg.name = appid;

      drone.start(pkg, function(err, result) {
        if (err)
          callback(err);

        pkg.host = result.host;
        pkg.port = result.port;
        pkg.uid = result.uid;

        //async update package in db
        droneModel.createOrUpdate(pkg, function(){});

        //load proxy routes
        proxy.load(app.config.get('public-port'), pkg);

        callback(null, {drone: result});
      });
    }else{
      callback({message: 'No more ports available'});
    }
  }
1049882
private void updateLastForce()
    {
        if (Double.compare(fhLast, fhDest) != 0)
        {
            fhLast = fhDest;
            arrivedH = false;
        }
        if (Double.compare(fvLast, fvDest) != 0)
        {
            fvLast = fvDest;
            arrivedV = false;
        }
    }
1083822
function(finishedCallback){
      self.getUARTProtocolVersion(function(data,error){
        self.deviceData.uartProtocolVersion = data;
        finishedCallback(error);
      });
    }