Exemplo n.º 1
0
    def createEntity(self, event):
        """ Parse the event and return an Entity object initilized with information
        included in the event
        Return : a new Entity object
        """
        ent = Entity()
        if event.hasArg(protocol.ARG_ID):
            ent.setId(event.getArg(protocol.ARG_ID))

        if event.hasArg(protocol.ARG_ADDRESS):
            ent.setAddress(event.getArg(protocol.ARG_ADDRESS))

        if event.hasArg(protocol.ARG_POSITION):
            ent.setPosition(event.getArg(protocol.ARG_POSITION))

        if event.hasArg(protocol.ARG_ORIENTATION):
            ent.setOrientation(event.getArg(protocol.ARG_ORIENTATION))

        if event.hasArg(protocol.ARG_AWARENESS_RADIUS):
            ent.setAwarenessRadius(event.getArg(protocol.ARG_AWARENESS_RADIUS))

        if event.hasArg(protocol.ARG_CALIBRE):
            ent.setCalibre(event.getArg(protocol.ARG_CALIBRE))

        if event.hasArg(protocol.ARG_PSEUDO):
            ent.setPseudo(event.getArg(protocol.ARG_PSEUDO))

        return ent