Cleaner solution to the PrinterHost data send routine problem of embedded NULLs - use a special structure to hold the data string plus the length in bytes of the data.
This commit is contained in:
parent
5d8cdd9bea
commit
4c035b14f1
3 changed files with 20 additions and 9 deletions
|
@ -33,18 +33,18 @@
|
|||
/** Sends the given data directly to the printer via the data endpoints, for the sending of print commands in printer
|
||||
* languages accepted by the attached printer (e.g. PCL).
|
||||
*
|
||||
* \param[in] PrinterCommands Pointer to the input buffer containing the printer data to send
|
||||
* \param[in] PrinterCommands Pointer to a structure containing the commands and length of the data to send
|
||||
*
|
||||
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
|
||||
*/
|
||||
uint8_t Printer_SendData(char* PrinterCommands, uint16_t DataLength)
|
||||
uint8_t Printer_SendData(Printer_Data_t* PrinterCommands)
|
||||
{
|
||||
uint8_t ErrorCode;
|
||||
|
||||
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, DataLength)) != PIPE_RWSTREAM_NoError)
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands->Data, PrinterCommands->Length)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
Pipe_ClearOUT();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue