-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add debugging payload information to response data. (#349)
* WC-2981: index.js: Expose isDebugEnabled property. This will be used to turn on/off the gathering of raw request/response data from the Modbus interface. By default, this is turned off. * WC-2981: index.js: Add Modbus/RTU payload request/responses If debugging is enabled, add the request and response data to any and all response data or errors. Responses: - `request`: A `Buffer` containing the request PDU (Modbus/RTU format) - `responses` an `Array` of `Buffer` objects containing the responses seen. Exception properties: - `modbusRequest`: A `Buffer` containing the request PDU (Modbus/RTU format) - `modbusResponses` an `Array` of `Buffer` objects containing the responses seen. * WC-2981: index.js: Do write _after_ processing transaction In the test suites, we're using a dummy port that operates synchronously. This fails when we're testing debug mode because this routine is responsible for creating the `request` and `response` properties on the transaction. So instead, move the write call. This still passes tests, and I'd expect it to make bugger all difference in production. (If `_startTimeout` is taking long periods of time, then you have other problems.) * WC-2981: unit tests: Test debug payload pass-through. Test that, if enabled, the debug data gets passed through in the happy and unhappy paths. Since the code is common to all function code routines, we don't bother testing for every single one.
- Loading branch information
1 parent
1d593c0
commit 781ea7e
Showing
2 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters