Closed vilelam closed 5 years ago
Hey @vilelam
you've started the server with the holding Buffer
let holding = Buffer.alloc(10000)
let server = new modbus.server.TCP(netServer, {
holding: holding
})
In that case jsmodbus fires a 'preReadHoldingRegisters' and a 'postReadHoldingRegisters' event to manipulate the holding buffers up front or do something after the request has been handled.
If you start the modbus server without a holding buffer the readHoldingRegisters event will be fired.
Thanks, @stefanpoeter.
Even if we start the server without the holding Buffer, it seems that the readHoldingRegisters event will not be fired because in the Modbuserver class constructor method we have the following code. Can I create a pull request with some minor contribution to the code documentation? I would like to be engaged in an open source project and I feel that I found a topic that I like :)
I'm working with ABB in Latin America and Leading our Software Presales Practice in both Central and South America. Not working as a programmer but passioned about Nodejs and IoT.
class ModbusServer extends EventEmitter {
constructor (options) {
super()
this._options = options || {}
this._coils = this._options.coils || Buffer.alloc(1024)
this._discrete = this._options.discrete || Buffer.alloc(1024)
this._holding = this._options.holding || Buffer.alloc(1024)
this._input = this._options.input || Buffer.alloc(1024)
}
Of course you can. But keep in mind to be compatible to the current API specification and of course write tests.
is there any guide I can follow? I will probably need to learn and gain some confidence first. I will try to start with some simple contribution, probably to the README documentation file
You can find a lot on the GitHub Help Site. Regarding the tests, just inspect the existing ones. Pull Requests do not hurt since I am the one who decides to merge them.
thanks, @stefanpoeter .
Hello, I'm creating a Modbus TCP Server with the following code and from a client, I'm connecting to the server and calling the readHoldingRegisters method; however, it seems that ModbusTCPServer is not yet developed to reply to readHoldingRegisters. Is that correct? Maybe I'm doing something wrong here, but it seems that the Server is never emitting the 'readHoldingRegisters' event.