コード例 #1
0
def test_selector_from_encoded():
    """Make sure we can create a selector from an encoded value."""

    sel = DataStreamSelector.FromEncoded(0x5FFF)
    assert str(sel) == 'all system outputs'

    sel = DataStreamSelector.FromEncoded(0xD7FF)
    assert str(sel) == 'all outputs'

    sel = DataStreamSelector.FromEncoded(0x100a)
    assert str(sel) == 'unbuffered 10'

    assert str(
        DataStreamSelector.FromEncoded(
            DataStreamSelector.FromString(
                'all combined output').encode())) == 'all combined outputs'
コード例 #2
0
    def dump_begin(self, selector_id):
        """Start dumping a stream.

        Args:
            selector_id (int): The buffered stream we want to dump.

        Returns:
            (int, int, int): Error code, second error code, number of available readings
        """

        if self.dump_walker is not None:
            self.storage.destroy_walker(self.dump_walker)

        selector = DataStreamSelector.FromEncoded(selector_id)
        self.dump_walker = self.storage.create_walker(selector, skip_all=False)

        return Error.NO_ERROR, Error.NO_ERROR, self.dump_walker.count()