(address, value)
| 124 | |
| 125 | // Protocol encoders (pure helpers, always available). |
| 126 | function modbusWriteRegister(address, value) { |
| 127 | var a = address & 0xFFFF, v = Math.round(value) & 0xFFFF; |
| 128 | return String.fromCharCode((a >> 8) & 0xFF, a & 0xFF, (v >> 8) & 0xFF, v & 0xFF); |
| 129 | } |
| 130 | function modbusWriteCoil(address, on) { |
| 131 | return modbusWriteRegister(address, on ? 0xFF00 : 0x0000); |
| 132 | } |
no test coverage detected