Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Fails for Rexroth Nexo Nutrunner #23

Open
HelloHungryImDad opened this issue Mar 2, 2021 · 1 comment
Open

Connection Fails for Rexroth Nexo Nutrunner #23

HelloHungryImDad opened this issue Mar 2, 2021 · 1 comment

Comments

@HelloHungryImDad
Copy link

Running the example code from here, the tool briefly shows connection then disconnects without triggering the connection callback.

Output of NODE_DEBUG='open-protocol' node test.js:

OPEN-PROTOCOL 761: new SessionControlClient
OPEN-PROTOCOL 761: new LinkLayer {
  stream: <ref *1> Socket {
    connecting: true,
    _hadError: false,
    _parent: null,
    _host: null,
    _readableState: ReadableState {
      objectMode: false,
      highWaterMark: 16384,
      buffer: BufferList { head: null, tail: null, length: 0 },
      length: 0,
      pipes: [],
      flowing: null,
      ended: false,
      endEmitted: false,
      reading: false,
      sync: true,
      needReadable: false,
      emittedReadable: false,
      readableListening: false,
      resumeScheduled: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      destroyed: false,
      errored: null,
      closed: false,
      closeEmitted: false,
      defaultEncoding: 'utf8',
      awaitDrainWriters: null,
      multiAwaitDrain: false,
      readingMore: false,
      decoder: null,
      encoding: null,
      [Symbol(kPaused)]: null
    },
    _events: [Object: null prototype] {
      end: [Function: onReadableStreamEnd],
      connect: [Function],
      timeout: [Function]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: false,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: false,
      autoDestroy: false,
      errored: null,
      closed: false,
      closeEmitted: false,
      writable: true
    },
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    timeout: 20000,
    [Symbol(async_id_symbol)]: 2,
    [Symbol(kHandle)]: TCP {
      reading: false,
      onconnection: null,
      [Symbol(owner_symbol)]: [Circular *1]
    },
    [Symbol(kSetNoDelay)]: false,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: Timeout {
      _idleTimeout: 20000,
      _idlePrev: [TimersList],
      _idleNext: [TimersList],
      _idleStart: 487,
      _onTimeout: [Function: bound ],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: false,
      [Symbol(refed)]: false,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 4,
      [Symbol(triggerId)]: 1
    },
    [Symbol(kBuffer)]: null,
    [Symbol(kBufferCb)]: null,
    [Symbol(kBufferGen)]: null,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0
  },
  timeOut: 3000,
  retryTimes: 3,
  rawData: false,
  disableMidParsing: {}
}
OPEN-PROTOCOL 761: new OpenProtocolParser
OPEN-PROTOCOL 761: new openProtocolSerializer
OPEN-PROTOCOL 761: new MIDParser
OPEN-PROTOCOL 761: new MIDSerializer
OPEN-PROTOCOL 761: SessionControlClient connect
OPEN-PROTOCOL 761: SessionControlClient sendMidOne
OPEN-PROTOCOL 761: LinkLayer _write { mid: 1, revision: 6 }
OPEN-PROTOCOL 761: MIDSerializer _transform { mid: 1, revision: 6 }
OPEN-PROTOCOL 761: LinkLayer _onDataMidSerializer { mid: 1, revision: 6, payload: <Buffer > }
OPEN-PROTOCOL 761: openProtocolSerializer _transform { mid: 1, revision: 6, payload: <Buffer > }
OPEN-PROTOCOL 761: openProtocolSerializer _transform publish <Buffer 30 30 32 30 30 30 30 31 30 30 36 30 30 31 30 31 30 30 30 30 00>
OPEN-PROTOCOL 761: LinkLayer _onDataOpSerializer <Buffer 30 30 32 30 30 30 30 31 30 30 36 30 30 31 30 31 30 30 30 30 00>
OPEN-PROTOCOL 761: LinkLayer _read 16
OPEN-PROTOCOL 761: LinkLayer _onDataStream <Buffer 30 30 32 36 30 30 30 34 30 30 31 30 30 30 30 30 30 30 30 30 30 30 30 31 39 37 00>
OPEN-PROTOCOL 761: OpenProtocolParser _transform <Buffer 30 30 32 36 30 30 30 34 30 30 31 30 30 30 30 30 30 30 30 30 30 30 30 31 39 37 00>
OPEN-PROTOCOL 761: LinkLayer _onDataOpParser {
  mid: 4,
  revision: 1,
  noAck: false,
  stationID: 1,
  spindleID: 1,
  sequenceNumber: 0,
  messageParts: 0,
  messageNumber: 0,
  payload: <Buffer 30 30 30 31 39 37>
}
OPEN-PROTOCOL 761: new MIDParser _transform {
  mid: 4,
  revision: 1,
  noAck: false,
  stationID: 1,
  spindleID: 1,
  sequenceNumber: 0,
  messageParts: 0,
  messageNumber: 0,
  payload: <Buffer 30 30 30 31 39 37>
}
OPEN-PROTOCOL 761: LinkLayer _onDataMidParser {
  mid: 4,
  revision: 1,
  noAck: false,
  stationID: 1,
  spindleID: 1,
  sequenceNumber: 0,
  messageParts: 0,
  messageNumber: 0,
  payload: { midNumber: 1, errorCode: 97 }
}
OPEN-PROTOCOL 761: SessionControlClient receivedReply {
  mid: 4,
  revision: 1,
  noAck: false,
  stationID: 1,
  spindleID: 1,
  sequenceNumber: 0,
  messageParts: 0,
  messageNumber: 0,
  payload: { midNumber: 1, errorCode: 97 }
}
OPEN-PROTOCOL 761: LinkLayer finishCycle undefined
OPEN-PROTOCOL 761: SessionControlClient sendMidOne
OPEN-PROTOCOL 761: LinkLayer _write { mid: 1, revision: 5 }
OPEN-PROTOCOL 761: MIDSerializer _transform { mid: 1, revision: 5 }
OPEN-PROTOCOL 761: LinkLayer _onDataMidSerializer { mid: 1, revision: 5, payload: <Buffer > }
OPEN-PROTOCOL 761: openProtocolSerializer _transform { mid: 1, revision: 5, payload: <Buffer > }
OPEN-PROTOCOL 761: openProtocolSerializer _transform publish <Buffer 30 30 32 30 30 30 30 31 30 30 35 30 30 31 30 31 30 30 30 30 00>
OPEN-PROTOCOL 761: LinkLayer _onDataOpSerializer <Buffer 30 30 32 30 30 30 30 31 30 30 35 30 30 31 30 31 30 30 30 30 00>
OPEN-PROTOCOL 761: LinkLayer _read 16
OPEN-PROTOCOL 761: SessionControlClient stream_close
OPEN-PROTOCOL 761: SessionControlClient close Error: Stream Close
    at Socket.<anonymous> (/mnt/c/Users/me1rjco/node_modules/node-open-protocol/src/sessionControlClient.js:217:24)
    at Socket.emit (events.js:315:20)
    at TCP.<anonymous> (net.js:673:12)
OPEN-PROTOCOL 761: LinkLayer _destroy
@ferm10n
Copy link
Contributor

ferm10n commented May 4, 2022

Reading your logs, I see:

  • integrator (you) send MID 1 with revision 6
  • controller (tool) replies MID 4 (NOK) with error code 97 (checking open protocol spec says this is "MID revision unsupported")
  • integrator retries with MID 1 revision 5

... but I guess the stream is already closed at this point by the tool?


I'm working with a Desoutter tool right now, and I have the same message sequence sent byte for byte (first try MID1 rev 6, then retry with rev 5) except they successfully negotiate using revision 5. So this might not be a node open protocol issue.

Still, you might be able to work around this by setting defaultRevisions to something your tool supports.

NOTE this doesn't seem to be well documented option, see how to use it here #5 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants