Sha256: 57a9c3936a9fd4065c42d400394a10547046f5d0ac1748ec19a82988790ab4ff

Contents?: true

Size: 1.51 KB

Versions: 8

Compression:

Stored size: 1.51 KB

Contents

from javonet.core.handler.Handler import Handler
from javonet.core.protocol.CommandDeserializer import CommandDeserializer
from javonet.core.protocol.CommandSerializer import CommandSerializer
from javonet.utils.ConnectionType import ConnectionType
from javonet.utils.RuntimeName import RuntimeName
from javonet.utils.connectionData.IConnectionData import IConnectionData

handler = Handler()

class Interpreter:

    def execute(self, command, connection_data: IConnectionData):
        message_byte_array = CommandSerializer().serialize(command, connection_data)
        if connection_data.connection_type == ConnectionType.WebSocket:
            from javonet.core.webSocketClient.WebSocketClient import WebSocketClient
            response_byte_array = WebSocketClient().send_message(connection_data, message_byte_array)
        elif (command.runtime_name == RuntimeName.python) & (
                connection_data.connection_type == ConnectionType.InMemory):
            from javonet.core.receiver.Receiver import Receiver
            response_byte_array = Receiver().SendCommand(message_byte_array, len(message_byte_array))
        else:
            from javonet.core.transmitter.Transmitter import Transmitter
            response_byte_array = Transmitter.send_command(message_byte_array)

        return CommandDeserializer(response_byte_array).deserialize()

    def process(self, message_byte_array):
        received_command = CommandDeserializer(message_byte_array).deserialize()
        return handler.handle_command(received_command)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.10 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.9 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.8 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Python/javonet/core/interpreter/Interpreter.py