SCE-Development/Quasar

Add support for page range from Core-v4

Closed this issue · 1 comments

Part of the printing page includes an input for page ranges. As of now, our backend the push a message to SQS for printing doesn't include page range (see Core-v4/api/peripheral_api/routes/Printer.js:48)

How to fix this (at a high level)

This involves three parts:

  1. pushing page range to SQS from Core-v4, it should already be passed to the backend and accessible via req.body.pageRanges in the above link.
  2. Reading data from SQS on the Quasar side. For printing we do this in printer/PrintHandler.js:46. You just need to extract the field for page ranges from SQS, the name of the field is up to you.
  3. Adding support for page ranges in the lp command. The actual command is on printer/PrintHandler.js:60.

Ideal workflow

  1. Start by console logging req.body in the backend. Do we get the value that we specified from the frontend? If so, merely add it to the SQS queue under a field name of your choice and we can move on.
  2. Next, run Quasar to read from SQS, console log orderData. do we get the field passed from core-v4? if so, next step!!
  3. insert the page range into the lp command, i believe it is -o page-range. We may need to be in the room to test this tough.

If there is anything confusing about how printing works, read this wiki page.

Shoutout to @jerrylee17 for coming up with a function to parse this input to be used in the backend for printing (Core-v4/src/APIFunctions/2DPrinting.js:44)!