How to use the acquisition.protocols.dsi.packet function in Acquisition

To help you get started, we’ve selected a few Acquisition 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 BciPy / BciPy / acquisition / datastream / tcpclient.py View on Github external
def receive_packet(socket, header_len=12):
    """Reads the header to get the payload length, then reads the payload."""

    header_buf = receive(socket, header_len)
    header = dsi.header.parse(header_buf)
    payload_buf = receive(socket, header.payload_length)
    return dsi.packet.parse(header_buf + payload_buf)
github BciPy / BciPy / acquisition / protocols / dsi_device.py View on Github external
def _read_packet(self):
        """Read a single packet from the data source.

        Returns
        -------
            dict-like object
        """

        assert self._socket is not None

        # Reads the header to get the payload length, then reads the payload.
        header_buf = util.receive(self._socket, dsi.header_len)
        header = dsi.header.parse(header_buf)
        payload_buf = util.receive(self._socket, header.payload_length)
        return dsi.packet.parse(header_buf + payload_buf)