Converts a v3 output to a v4 controller state
327821
def convert_output_to_v4(self, controller_input):
        """"""
        player_input = SimpleControllerState()
        player_input.throttle = controller_input[0]
        player_input.steer = controller_input[1]
        player_input.pitch = controller_input[2]
        player_input.yaw = controller_input[3]
        player_input.roll = controller_input[4]
        player_input.jump = controller_input[5]
        player_input.boost = controller_input[6]
        player_input.handbrake = controller_input[7]

        return player_input
244397
private GVRCursorController getUniqueControllerId(int deviceId) {
        GVRCursorController controller = controllerIds.get(deviceId);
        if (controller != null) {
            return controller;
        }
        return null;
    }
995545
def drawControllers(self):
        ""
        # don't draw controllers if somebody else has input focus
        if self.m_pHMD.isInputFocusCapturedByAnotherProcess():
            return
        vertdataarray = list()
        self.m_uiControllerVertcount = 0
        self.m_iTrackedControllerCount = 0
    
        for unTrackedDevice in range(openvr.k_unTrackedDeviceIndex_Hmd + 1, openvr.k_unMaxTrackedDeviceCount):
            if not self.m_pHMD.isTrackedDeviceConnected( unTrackedDevice ):
                continue
            if self.m_pHMD.getTrackedDeviceClass( unTrackedDevice ) != openvr.TrackedDeviceClass_Controller:
                continue
            self.m_iTrackedControllerCount += 1
            if not self.m_rTrackedDevicePose[ unTrackedDevice ].bPoseIsValid:
                continue
            mat = self.m_rmat4DevicePose[unTrackedDevice]
            center = mat * Vector4( 0, 0, 0, 1 )
            for i in range(3):
                color = Vector4( 0, 0, 0 )
                point = Vector4( 0, 0, 0, 1 )
                point[i] += 0.05  # offset in X, Y, Z
                color[i] = 1.0  # R, G, B
                point = mat * point
                vertdataarray.append( center.x )
                vertdataarray.append( center.y )
                vertdataarray.append( center.z )
                vertdataarray.append( color.x )
                vertdataarray.append( color.y )
                vertdataarray.append( color.z )
                vertdataarray.append( point.x )
                vertdataarray.append( point.y )
                vertdataarray.append( point.z )
                vertdataarray.append( color.x )
                vertdataarray.append( color.y )
                vertdataarray.append( color.z )
                self.m_uiControllerVertcount += 2
            start = mat * Vector4( 0, 0, -0.02, 1 )
            end = mat * Vector4( 0, 0, -39., 1 )
            color = Vector3( .92, .92, .71 )
            vertdataarray.append( start.x )
            vertdataarray.append( start.y )
            vertdataarray.append( start.z )
            vertdataarray.append( color.x )
            vertdataarray.append( color.y )
            vertdataarray.append( color.z )
            vertdataarray.append( end.x )
            vertdataarray.append( end.y )
            vertdataarray.append( end.z )
            vertdataarray.append( color.x )
            vertdataarray.append( color.y )
            vertdataarray.append( color.z )
            self.m_uiControllerVertcount += 2
        # Setup the VAO the first time through.
        if self.m_unControllerVAO == 0:        
            self.m_unControllerVAO = glGenVertexArrays(1)
            glBindVertexArray( self.m_unControllerVAO )
            self.m_glControllerVertBuffer = glGenBuffers(1)
            glBindBuffer( GL_ARRAY_BUFFER, self.m_glControllerVertBuffer )
            stride = 2 * 3 * sizeof( ctypes.c_float )
            offset = 0
            glEnableVertexAttribArray( 0 )
            glVertexAttribPointer( 0, 3, GL_FLOAT, False, stride, offset)
            offset += sizeof( Vector3 )
            glEnableVertexAttribArray( 1 )
            glVertexAttribPointer( 1, 3, GL_FLOAT, False, stride, offset)
            glBindVertexArray( 0 )
        glBindBuffer( GL_ARRAY_BUFFER, self.m_glControllerVertBuffer )
        # set vertex data if we have some
        if len(vertdataarray) > 0:
            #$ TODO: Use glBufferSubData for this...
            glBufferData( GL_ARRAY_BUFFER, sizeof(float) * vertdataarray.size(), vertdataarray[0], GL_STREAM_DRAW )
