Skip to content

Conversation

@louiecaulfield
Copy link

A datagram can contain multiple OscMessages. This patch adds a field to an OscMessage containing the remaining (tail) bytes of its datagram. The OscPacket constructor continues to parse OscMessages from a datagram until all bytes are consumed.

A datagram can contain multiple OscMessages. This patch adds a field to an OscMessage containing the remaining (tail) bytes of its datagram. The OscPacket constructor continues to parse OscMessages from a datagram until all bytes are consumed.
self._messages.append(TimedMessage(now, msg))
if msg._dgram_tail is None:
break
dgram = msg._dgram_tail
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please provide a readonly property instead of accessing the _dram_tail from another class

while(True):
msg = osc_message.OscMessage(dgram)
self._messages.append(TimedMessage(now, msg))
if msg._dgram_tail is None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. you can just use if not msg.dgram_tail:, no need to compare against None

elif osc_message.OscMessage.dgram_is_message(dgram):
self._messages = [TimedMessage(now, osc_message.OscMessage(dgram))]
self._messages = []
while(True):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. just while True: without parenthesis

elif osc_message.OscMessage.dgram_is_message(dgram):
self._messages = [TimedMessage(now, osc_message.OscMessage(dgram))]
self._messages = []
while(True):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also base the condition of that while loop on the presence of the msg.dgram_tail, it'd read better, something like:

while msg.dgram_tail: msg = osc_message.OscMessage(dram) self._messages.append(TimedMessage(now, msg) 
@attwad attwad deleted the branch attwad:master December 22, 2024 17:07
@attwad attwad closed this Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants