pc: Control any PLC device.
10207
def pc_encode(index, function_code, extended_code, time):
    """"""
    return MessageEncode('11pc{hc}{fc:02d}{ec:02d}{time:04d}00'.
                         format(hc=index_to_housecode(index),
                                fc=function_code, ec=extended_code,
                                time=time), None)
789348
def task_control(self):
        """"""
        return TaskControl(
                        self,
                        self.state,
                        self.path,
                        self._gateway)
387389
def kpl_on(self, address, group):
        """"""
        addr = Address(address)
        device = self.plm.devices[addr.id]
        device.states[group].on()
525567
def _configure_device(commands, **kwargs):
    '''
    
    '''
    if salt.utils.platform.is_proxy():
        return __proxy__['nxos.proxy_config'](commands, **kwargs)
    else:
        return _nxapi_config(commands, **kwargs)
887395
def copy(self):
        """"""
        if self.has_selected_text():
            ConsoleBaseWidget.copy(self)
        elif not sys.platform == 'darwin':
            self.interrupt()
322161
function ComputerController(ball) {
    var myHandle;

    this.mount = function (handle) {
        myHandle = handle;
    };

    this.dismount = function () {
        myHandle = null;
    };

    this.step = function () {
        if (myHandle) {
            if (myHandle.y > ball.y) {
                myHandle.move(Math.random() * 2 + 1);
            } else {
                myHandle.move(-(Math.random() * 2 + 1));
            }
        }
    };
}
378115
def set_arbitrary(self, freq, low_volt, high_volt, output_state=True):
        """"""
        commands = ['FUNC USER',
                    'BURS:STAT OFF',
                    'SWE:STAT OFF',
                    'FM:STAT OFF',
                    'FREQ {0}'.format(freq),
                    'VOLT:HIGH {0}'.format(high_volt),
                    'VOLT:LOW {0}'.format(low_volt),
                    ]
        if output_state is True:
            commands.append('OUTP ON')
        else:
            commands.append('OUTP OFF')

        command_string = '\n'.join(commands)
        print_string = '\n\t' + command_string.replace('\n', '\n\t')
        logging.info(print_string)
        self.instr.write(command_string)
40220
def start(self):
        
        print("Entering monitoring mode, press CTRL-C to quit")
        serial = self._connection.serial

        while True:
            serial.write(b"@R")
            length = int(serial.read(), 16)
            data = serial.read(length * 2)
            message = messages.parse(data)
            if not (self._options.filter and
                    message.entity and
                    message.entity in self._devices):
                logging.debug(" ".join(message.bytes))
            if not self._options.config or \
               message.entity is None or \
               message.entity in self._devices:
                continue

            print("New device found")
            ha_id = input("Enter home assistant unique ID: ")
            name = input("Enter name: ")
            self._add_device(scs_id=message.entity, ha_id=ha_id, name=name)
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
915248
def get_control(self):
        """"""
        # page_control is the widget used for paging
        page_control = self.shellwidget._page_control
        if page_control and page_control.isVisible():
            return page_control
        else:
            return self.shellwidget._control
138875
public function cmdGetTrigger()
    {
        $result = $this->getListTrigger();
        $this->outputFormat($result);
        $this->outputFormatTableTrigger($result);
        $this->output();
    }
37163
def set_bpf_filter_on_all_devices(filterstr):
        '''
        
        '''
        with PcapLiveDevice._lock:
            for dev in PcapLiveDevice._OpenDevices.values():
                _PcapFfi.instance()._set_filter(dev, filterstr)
804018
def control(self, key):
        """"""
        if not self.connection:
            raise exceptions.ConnectionClosed()

        payload = json.dumps({
            "method": "ms.remote.control",
            "params": {
                "Cmd": "Click",
                "DataOfCmd": key,
                "Option": "false",
                "TypeOfRemote": "SendRemoteKey"
            }
        })

        logging.info("Sending control command: %s", key)
        self.connection.send(payload)
        time.sleep(self._key_interval)
92675
def set_servo(self, channel, pwm):
        ''''''
        self.mav.command_long_send(self.target_system, self.target_component,
                                   mavlink.MAV_CMD_DO_SET_SERVO, 0,
                                   channel, pwm,
                                   0, 0, 0, 0, 0)
1330394
def setup(self):
        """"""
        if not isinstance(self.filePath, str):
            raise TypeError("File path is not a string!")
        if self.controller is None:
            raise ValueError("Command controller hasn't been specified!")
1044760
function() {
		var i, j, item, controls,
		    config = this.config = this.system.config.input;

		for ( i = 0; i < config.length; i++ ) {
			item = config[ i ];
			
			this.setController( i, item.type );

			controls = item.controls;
			if ( !Array.isArray(controls) ) {
				controls = [ controls ];
			}

			for ( j = 0; j < controls.length; j++ ) {
				this.configure( i, controls[ j ].type, controls[ j ].config );
			}
		}
	}
1266203
def x10_all_lights_on(self, housecode):
        """"""
        msg = X10Send.command_msg(housecode, X10_COMMAND_ALL_LIGHTS_ON)
        self.send_msg(msg)
        self._x10_command_to_device(housecode, X10_COMMAND_ALL_LIGHTS_ON, msg)