33 lines
989 B
Python
33 lines
989 B
Python
from Messages.Messages import IMessage
|
|
|
|
class ParticipantMsg(IMessage):
|
|
"""! A participant messages notifies other participants of its presence.
|
|
|
|
When received by another participant, it can be followed by a NetworkIdMsg
|
|
to announce that participant to this client such that it can join privately
|
|
"""
|
|
## The message ID
|
|
id: int = 0xA0
|
|
## The length of the message
|
|
length: int = 2
|
|
|
|
def __init__(self, data = None):
|
|
"""! Create a new message for sending
|
|
"""
|
|
pass
|
|
|
|
def Serialize(self, buffer_ref):
|
|
"""! Serialize the message into a byte array.
|
|
@param buffer_ref The buffer to serialize into
|
|
@return The length of the message in the buffer
|
|
"""
|
|
if buffer_ref is None:
|
|
return 0
|
|
|
|
buffer: bytearray = buffer_ref[0]
|
|
buffer[0:ParticipantMsg.length] = [
|
|
ParticipantMsg.id,
|
|
0, # network_id
|
|
]
|
|
return ParticipantMsg.length
|