Fix issues in network adapter and core getStatus(), getStatuses()#90
Fix issues in network adapter and core getStatus(), getStatuses()#90Xelio wants to merge 2 commits intonode-escpos:developfrom
Conversation
Xelio
commented
Apr 7, 2024
- core getStatus(): change buffer.write() to adapter.write(), buffer.write() does not send data to print immediately.
- core getStatuses(): change to retrieve status one by one, because network printer does not return all 4 status in the same read() operation.
- core: add error handling in getStatus() and getStatuses().
- network adapter open(): remove err from connectListener of .connect(), it does not have err param.
- network adapter read(): change .on() to .once(), callback should only run once for current read operation.
- network adapter: add read timeout. When read timeout, pass empty buffer to callback function.
- network adapter: add test of getStatus(), getStatuses().
- export StatusJSON, StatusJSONElement, StatusJSONElementSingle, StatusJSONElementMultiple
🦋 Changeset detectedLatest commit: 98606bd The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @dohooo, |
@Xelio Thanks for your effort, awesome work! But before I merge it, could you add a changeset for these changes? BTW, Can you add unit test for this PR. |
|
Looking forward to this release! Will probably fix many of the issues I am having, as I use Network printer for my main use-case. No rush, but add a changeset and unit test please? |
|
Hoping to see this merged soon! |
core: - core getStatus(): change buffer.write() to adapter.write(), becuase buffer.write() does not send data to print immediately. - core getStatuses(): change to retrieve status one by one, because network printer does not always return all 4 status in a single read() operation. - Export class StatusJSON, StatusJSONElement, StatusJSONElementSingle, StatusJSONElementMultiple - Add test for core getStatus() and getStatuses() network adapter: - network adapter open(): remove err from connectListener of .connect(), it's defination does not have err param. - network adapter read(): change .on() to .once(), using .on() will run previous callback again in next read() operation, which is not the expected behavior. - Add read timeout for network adapter. When timeout occur, it will pass empty buffer to callback function. - Add error handling in getStatus() and getStatuses(). - Add test of getStatus(), getStatuses() for network adapter.
68ff7b0 to
98606bd
Compare
|
Hi @dohooo , Tests and changeset added, please take a look, thanks! |
|
@dohooo, waiting for this one 🙏 |