Get the controller state
551432
def get_user_log(self, language='da'):
        """"""
        payload = """<getUserLog1 xmlns="utcs" />
                     <getUserLog2 xmlns="utcs">0</getUserLog2>
                     <getUserLog3 xmlns="utcs">{language}</getUserLog3>
                     """.format(language=language)
        xdoc = self.connection.soap_action('/ws/ConfigurationService',
                                           'getUserLog', payload)
        if xdoc:
            base64data = xdoc.find('./SOAP-ENV:Body/ns1:getUserLog4/ns1:data',
                                   IHCSoapClient.ihcns).text
            if not base64data:
                return False
            return base64.b64decode(base64data).decode('UTF-8')
        return 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
  );
}
1013042
def check_controller(sess):
    
    controller_operational             = get_data(sess, operational_oid, helper)
    controller_availability            = get_data(sess, availability_oid, helper)
    controller_alarm                   = get_data(sess, alarm_oid, helper)
    
    # Add summary
    helper.add_summary("Controller Status")

    # Add all states to the long output
    helper.add_long_output("Controller Operational State: %s" % operational_states[int(controller_operational)])
    helper.add_long_output("Controller Availability State: %s" % availability_states[int(controller_availability)])
    helper.add_long_output("Controller Alarm State: %s" % alarm_states[int(controller_alarm)])

    # Operational State
    if controller_operational != "1" and controller_operational != "4":
        helper.status(critical)
        helper.add_summary("Controller Operational State: %s" % operational_states[int(controller_operational)])

    # Avaiability State
    if controller_availability != "3":
        helper.status(critical)
        helper.add_summary("Controller Availability State: %s" % availability_states[int(controller_availability)])

    # Alarm State
    if controller_alarm == "2":
        helper.status(warning)
        helper.add_summary("Controller Alarm State: %s" % alarm_states[int(controller_alarm)])
    if controller_alarm == "3" or controller_alarm == "4":
        helper.status(critical)
        helper.add_summary("Controller Alarm State: %s" % alarm_states[int(controller_alarm)])
346298
function () {
    var data = this.data;
    var controllerIndex = data.hand === 'right' ? 0 : data.hand === 'left' ? 1 : 2;
    checkControllerPresentAndSetup(this, GAMEPAD_ID_PREFIX, {index: controllerIndex});
  }
556629
private function getController()
        {
            $expected = $this->request['resource'];
            foreach(glob(APPLICATION_PATH . '/Controllers/*.php', GLOB_NOSORT) as $controller) {
                $controller = basename($controller, '.php');
                if(strnatcasecmp($expected, $controller) == 0) {
                    return 'Controllers_' . $controller;
                }
            }
            return null;
        }
133679
def _get_state():
    '''
    
    '''
    try:
        return pyconnman.ConnManager().get_property('State')
    except KeyError:
        return 'offline'
    except dbus.DBusException as exc:
        raise salt.exceptions.CommandExecutionError('Connman daemon error: {0}'.format(exc))
843222
def get_current_state():
    """"""
    sdp_state = SDPState()
    errval, errdict = _check_status(sdp_state)
    if errval == "error":
        LOG.debug(errdict['reason'])
        return dict(
            current_state="unknown",
            last_updated="unknown",
            reason=errdict['reason']
        )
    LOG.debug('Current State: %s', sdp_state.current_state)
    LOG.debug('Current State last updated: %s',
              sdp_state.current_timestamp.isoformat())
    return dict(
        current_state=sdp_state.current_state,
        last_updated=sdp_state.current_timestamp.isoformat()
    ), HTTPStatus.OK
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)
1290310
function () {
    var buttonState;
    var controller = this.controller;
    var id;

    if (!controller) { return; }

    // Check every button.
    for (id = 0; id < controller.buttons.length; ++id) {
      // Initialize button state.
      if (!this.buttonStates[id]) {
        this.buttonStates[id] = {pressed: false, touched: false, value: 0};
      }
      if (!this.buttonEventDetails[id]) {
        this.buttonEventDetails[id] = {id: id, state: this.buttonStates[id]};
      }

      buttonState = controller.buttons[id];
      this.handleButton(id, buttonState);
    }
    // Check axes.
    this.handleAxes();
  }
190410
def _get_controller_type(self):
        """"""

        if self.node_type == self.NODE_CONTROLLER_ROOT and self.name in self.CONTROLLERS:
            return self.name
        elif self.parent:
            return self.parent.controller_type
        else:
            return None
832567
@Override
    public PowerState getState() {
        if(pin.isState(onState))
            return PowerState.ON;
        else if(pin.isState(offState))
            return PowerState.OFF;
        else
            return PowerState.UNKNOWN;
    }
131895
function () {
    var data = this.data;
    var controller = controllerUtils.findMatchingControllerWebVR(
      this.system.controllers,
      data.id,
      data.idPrefix,
      data.hand,
      data.controller
    );

    this.controller = controller;
    // Legacy handle to the controller for old components.
    this.el.components['tracked-controls'].controller = controller;

    if (this.data.autoHide) { this.el.object3D.visible = !!this.controller; }
  }
1224909
SecurityController getSecurityController()
    {
        SecurityController global = SecurityController.global();
        if (global != null) {
            return global;
        }
        return securityController;
    }
874606
public JobState getState() {
    if (this.completed) {
      if (this.successful) {
        return JobState.SUCCEEDED;
      } else {
        return JobState.FAILED;
      }
    } else {
      return JobState.RUNNING;
    }
    // return JobState.ofInt(this.status.getRunState());
  }
468922
public function getController()
    {
        if (is_null($this->_controller)) {
            $controller = $this->getConfiguration()
                ->get('router.controller', 'pages');
            if (isset($this->_params['controller'])) {
                $controller = $this->_params['controller'];
            }
            $this->_controllerName = $controller;
            $this->_controller = trim(
                "{$this->namespace}\\". ucfirst($controller),
                '\\'
            );
        }
        return $this->_controller;
    }
1327657
public static function findControllerID()
    {
        if (empty($_REQUEST[self::KEY_ID])
            || empty($_SESSION[sprintf(self::KEY_CONTAINER, $_REQUEST[self::KEY_ID])])
        ) {
            return null;
        } else {
            return $_REQUEST[self::KEY_ID];
        }
    }
887316
def get_action_handler(self, controller_name, action_name):
        
        try_actions = [
            controller_name + '/' + action_name,
            controller_name + '/not_found',
            # call Index controller to catch all unhandled pages
            'index/not_found'
        ]
        # search first appropriate action handler
        for path in try_actions:
            if path in self._controllers:
                return self._controllers[path]
        return None