Sha256: 33f407c4fb41d45786b11a0eec81f44b61a339cc4248dc316457b881aab075ee

Contents?: true

Size: 908 Bytes

Versions: 3

Compression:

Stored size: 908 Bytes

Contents

const { Handler } = require('../handler/Handler')
const CommandEncoder = require('../protocol/CommandEncoder')
const CommandDecoder = require('../protocol/CommandDecoder')


let Transmitter

class Interpreter {
    handler = new Handler()

    execute(command, connectionType, tcpAddress) {
        // lazy transmitter loading
        if(!Transmitter) {
            Transmitter = require('../transmitter/NodejsTransmitter')
        }

        let encoder = new CommandEncoder()
        let byteMessage = encoder.encode(command,connectionType, tcpAddress)

        let bytes = Transmitter.sendCommand(byteMessage)
        return new CommandDecoder(bytes).decode()
    }

    process(byteArray) {
        let decoder = new CommandDecoder(byteArray)
        let command = decoder.decode()

        return this.handler.handleCommand(command)
    }
}

module.exports = Interpreter

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.0.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/interpreter/Interpreter.js
javonet-ruby-sdk-2.0.1 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/src/core/interpreter/Interpreter.js
javonet-ruby-sdk-2.0.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/src/core/interpreter/Interpreter.js