Exemplo n.º 1
0
	def __init__(self, dgram):
		"""Initializes the OscBundle with the given datagram.

		Args:
			dgram: a UDP datagram representing an OscBundle.

		Raises:
			ParseError: if the datagram could not be parsed into an OscBundle.
		"""
		# Interesting stuff starts after the initial b"#bundle\x00".
		self._dgram = dgram
		index = len(_BUNDLE_PREFIX)
		self._timestamp, index = osc_types.get_date(self._dgram, index)
		# Get the contents as a list of OscBundle and OscMessage.
		self._contents = self._parse_contents(index)
Exemplo n.º 2
0
    def __init__(self, dgram: bytes) -> None:
        """Initializes the OscBundle with the given datagram.

        Args:
          dgram: a UDP datagram representing an OscBundle.

        Raises:
          ParseError: if the datagram could not be parsed into an OscBundle.
        """
        # Interesting stuff starts after the initial b"#bundle\x00".
        self._dgram = dgram
        index = len(_BUNDLE_PREFIX)
        try:
            self._timestamp, index = osc_types.get_date(self._dgram, index)
        except osc_types.ParseError as pe:
            raise ParseError("Could not get the date from the datagram: %s" %
                             pe)
        # Get the contents as a list of OscBundle and OscMessage.
        self._contents = self._parse_contents(index)
Exemplo n.º 3
0
 def test_origin_of_time(self):
   dgram = b'\x00' * 8
   self.assertGreater(0, osc_types.get_date(dgram, 0)[0])
Exemplo n.º 4
0
 def test_immediately_dgram(self):
   dgram = ntp.IMMEDIATELY
   self.assertEqual(osc_types.IMMEDIATELY, osc_types.get_date(dgram, 0)[0])
Exemplo n.º 5
0
 def test_origin_of_time(self):
     dgram = b'\x00' * 8
     self.assertGreater(0, osc_types.get_date(dgram, 0)[0])
Exemplo n.º 6
0
 def test_immediately_dgram(self):
     dgram = ntp.IMMEDIATELY
     self.assertEqual(osc_types.IMMEDIATELY,
                      osc_types.get_date(dgram, 0)[0])