Refactoring

This commit is contained in:
Pascal Serrarens 2025-02-23 20:40:16 +01:00
parent 5d9089d7ac
commit 1b31587202
6 changed files with 181 additions and 69 deletions

View File

@ -1,2 +1,69 @@
error: tag OUTPUT_DIRECTORY: Output directory '//intranet/web/passer_life/apis/ControlCore/Python/' does not exist and cannot be created
Exiting...
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:42: warning: documented symbol 'controlcore.Participant.Participant::bool' was not declared or defined.
error: Project logo '//intranet/home/Afbeeldingen/PasserVR/Logos/Logo3NameRight100.png' specified by PROJECT_LOGO does not exist!
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:13: warning: Member SendTo(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:19: warning: Member Publish(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:67: warning: Member length (variable) of class controlcore.Messages.NetworkIdMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:69: warning: Member network_id (variable) of class controlcore.Messages.NetworkIdMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:5: warning: Member id (variable) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:13: warning: Member SendTo(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:19: warning: Member Publish(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:5: warning: Member id (variable) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:115: warning: Member __init__(self, network_id, thing) (function) of class controlcore.Messages.PoseMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:119: warning: Member Serialize(self, buffer_ref) (function) of class controlcore.Messages.PoseMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:13: warning: Member SendTo(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:19: warning: Member Publish(self, participant) (function) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:116: warning: Member network_id (variable) of class controlcore.Messages.PoseMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:117: warning: Member thing (variable) of class controlcore.Messages.PoseMsg is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Messages.py:5: warning: Member id (variable) of class controlcore.Messages.IMessage is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:27: warning: Member __init__(self, ipAddress="0.0.0.0", port=7681, remote=False, udp_socket=None) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:50: warning: Member GetParticipant(self, ip_address, port) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:60: warning: Member AddParticipant(self, ip_address, port) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:67: warning: Member Update(self, currentTimeMs=None) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:82: warning: Member SendThingInfo(self, thing) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:87: warning: Member Send(self, msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:96: warning: Member Publish(self, msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:109: warning: Member Receiver(self) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:121: warning: Member ReceiveData(self, data, remote_participant) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:141: warning: Member ProcessClientMsg(self, sender, ParticipantMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:144: warning: Member ProcessNetworkIdMsg(self, sender, NetworkIdMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:153: warning: Member ProcessInvestigateMsg(self, bytearray data) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:156: warning: Member ProcessThingMsg(self, ThingMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:168: warning: Member ProcessNameMsg(self, NameMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:171: warning: Member ProcessModelUrlMsg(self, ModelUrlMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:174: warning: Member ProcessBinary(self, BinaryMsg msg) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:180: warning: Member Register(self, constructor, thing_type) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:183: warning: Member OnNewThing(self, event_handler) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:186: warning: Member OnNewThingType(self, thing_type, event_handler) (function) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:28: warning: Member ip_address (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:29: warning: Member port (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:33: warning: Member thing_msg_processors (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:34: warning: Member new_thing_handlers (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:37: warning: Member udp_socket (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:17: warning: Member publishInterval (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:19: warning: Member buffer (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:22: warning: Member nextPublishMe (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:23: warning: Member others (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:24: warning: Member thread (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Participant.py:25: warning: Member name (variable) of class controlcore.Participant.Participant is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:22: warning: Member __init__(self, network_id=0, thing_id=0, type=Type.Undetermined, parent=None, name=None) (function) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:43: warning: Member update(self, currentTime) (function) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:46: warning: Member ProcessBinary(self, data) (function) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:53: warning: Member Add(thing) (function) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:58: warning: Member Get(network_id, thing_id) (function) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:23: warning: Member network_id (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:24: warning: Member id (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:25: warning: Member type (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:27: warning: Member parent_id (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:31: warning: Member name (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:32: warning: Member model_url (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:34: warning: Member position (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:35: warning: Member orientation (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:36: warning: Member linearVelocity (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:37: warning: Member angularVelocity (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:39: warning: Member pose_updated (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:17: warning: Member Position (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:18: warning: Member Orientation (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:19: warning: Member LinearVelocity (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:20: warning: Member AngularVelocity (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/Thing.py:50: warning: Member allThings (variable) of class controlcore.Thing.Thing is not documented.
/Users/pascal/Documents/Dev/Python/controlcore/LinearAlgebra/SwingTwist.py:6: warning: Member __init__(self, Direction swing, float twist) (function) of class SwingTwist.SwingTwist is not documented.

View File

@ -22,6 +22,77 @@ class IMessage:
return False
return participant.PublishBuffer(bufferSize)
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
## The network ID known by the participant.
network_id: int = None
def __init__(self, network_id: int):
"""! Create a new message for sending
@param network_id The network ID known by the participant. Use 0 if it is unknown
"""
if isinstance(network_id, int):
self.network_id = network_id
elif isinstance(network_id, bytes):
self.network_id = network_id[1]
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 or self.network_id is None:
return 0
buffer: bytearray = buffer_ref[0]
buffer[0:ParticipantMsg.length] = [
ParticipantMsg.id,
self.network_id
]
return ParticipantMsg.length
## A network id message invites another participant to a site
#
## This can be sent in response to a ClientMsg
class NetworkIdMsg(IMessage):
id = 0xA1
length = 2
network_id = None
## Create a network id message
#
# @param network_id The network id assigned to the remote participant.
def __init__(self, network_id):
self.network_id = None
if isinstance(network_id, int):
self.network_id = network_id
elif isinstance(network_id, bytes):
self.network_id = network_id[1]
## Serialize the message into the given buffer
#
## @param buffer_ref A reference to the buffer to use. This should be a list with the buffer as its first and only element
## @returns the length of the message
def Serialize(self, buffer_ref):
if self.network_id is None:
return 0
buffer: bytearray = buffer_ref[0]
buffer[0:NetworkIdMsg.length] = [
NetworkIdMsg.id,
self.network_id
]
return NetworkIdMsg.length
class InvestigateMsg():
id = 0x81
length = 3
@ -31,7 +102,14 @@ class InvestigateMsg():
self.thing_id = buffer[2]
class PoseMsg(IMessage):
"""! Message to communicate the pose of the thing
The pose is in local space relative to the parent.
If there is not parent (the thing is a root thing), the pose will be in world space.
"""
## The message ID
id = 0x10
## The length of the message
length = 4
def __init__(self, network_id, thing):

View File

@ -1,38 +1,5 @@
from Messages.Messages import IMessage
# from Messages.Messages import IMessage
## A network id message invites another participant to a site
#
## This can be sent in response to a ClientMsg
class NetworkIdMsg(IMessage):
id = 0xA1
length = 2
network_id = None
## Create a network id message
#
# @param network_id The network id assigned to the remote participant.
def __init__(self, network_id):
self.network_id = None
if isinstance(network_id, int):
self.network_id = network_id
elif isinstance(network_id, bytes):
self.network_id = network_id[1]
## Serialize the message into the given buffer
#
## @param buffer_ref A reference to the buffer to use. This should be a list with the buffer as its first and only element
## @returns the length of the message
def Serialize(self, buffer_ref):
if self.network_id is None:
return 0
buffer: bytearray = buffer_ref[0]
buffer[0:NetworkIdMsg.length] = [
NetworkIdMsg.id,
self.network_id
]
return NetworkIdMsg.length
# def SendTo(participant, network_id):
# if network_id is None:

View File

@ -1,41 +1,41 @@
from Messages.Messages import IMessage
# from Messages.Messages import IMessage
class ParticipantMsg(IMessage):
"""! A participant messages notifies other participants of its presence.
# 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
## The network ID known by the participant.
network_id: int = None
# 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
# ## The network ID known by the participant.
# network_id: int = None
def __init__(self, network_id: int):
"""! Create a new message for sending
@param network_id The network ID known by the participant. Use 0 if it is unknown
"""
if isinstance(network_id, int):
self.network_id = network_id
elif isinstance(network_id, bytes):
self.network_id = network_id[1]
# def __init__(self, network_id: int):
# """! Create a new message for sending
# @param network_id The network ID known by the participant. Use 0 if it is unknown
# """
# if isinstance(network_id, int):
# self.network_id = network_id
# elif isinstance(network_id, bytes):
# self.network_id = network_id[1]
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 or self.network_id is None:
return 0
# 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 or self.network_id is None:
# return 0
buffer: bytearray = buffer_ref[0]
buffer[0:ParticipantMsg.length] = [
ParticipantMsg.id,
self.network_id
]
return ParticipantMsg.length
# buffer: bytearray = buffer_ref[0]
# buffer[0:ParticipantMsg.length] = [
# ParticipantMsg.id,
# self.network_id
# ]
# return ParticipantMsg.length
# @staticmethod
# def Serialized(buffer_ref, network_id):