How to use the pylsl.pylsl.XMLElement function in pylsl

To help you get started, we’ve selected a few pylsl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chkothe / pylsl / pylsl / pylsl.py View on Github external
def append_child_value(self, name, value):
        """Append a child node with a given name, which has a (nameless) 
        plain-text child with the given text value."""
        return XMLElement(lib.lsl_append_child_value(self.e,
                                                     str.encode(name),
                                                     str.encode(value)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def prepend_child(self, name):
        """Prepend a child element with the specified name."""
        return XMLElement(lib.lsl_prepend_child(self.e, str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def previous_sibling(self, name=None):
        """Get the previous sibling in the children list of the parent node.

        If a name is provided, the previous sibling with the given name is
        returned.

        """
        if name is None:
            return XMLElement(lib.lsl_previous_sibling(self.e))
        else:
            return XMLElement(lib.lsl_previous_sibling_n(self.e,
                                                         str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def next_sibling(self, name=None):
        """Get the next sibling in the children list of the parent node.

        If a name is provided, the next sibling with the given name is returned.

        """
        if name is None:
            return XMLElement(lib.lsl_next_sibling(self.e))
        else:
            return XMLElement(lib.lsl_next_sibling_n(self.e, str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def append_child(self, name):
        """Append a child element with the specified name."""
        return XMLElement(lib.lsl_append_child(self.e, str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def next_sibling(self, name=None):
        """Get the next sibling in the children list of the parent node.

        If a name is provided, the next sibling with the given name is returned.

        """
        if name is None:
            return XMLElement(lib.lsl_next_sibling(self.e))
        else:
            return XMLElement(lib.lsl_next_sibling_n(self.e, str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def desc(self):
        """Extended description of the stream.

        It is highly recommended that at least the channel labels are described 
        here. See code examples in the documentation. Other information, such 
        as amplifier settings, measurement units if deviating from defaults, 
        setup information, subject information, etc., can be specified here, as 
        well. See Meta-Data Recommendations in the docs.
        
        Important: if you use a stream content type for which meta-data 
        recommendations exist, please try to lay out your meta-data in 
        agreement with these recommendations for compatibility with other 
        applications.

        """
        return XMLElement(lib.lsl_get_desc(self.obj))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
raise InvalidArgumentError("an argument was incorrectly specified.")
    elif errcode == -4:
        raise InternalError("an internal error has occurred.")
    elif errcode < 0: 
        raise RuntimeError("an unknown error has occurred.")


# =================================================        
# === Compatibility Interface for old pylsl API ===                   
# =================================================                   

# set class aliases
stream_info = StreamInfo
stream_outlet = StreamOutlet
stream_inlet = StreamInlet
xml_element = XMLElement
timeout_error = TimeoutError
lost_error = LostError
vectorf = vectord = vectorl = vectori = vectors = vectorc = vectorstr = list


def resolve_stream(*args):
    if len(args) == 0:
        return resolve_streams()
    elif type(args[0]) in [int, float]:
        return resolve_streams(args[0])
    elif type(args[0]) is str:
        if len(args) == 1:
            return resolve_bypred(args[0])
        elif type(args[1]) in [int, float]:
            return resolve_bypred(args[0], args[1])
        else:
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def previous_sibling(self, name=None):
        """Get the previous sibling in the children list of the parent node.

        If a name is provided, the previous sibling with the given name is
        returned.

        """
        if name is None:
            return XMLElement(lib.lsl_previous_sibling(self.e))
        else:
            return XMLElement(lib.lsl_previous_sibling_n(self.e,
                                                         str.encode(name)))
github chkothe / pylsl / pylsl / pylsl.py View on Github external
def set_child_value(self, name, value):
        """Set the text value of the (nameless) plain-text child of a named 
        child node."""
        return XMLElement(lib.lsl_set_child_value(self.e,
                                                  str.encode(name),
                                                  str.encode(value)))