Params:
            action              - start or stop
            channel             - channel number
            preset_point_number - preset point number
346047
def go_to_preset(self, action=None, channel=0, preset_point_number=1):
        
        ret = self.command(
            'ptz.cgi?action={0}&channel={1}&code=GotoPreset&arg1=0'
            '&arg2={2}&arg3=0'.format(action, channel, preset_point_number)
        )
        return ret.content.decode('utf-8')
297071
def set_param(self, number, value):
        
        logger.debug("setting param number %s to %s" % (number, value))
        return self.library.Srv_SetParam(self.pointer, number,
                                         ctypes.byref(ctypes.c_int(value)))
406351
def edit_channel(channel, status, game)
      return false unless @access_token

      path = "/channels/#{channel}/?oauth_token=#{@access_token}"
      url = @base_url + path
      data = {
        :channel =>{
          :game => game,
          :status => status
        }
      }
      put(url, data)
    end
293912
def commit_channel(self, channel_id):
        
        payload = {
            "channel_id":channel_id,
            "stage": config.STAGE,
        }
        response = config.SESSION.post(config.finish_channel_url(), data=json.dumps(payload))
        if response.status_code != 200:
            config.LOGGER.error("\n\nCould not activate channel: {}\n".format(response._content.decode('utf-8')))
            if response.status_code == 403:
                config.LOGGER.error("Channel can be viewed at {}\n\n".format(config.open_channel_url(channel_id, staging=True)))
                sys.exit()
        response.raise_for_status()
        new_channel = json.loads(response._content.decode("utf-8"))
        channel_link = config.open_channel_url(new_channel['new_channel'])
        return channel_id, channel_link
30331
def action_setattr():
    

    def action_setattr(value, context, **_params):
        setattr(context["action"], context["key"], value)
        return _attr()

    return action_setattr
602184
def start(self, channel):
        

        if self._started:
            raise InternalError("The method start() was called twice on VirtualIOTileDevice.")

        self._push_channel = channel
        self.start_workers()
244810
def set(self, start, stop, length=None, units='bytes'):
        """"""
        assert is_byte_range_valid(start, stop, length), \
            'Bad range provided'
        self._units = units
        self._start = start
        self._stop = stop
        self._length = length
        if self.on_update is not None:
            self.on_update(self)
383548
def set_param(self, idx):
        

        self.modifier.set_param(self.format[self.param_begin:idx])
924776
def frame(self, action):
        '''
        '''
        choices = {'on': '1',
                   'off': '0'}
        if action in choices:
            self.send(chr(27)+'if'+choices[action])
        else:
            raise RuntimeError('Invalid action for function frame, choices are on and off')
573233
def act( self ):
        ''''''
        if self.action_set == 'discrete_absolute':
            actions = ['movenorth 1', 'movesouth 1', 'movewest 1', 'moveeast 1']
        elif self.action_set == 'discrete_relative':
            actions = ['move 1', 'move -1', 'turn 1', 'turn -1']
        elif self.action_set == 'teleport':
            while True:
                dx = random.randint(-10,10)
                dz = random.randint(-10,10)
                if not dx == 0 or not dz == 0:
                    break
            self.expected_x = self.prev_x + dx
            self.expected_y = self.prev_y
            self.expected_z = self.prev_z + dz
            self.expected_yaw = self.prev_yaw
            self.require_move = True
            self.require_yaw_change = False
            actions = ['tp '+str(self.expected_x)+' '+str(self.expected_y)+' '+str(self.expected_z)]
        else:
            print('ERROR: Unsupported action set:',self.action_set)
            exit(1)
        i_action = random.randint(0,len(actions)-1)
        action = actions[ i_action ]
        print('Sending',action)
        self.agent_host.sendCommand( action )
        if self.action_set == 'discrete_absolute':
            self.expected_x = self.prev_x + [0,0,-1,1][i_action]
            self.expected_y = self.prev_y
            self.expected_z = self.prev_z + [-1,1,0,0][i_action]
            self.expected_yaw = self.prev_yaw
            self.require_move = True
            self.require_yaw_change = False
        elif self.action_set == 'discrete_relative':
            if i_action == 0 or i_action == 1:
                i_yaw = indexOfClosest( [0,90,180,270], self.prev_yaw )
                forward = [ (0,1), (-1,0), (0,-1), (1,0) ][ i_yaw ]
                if i_action == 0:
                    self.expected_x = self.prev_x + forward[0]
                    self.expected_z = self.prev_z + forward[1]
                else:
                    self.expected_x = self.prev_x - forward[0]
                    self.expected_z = self.prev_z - forward[1]
                self.expected_y = self.prev_y
                self.expected_yaw = self.prev_yaw
                self.require_move = True
                self.require_yaw_change = False
            else:
                self.expected_x = self.prev_x
                self.expected_y = self.prev_y
                self.expected_z = self.prev_z
                self.expected_yaw = math.fmod( 360 + self.prev_yaw + [90,-90][i_action-2], 360 )
                self.require_move = False
                self.require_yaw_change = True
        elif self.action_set == 'teleport':
            pass
        else:
            print('ERROR: Unsupported action set:',self.action_set)
            exit(1)
491462
def set_override_chan(self, channel, value):
        ''''''
        self.override[channel] = value
        self.override_counter = 10
        self.send_rc_override()
731204
def set_watchpoint(self, addr, size, type):
        
        return self.dwt.set_watchpoint(addr, size, type)
58827
async def trigger(self, action, args):
        
        if 'update' not in action \
                and 'error' not in action \
                and action.startswith('pre_process'):
            locale = await self.get_user_locale(action, args)
            self.ctx_locale.set(locale)
            return True
1231311
def set_channel(self, channel):
        
        self.channel = channel
        self.__record_progress(Status.CREATE_TREE)
1083156
def _sendAction(self, action, attrs=None, chan_vars=None):
        
        self._conn.write("Action: %s\r\n" % action)
        if attrs:
            for (key,val) in attrs:
                self._conn.write("%s: %s\r\n" % (key, val))
        if chan_vars:
            for (key,val) in chan_vars:
                self._conn.write("Variable: %s=%s\r\n" % (key, val))
        self._conn.write("\r\n")
1104675
def _add_pending_action(self, p_action, p_size):
        
        def generate_callback():
            def callback(*args):
                self.resolve_action(p_action, p_size)
                self.keystate = None

            return callback

        urwid.emit_signal(self, 'add_pending_action', generate_callback())
1187909
def send_position_setpoint(self, x, y, z, yaw):
        
        pk = CRTPPacket()
        pk.port = CRTPPort.COMMANDER_GENERIC
        pk.data = struct.pack('<Bffff', TYPE_POSITION,
                              x, y, z, yaw)
        self._cf.send_packet(pk)