1115262
function(callback) {
    // Activate current
    var current = $state.current();

    if(current) {

      // Reset
      _resetActive().then(function() {

        // Render
        var viewsPromised = {};
        var templates = current.templates || {};
        var controllers = current.controllers || {};
        angular.forEach(templates, function(template, id) {
          if(_viewHash[id]) {
            var view = _viewHash[id];
            var controller = controllers[id];
            viewsPromised[id] = _renderView(id, view, template, controller);
            _activeSet[id] = view;
          }
        });

        $q.all(viewsPromised).then(function() {
          callback();
        }, callback);

      }, callback);

    // None
    } else {
      callback();
    }
  }
769453
def current_state_by_controller(*given_controller_names, actions: [])
      if given_controller_names.any? { |name| name == controller_name.to_sym }
        if actions.present?
          Array(actions).include?(action_name.to_sym)
        else
          true
        end
      end
    end
117915
function __bindController (newController, sessionExpiration) {
    if (controller && typeof(controller.shutdown) === 'function') {
        controller.shutdown();
    }
    controller = newController;
    if (typeof(controller.clientInit) === 'function') {
        controller.clientInit(sessionExpiration);
    }
}
322060
function controllerWrap(ctx, ctrl, hooks, next) {
  let result
  const preHooks = []
  hooks.pre.map(pre => {
    preHooks.push(() => pre(ctx))
  })

  return sequenceAndReturnOne(preHooks)
    .then(() => {
      return ctrl(ctx)
    })
    .then(data => {
      if (!data && ctx.body && ctx.body.data) {
        data = ctx.body.data
      }
      result = data
      const postHooks = []
      hooks.post.map(post => {
        // Use pre action's result for next action's data
        postHooks.push(preResult => post(ctx, preResult || result))
      })
      return sequenceAndReturnOne(postHooks)
    })
    .then(ret => {
      if (!ctx.body) {
        ctx.body = {
          code: 0,
          data: ret || result
        }
      }
      next && next()
    })
    .catch(err => {
      // throw errors to app error handler
      throw err
    })
}
200908
def update_controller_info(self):
        

        # Read the controller information.
        self.controller_info = customer_details(self._user_token)
        self.controller_status = status_schedule(self._user_token)

        if self.controller_info is None or self.controller_status is None:
            return False

        # Only supports one controller right now.
        # Use the first one from the array.
        self.current_controller = self.controller_info['controllers'][0]
        self.status = self.current_controller['status']
        self.controller_id = self.current_controller['controller_id']
        self.customer_id = self.controller_info['customer_id']
        self.user_id = self.controller_status['user_id']
        self.num_relays = len(self.controller_status['relays'])
        self.relays = self.controller_status['relays']
        self.name = self.controller_status['name']
        self.watering_time = self.controller_status['watering_time']
        self.sensors = self.controller_status['sensors']
        try:
            self.running = self.controller_status['running']
        except KeyError:
            self.running = None

        return True
1360249
def controller_callback(which, type, axis, value, button)
      # All controller events
      @events[:controller].each do |id, e|
        e.call(ControllerEvent.new(which, type, axis, value, button))
      end

      case type
      # When controller axis motion, like analog sticks
      when :axis
        @events[:controller_axis].each do |id, e|
          e.call(ControllerAxisEvent.new(which, axis, value))
        end
      # When controller button is pressed
      when :button_down
        @events[:controller_button_down].each do |id, e|
          e.call(ControllerButtonEvent.new(which, button))
        end
      # When controller button is released
      when :button_up
        @events[:controller_button_up].each do |id, e|
          e.call(ControllerButtonEvent.new(which, button))
        end
      end
    end
1152297
@Override
    public synchronized Renderable<?> render(Controller controller, Map<String, Object> variables) {
        HashMap<String, Object> map = new HashMap<>(variables);
        if (!map.containsKey(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY)) {
            map.put(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY, bundle);
        }
        return templateEngine.process(this, controller, router, assets, map);
    }
