Enable or disable applications over NFC.
501427
def nfc(ctx, enable, disable, enable_all, disable_all, list, lock_code, force):
    

    if not (list or enable_all or enable or disable_all or disable):
        ctx.fail('No configuration options chosen.')

    if enable_all:
        enable = APPLICATION.__members__.keys()

    if disable_all:
        disable = APPLICATION.__members__.keys()

    _ensure_not_invalid_options(ctx, enable, disable)

    dev = ctx.obj['dev']
    nfc_supported = dev.config.nfc_supported
    nfc_enabled = dev.config.nfc_enabled

    if not nfc_supported:
        ctx.fail('NFC interface not available.')

    if list:
        _list_apps(ctx, nfc_enabled)

    for app in enable:
        if APPLICATION[app] & nfc_supported:
            nfc_enabled |= APPLICATION[app]
        else:
            ctx.fail('{} not supported over NFC.'.format(app))
    for app in disable:
        if APPLICATION[app] & nfc_supported:
            nfc_enabled &= ~APPLICATION[app]
        else:
            ctx.fail('{} not supported over NFC.'.format(app))

    f_confirm = '{}{}Configure NFC interface?'.format(
        'Enable {}.\n'.format(
            ', '.join(
                [str(APPLICATION[app]) for app in enable])) if enable else '',
        'Disable {}.\n'.format(
            ', '.join(
                [str(APPLICATION[app]) for app in disable])) if disable else '')

    is_locked = dev.config.configuration_locked

    if force and is_locked and not lock_code:
        ctx.fail('Configuration is locked - please supply the --lock-code '
                 'option.')
    if lock_code and not is_locked:
        ctx.fail('Configuration is not locked - please remove the '
                 '--lock-code option.')

    force or click.confirm(f_confirm, abort=True, err=True)

    if is_locked and not lock_code:
        lock_code = prompt_lock_code()

    if lock_code:
        lock_code = _parse_lock_code(ctx, lock_code)

    try:
        dev.write_config(
            device_config(
                nfc_enabled=nfc_enabled),
            reboot=True, lock_key=lock_code)
    except Exception as e:
        logger.error('Failed to write config', exc_info=e)
        ctx.fail('Failed to configure NFC applications.')
973244
public static function enable()
    {
        Builder::macro(self::MACRO_METHOD, function (Fluent $builder, $createdAt = 'createdAt', $updatedAt = 'updatedAt', $type = 'dateTime') {
            $builder->{$type}($createdAt)->timestampable()->onCreate();
            $builder->{$type}($updatedAt)->timestampable()->onUpdate();
        });
    }
1359912
def disable_device(self):
        
        cmd_response = self.__send_command(const.CMD_DISABLEDEVICE)
        if cmd_response.get('status'):
            self.is_enabled = False
            return True
        else:
            raise ZKErrorResponse("Can't disable device")
1335124
def cancelApplicationLaunch(self, pchAppKey):
        """"""

        fn = self.function_table.cancelApplicationLaunch
        result = fn(pchAppKey)
        return result
957513
def sense_ttb(self, target):
        """"""
        info = "{device} does not support sense for Type B Target"
        raise nfc.clf.UnsupportedTargetError(info.format(device=self))
248354
def do_disable_commands(self, _):
        """"""
        message_to_print = "{} is not available while {} commands are disabled".format(COMMAND_NAME,
                                                                                       self.CMD_CAT_APP_MGMT)
        self.disable_category(self.CMD_CAT_APP_MGMT, message_to_print)
        self.poutput("The Application Management commands have been disabled")
1176600
final protected function enabledAppProcess()
    {
        $appname = $this->params['capp'];
        Output::displayAsGreen(
            "Processing to enabled app : $appname  will be enabled \n",
            "none",
            false
        );
        sleep(1);
        $file = json_decode(file_get_contents(FEnvFcm::get("framework.config.core.apps.file")));

        foreach ($file as $val) {
            if ($val->name == $this->params['capp']) {
                $val->update = new \DateTime();
                $val->enabled = "yes";
            }
        }

        $file = json_encode($file, JSON_PRETTY_PRINT);
        file_put_contents(FEnvFcm::get("framework.config.core.apps.file"), $file);
        Output::displayAsGreen("Now, the ".$this->params['capp']." is enabled", "none", false);
    }
687760
def enable():
    '''
    
    '''
    puppet = _Puppet()

    if os.path.isfile(puppet.disabled_lockfile):
        try:
            os.remove(puppet.disabled_lockfile)
        except (IOError, OSError) as exc:
            msg = 'Failed to enable: {0}'.format(exc)
            log.error(msg)
            raise CommandExecutionError(msg)
        else:
            return True
    return False
1225593
def stop_app(self, package_name, clear=False):
        '''
        
        '''
        if clear:
            self.adb_shell(['pm', 'clear', package_name])
        else:
            self.adb_shell(['am', 'force-stop', package_name])
        return self
936136
function (token, deviceId, appId, events) {
    var options = {
      deviceId: deviceId,
      appId: appId,
    };

    require('./helpers').startAppUninstall(options, events);

  }
830270
def enable_disable_nat(self):
        
        if self.nat:
            self.data['nat'] = False
        else:
            self.data['nat'] = True
788623
protected void setOkEnabled(boolean enabled, String message) {

        if (enabled) {
            m_okButton.enable();
        } else {
            m_okButton.disable(message);
        }
    }
997731
public static function disableAll()
    {
        $app = Application::getFacadeApplication();
        $app->make('cache/request')->disable();
        $app->make('cache/expensive')->disable();
        $app->make('cache')->disable();
    }
91775
public function enableOffline()
    {
        $this->settings['offline'] = $this->data['offline_interval'] === 'unlimited'
            ? true
            : strtotime('+'.intval($this->data['offline_value']).' '.$this->data['offline_interval']);
        $this->touch(false);
    }
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
1228788
public void disable() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "disable chain " + this);
        }
        enabled = false;
    }
807941
def ndef(ctx, slot, prefix):
    
    dev = ctx.obj['dev']
    controller = ctx.obj['controller']
    if not dev.config.nfc_supported:
        ctx.fail('NFC interface not available.')

    if not controller.slot_status[slot - 1]:
        ctx.fail('Slot {} is empty.'.format(slot))

    try:
        if prefix:
            controller.configure_ndef_slot(slot, prefix)
        else:
            controller.configure_ndef_slot(slot)
    except YkpersError as e:
        _failed_to_write_msg(ctx, e)