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

Usage of isDebugEnabled to check the PDU raw data #534

Open
Liviu-Ionel-Anton opened this issue Dec 5, 2023 · 3 comments
Open

Usage of isDebugEnabled to check the PDU raw data #534

Liviu-Ionel-Anton opened this issue Dec 5, 2023 · 3 comments

Comments

@Liviu-Ionel-Anton
Copy link

How can I use isDebugEnabled to check the raw data? I see that isDebugEnabled is not exposed by the ModbusRTU class.

@yaacov
Copy link
Owner

yaacov commented Dec 5, 2023

Thank you for the issue.

isDebugEnabled is defined here:
https://github.com/yaacov/node-modbus-serial/blob/master/index.js#L623-L630

an example of use, can be found here:
https://github.com/yaacov/node-modbus-serial/blob/master/test/test.js#L301-L315

request is defined when using isDebugEnabled

can you make a pull request adding an example using isDebugEnabled ?
see other examples in: https://github.com/yaacov/node-modbus-serial/tree/master/examples

i am also adding a "help needed" in case some one have exprience using isDebugEnabled and can help with use cases.

@Liviu-Ionel-Anton
Copy link
Author

Hi!

I'm using node.js v18.17.1 and typescript for the project.
I have something like this:

import ModbusRTU from "modbus-serial";

tcpPortOptions = {
  ip: "127.0.0.1",
  port: 502,
  timeout: 500
};

const device: ModbusRTU = new ModbusRTU()
await device.connectTCP("127.0.0.1", tcpPortOptions);

device.isDebugEnabled = true;

I get : error TS2339: Property 'isDebugEnabled' does not exist on type 'ModbusRTU'.

When I checked the definition of ModbusRTU it leads to ModbusRTU.d.ts file where isDebugEnabled is not defined.

Any help will be appreciated.

@yaacov
Copy link
Owner

yaacov commented Dec 6, 2023

@Liviu-Ionel-Anton hi, thank you for the followup, did you try addingthe pProperty 'isDebugEnabled' on type 'ModbusRTU to ModbusRTU.d.ts ?

did it help ?
if it did, can you make a pull request with the fix ?

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

No branches or pull requests

2 participants