344309
def run(self):
        
        while True:
            data, sender = self.sock.recvfrom(1024)
            addr = sender[0]
            msg = data.decode('utf-8')
            if msg.startswith('/controller/'):
                try:
                    uid = msg.split('/')[2]
                    if uid == 'new':
                        port = int(msg.split('/')[3])
                        self._new_controller(addr, port)
                    else:
                        cmd = msg.split('/')[3]
                        if cmd == 'ping':
                            port = msg.split('/')[3]
                            self._ping(uid, addr, port)
                        elif cmd == 'kthxbye':
                            self._del_controller(uid)
                        elif cmd == 'states':
                            states = msg.split('/')[4]
                            self._update_states(uid, states)
                        elif cmd == 'text':
                            # /controller/<uid>/text/<text>
                            text = msg[12 + len(uid) + 6:]
                            self._got_message(uid, text)
                except IndexError or KeyError:
                    pass
            else:
                pass

            # find unused controllers and delete them
            ctlrs = self.controllers.items()
            for uid, state in ctlrs:
                if state[3] < time.time() - 60:
                    self.controllers.pop(uid)
931377
def dump_state(self):
        

        superstate = super(ReferenceController, self).dump_state()

        superstate.update({
            'state_name': self.STATE_NAME,
            'state_version': self.STATE_VERSION,
            'app_info': self.app_info,
            'os_info': self.os_info,

            # Dump all of the subsystems
            'remote_bridge': self.remote_bridge.dump(),
            'tile_manager': self.tile_manager.dump(),
            'config_database': self.config_database.dump(),
            'sensor_log': self.sensor_log.dump()
        })

        return superstate
1346842
function () {
    var controllers = this.controllers;
    var gamepad;
    var gamepads;
    var i;
    var prevCount;

    gamepads = navigator.getGamepads && navigator.getGamepads();
    if (!gamepads) { return; }

    prevCount = controllers.length;
    controllers.length = 0;
    for (i = 0; i < gamepads.length; ++i) {
      gamepad = gamepads[i];
      if (gamepad && gamepad.pose) {
        controllers.push(gamepad);
      }
    }

    if (controllers.length !== prevCount) {
      this.el.emit('controllersupdated', undefined, false);
    }
  }
1002103
function queryParamsState(queryParamsArray, controller) {
  return queryParamsArray.reduce(
    (state, qp) => {
      let value = qp.value(controller);

      state[qp.key] = {
        value,
        serializedValue: qp.serializedValue(controller),
        as: qp.as,
        defaultValue: qp.defaultValue,
        changed: JSON.stringify(value) !== JSON.stringify(qp.defaultValue)
      };
      return state;
    },
    {},
    undefined
  );
}
1252069
function ClientModelDocDetailController($state, clientModelDoc) {
    var vm = this;

    // the current clientModelDoc to display
    vm.clientModelDoc = clientModelDoc;
    // switch to the edit state
    vm.edit = edit;
    // switch to the parent state
    vm.goBack = goBack

    /**
     * Open the edit state with the current clientModelDoc
     *
     */
    function edit() {
      $state.go('^.edit', {'id': vm.clientModelDoc._id});
    }

    /**
     * Return to the parent state
     *
     */
    function goBack() {
      $state.go('^');
    }
  }
823332
function shimController(data, transation, spans, proxy) {
        var tview = data.template.cloneNode(true)
        var id = proxy.$id
        var span = tview.firstChild
        if (!data.fastRepeat) {
            span = DOC.createElement("msloop")
            span.style.display = "none"
            span.appendChild(tview)
        }
        span.setAttribute("ms-controller", id)
        spans.push(span)
        transation.appendChild(span)
        VMODELS[id] = proxy
        function fn() {
            delete VMODELS[id]
            data.group = 1
            if (!data.fastRepeat) {
                data.group = span.childNodes.length
                span.parentNode.removeChild(span)
                while (span.firstChild) {
                    transation.appendChild(span.firstChild)
                }
                if (fn.node !== void 0) {
                    fn.parent.insertBefore(transation, fn.node)
                }
            }
        }
        return span.patchRepeat = fn
    }
136299
def build
      controller_name = @klass.name.gsub(/Controller$/, '').underscore
      Rails.application.routes.routes.each_with_object({}) do |route, comments|
        if route.defaults[:controller] == controller_name
          verb_match = route.verb.to_s.match(/\^(.*)\$/)
          verbs = verb_match.nil? ? '*' : verb_match[1]
          (comments[route.defaults[:action]] ||= []) << "#{verbs} #{route.ast}"
        end
      end
    end