BIXOLON SRP-270 Reference Manual

BIXOLON SRP-270 Reference Manual

Linux sdk guide for pos/mobile printer
Hide thumbs Also See for SRP-270:

Advertisement

Linux SDK Reference Guide
POS/Mobile Printer
Rev. 1.00
SRP-S300
SRP-380/SRP-382
SRP-350plusIII/SRP-352plusIII
SRP-350III/SRP-352III
SRP-F310II/SRP-F312II
SRP-350IIOBE
SRP-330/SRP-330II
SRP-340
SRP-150
STP-103III
SPP-R200III/SPP-R200II
SPP-R210
SPP-R310/SPP-R300
SPP-R400
SRP-275III/SRP-270/SRP-280
http://www.bixolon.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SRP-270 and is the answer not in the manual?

Questions and answers

Summary of Contents for BIXOLON SRP-270

  • Page 1 Linux SDK Reference Guide POS/Mobile Printer SRP-S300 Rev. 1.00 SRP-380/SRP-382 SRP-350plusIII/SRP-352plusIII SRP-350III/SRP-352III SRP-F310II/SRP-F312II SRP-350IIOBE SRP-330/SRP-330II SRP-340 SRP-150 STP-103III SPP-R200III/SPP-R200II SPP-R210 SPP-R310/SPP-R300 SPP-R400 SRP-275III/SRP-270/SRP-280 http://www.bixolon.com...
  • Page 2: Table Of Contents

    POS/Mobile Printer ■ Table of Contents 1. About This Manual ......................3 1-1 Supported Kernel & Platforms ..................3 1-2 Supported Interfaces ....................3 2. Property .......................... 4 2-1 CharacterSet (LONG R/W) ..................4 2-2 International CharacterSet (LONG R/W) ..............5 2-3 State (LONG R) ......................
  • Page 3: About This Manual

    This SDK manual describes the contents of the library required to develop Linux OS application programs. At BIXOLON, we are constantly making improvements to the functions and quality of our products. The specifications and contents of this manual are subject to change without prior notice for this reason.
  • Page 4: Property

    POS/Mobile Printer 2. Property The constants used by the library are declared in bxlConst.c. The development environment is based on C. 2-1 CharacterSet (LONG R/W) This is the property for defining the printer's code page and set to BXL_CS_437 by default. The values can be set and read using SetCharSet() and GetCharSet().
  • Page 5: International Characterset (Long R/W)

    POS/Mobile Printer 2-2 International CharacterSet (LONG R/W) This is the property for defining International character Set and set to ICS_USA by default. The values can be set or read using SetInternationalChar() and GetInternationalChar(). The following International character Set can be used: Constant Value Description...
  • Page 6: State (Long R)

    POS/Mobile Printer 2-3 State (LONG R) This is the property that sets the printer status. It is read only and calls GetStatus() to read the printer status. The status value can be set in duplicate and each value can be checked using bitwise operation.
  • Page 7: Method

    The operation is successful. PORT_OPEN_ERROR The communication port cannot be opened. NO_CONNECTED_PRINTER -100 The printer is not connected. NO_BIXOLON_PRINTER -101 It is not a BIXOLON printer. * Example int ret; // USB ret = ConnectToPrinter(“USB:”); // Serial ret = ConnectToPrinter(“serial:115200”); // Parallel ret = ConnectToPrinter(“parallel”);...
  • Page 8: Disconnectprinter

    POS/Mobile Printer 3-2 DisconnectPrinter Disconnect the printer. void DisconnectPrinter() [Parameters] None [Return Values] None * Example ConnectToPrinter(………..); …… DisconnectPrinter(); Rev. 1.00 - 8 -...
  • Page 9: Initializeprinter

    POS/Mobile Printer 3-3 InitializePrinter Cancel the existing settings and initialize. int InitializePrinter() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. * Example …… InitializePrinter(); …… Rev. 1.00 - 9 -...
  • Page 10: Linefeed

    POS/Mobile Printer 3-4 LineFeed Line feed to the amount of the integer value set as a factor. int LineFeed (const unsigned int lineNum) [Parameters] * const unsigned int lineNum [in] Send the number of line feeding lines in an integer value as a factor. [Return Values] Constant Value...
  • Page 11: Setleftmargin

    POS/Mobile Printer 3-5 SetLeftMargin Set the left margin. int SetLeftMargin (long margin) [Parameters] * long margin [in] Margin size (0 ~ 65535) [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. BAD_ARGUMENT -117 Incorrect values have been entered. * Example ConnectToPrinter(………..);...
  • Page 12: Setupsidedown

    POS/Mobile Printer 3-6 SetUpsideDown Set the upside-down function. int SetUpsizeDown (bool upsideDown) [Parameters] * bool upsideDown [in] Enable/disable the upside-down function. [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. * Example ConnectToPrinter(………..); …… SetUpsideDown(true);...
  • Page 13: Partialcut

    POS/Mobile Printer 3-7 PartialCut Enable the partial cut function. int PartialCut() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. NOT_SUPPORT -124 The function is not supported. * Example ConnectToPrinter(………..); …… PartialCut(); ……...
  • Page 14: Opencashdrawer

    POS/Mobile Printer 3-8 OpenCashDrawer Open the cash drawer. int OpenCashDrawer (unsigned int milliSec) [Parameters] * unsigned int milliSec [in] Set the open signal length (0 ~ 255). [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. NOT_SUPPORT -124 The function is not supported.
  • Page 15: Printtext

    POS/Mobile Printer 3-9 PrintText Print texts. int PrintText(const char* text, const int alignment, const unsigned int attribute, const unsigned int textSize) [Parameters] * const char* text [in] String with null as a terminator. Send the text data to print. * const int alignment [in] Set the text alignment.
  • Page 16 [Return Values] Constant Value Description SUCCESS The function is successful. STATUS_ERROR -103 Not ready to print. WRITE_ERROR -300 Data transmission failed. * Example ConnectToPrinter(………..); …… PrintText("Bixolon Linux SDK Text.\n", ALIGNMENT_LEFT, ATTR_FONTTYPE_A, TS_HEIGHT_0 | TS_WIDTH_0); …… Rev. 1.00 - 16 -...
  • Page 17: Printtextw

    POS/Mobile Printer 3-10 PrintTextW Print 2Bytes texts. int PrintTextW(const char* text, const int alignment, const unsigned int attribute, const unsigned int textSize, const unsigned int codePage) [Parameters] * const char* text [in] String with null as a terminator. Send the text data to print. * const int alignment [in] Set the text alignment.
  • Page 18 POS/Mobile Printer Constant Value Description TS_HEIGHT_0 0x00 Set the height scale to x1. TS_HEIGHT_1 0x01 Set the height scale to x2. TS_HEIGHT_2 0x02 Set the height scale to x3. TS_HEIGHT_3 0x03 Set the height scale to x4. TS_HEIGHT_4 0x04 Set the height scale to x5. TS_HEIGHT_5 0x05 Set the height scale to x6.
  • Page 19: Printbarcode

    POS/Mobile Printer 3-11 PrintBarcode Print 1- and 2-dimensional barcodes. int PrintBarcode(const int barcodeType, const char* barcodeData, const barcodeInfo_s* barcodeInfo) [Parameters] * const int barcodeType [in] Set the barcode type. Defined in bxlConst.c. Barcode Value Description BARCODE_UPCA Print UPC-A barcode. BARCODE_UPCE Print UPC-E barcode.
  • Page 20 POS/Mobile Printer unsigned int mode [in] Send the model value when printing QR Code. Constant Value Description BARCODE_QR_MODEL1 Model 1 BARCODE_QR_MODEL2 Model 2 Send the mode value when printing Maxi Code. Constant Value Description BARCODE_MAXI_MODE2 Mode 2 BARCODE_MAXI_MODE3 Mode 3 BARCODE_MAXI_MODE4 Mode 4 Send the mode value when printing AZTEC.
  • Page 21 POS/Mobile Printer unsigned int alignment [in] Set the barcode alignment. Constant Value Description BXL_ALIGNMENT_LEFT Align to the left BXL_ALIGNMENT_CENTER Align to the center BXL_ALIGNMENT_RIGHT Align to the right unsigned int textPosition [in] Set the barcode data printing position. 2-dimensional barcode has only BXL_BC_TEXT_NONE .
  • Page 22 POS/Mobile Printer barcodeInfo.textPosition = BARCODE_TEXT_BELOW; PrintBarcode(BARCDE_EAN13, barcodeData, &barcodeInfo); barcodeInfo.height = 50; barcodeInfo.width = 2; barcodeInfo.textPosition = BARCODE_TEXT_BELOW; PrintBarcode(BARCDE_JAN13, barcodeData, &barcodeInfo); barcodeInfo.height = 50; barcodeInfo.width = 2; barcodeInfo.textPosition = BARCODE_TEXT_BELOW; PrintBarcode(BARCDE_EAN8, “12345678”, &barcodeInfo); barcodeInfo.height = 50; barcodeInfo.width = 2; barcodeInfo.textPosition = BARCODE_TEXT_BELOW; PrintBarcode(BARCDE_JAN8, “12345678”, &barcodeInfo);...
  • Page 23 POS/Mobile Printer barcodeInfo.width = 2; barcodeInfo.attribute = 0; PrintBarcode(BARCDE_QRCODE, barcodeData, &barcodeInfo); barcodeInfo.height = 0; barcodeInfo.width = 2; barcodeInfo.attribute = 0; PrintBarcode(BARCDE_DATAMATRIX, barcodeData, &barcodeInfo); barcodeInfo.mode = BARCODE_MAXI_MODE4; barcodeInfo.height = 0; barcodeInfo.width = 2; barcodeInfo.attribute = 0; PrintBarcode(BARCDE_MAXICODE, barcodeData, &barcodeInfo); Rev. 1.00 - 23 -...
  • Page 24: Directio

    POS/Mobile Printer 3-12 DirectIO Send and read the user-defined data. int DirectIO(char* writeData, int writeLen, char* readData, int* readLen, unsigned int mTimeout) [Parameters] * char* writeData, [in] Data to be sent to the printer * int writeLen [in] Size of data to be sent to the printer write does not function if 0 is entered to writeData for NULL, writeLen.
  • Page 25: Printimage

    POS/Mobile Printer 3-13 PrintImage Print image files. int PrintImage (const char *imagePath, const bool compress, const unsigned int alignment) [Parameters] * const char *imagePath [in] String for the image file path. JPG, BMP and GIF are supported. * const bool compress [in] Set whether to compress RLE image.
  • Page 26: Downloadnvimage

    POS/Mobile Printer 3-14 DownloadNVImage Save images to the non-volatile memory area of the printer. int DownloadNVImage (const char *imagePath, const unsigned int keyCode) [Parameters] * const char *imagePath [in] String for the image file path. JPG, BMP and GIF are supported. * const unsigned int keyCode [in] Address of the memory area where image is stored (0 ~ 255).
  • Page 27: Printnvimage

    POS/Mobile Printer 3-15 PrintNVImage Print the images stored in the non-volatile memory area of the printer. int PrintNVImage (const unsigned int keyCode) [Parameters] * const unsigned int keyCode [in] Address code of the image to be printed (0 ~ 255) [Return Values] Constant Value...
  • Page 28: Removeallnvimage

    POS/Mobile Printer 3-16 RemoveAllNVImage Remove all the images stored in the non-volatile memory area of the printer. int RemoveAllNVImage () [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. NOT_SUPPORT -124 The function is not supported. * Example ConnectToPrinter(………..);...
  • Page 29: Removenvimage

    POS/Mobile Printer 3-17 RemoveNVImage Remove all the images with the specified address stored in the non-volatile memory area of the printer. int RemoveNVImage (const unsigned int keyCode) [Parameters] * const unsigned int keyCode [in] Address code of the image to be printed (0 ~ 255) [Return Values] Constant Value...
  • Page 30: Getnvimagekeycode

    POS/Mobile Printer 3-18 GetNVImageKeyCode Read the address list of the images stored in the non-volatile memory area of the printer. int GetNVImageKeyCode (char *keyCodeList, unsigned int *listLen) [Parameters] * char *keyCodeList [in, out] Buffer to save the list of image address * unsinged int *listLen [in, out] Length of keyCodeList [Return Values]...
  • Page 31: Setautostatuscheck

    POS/Mobile Printer 3-19 SetAutoStatusCheck Enable/disable ASB mode to check the printer status (cover open, no paper). int SetAutoStatusCheck(bool enable) [Parameters] * bool enable [in] Enable/disable ASB mode. [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. * Example int status = 0x00;...
  • Page 32: Getstatus

    POS/Mobile Printer 3-20 GetStatus Read the printer status (cover open, no paper). int GetStatus() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. READ_TIMEOUT -127 No status data * Example int status = 0x00; ConnectToPrinter(………..); SetAutoStatusCheck(true); …... status = GetStatus();...
  • Page 33: Selectmode

    POS/Mobile Printer 3-21 SelectMode Select Label/Receipt Mode. Only mobile printers are supported. int SelectMode(bool labelMode) [Parameters] * bool labelMode [in] Send whether to use Label Mode. If the value is TRUE, the label mode is selected. [Return Values] Constant Value Description SUCCESS The function is successful.
  • Page 34: Nextprintpos

    POS/Mobile Printer 3-22 NextPrintPos Feed the paper to the starting point of the next label paper. The function is only enabled if the mobile printer is set to label mode. int NextPrintPos() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful.
  • Page 35: Autocalibration

    POS/Mobile Printer 3-23 AutoCalibration Perform Auto Calibration if set to Label Mode. The function is only enabled if the mobile printer is set to label mode. int AutoCalibration() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed.
  • Page 36: Selectpagemode

    POS/Mobile Printer 3-24 SelectPageMode Enable/disable Page Mode. int SelectPageMode(bool pageMode) [Parameters] * bool pageMode [in] Set whether to use Page Mode. Page Mode is selected if set to TRUE. [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed.
  • Page 37: Printdatainpm

    POS/Mobile Printer 3-25 PrintDataInPM Prints all the data in the printer buffer if set to Page Mode and the printer is switched to Standard Mode after printing. int PrintDataInPM() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed.
  • Page 38: Setprintareainpm

    POS/Mobile Printer 3-26 SetPrintAreaInPM Sets the size and position of the printing area when set to Page Mode. int SetPrintAreaInPM (long x, Iong y, Iong width, Iong height) [Parameters] * Iong x [in] x-coordinates of the printing area * Iong y [in] y-coordinates of the printing area * Iong width [in] width of the printing area...
  • Page 39: Setprintdirectioninpm

    POS/Mobile Printer 3-27 SetPrintDirectionInPM Set the printing direction in the Page Mode. int SetPrintDirectionInPM (int printDirection) [Parameters] * int printDirection printDirection Value Direction Starting Position Rotation PAGEMODE_ROTATE_0 Left -> Right Top left 0 degree PAGEMODE_ROTATE_90 Top -> Bottom Top right 90 degrees PAGEMODE_ROTATE_180 Right ->...
  • Page 40: Setverticalpositioninpm

    The function is not supported. * Example ConnectToPrinter(………..); …… // Select Page Mode if (SelectPageMode(true) != SUCCESS) return; SetPrintAreaInPM(0, 0, 416, 416); SetPrintDirectionInPM(PAGEMODE_ROTATE_90); SetVerticalPositionInPM(160, false); SetHorizontalPositionInPM(40); PrintText(“Bixolon Printer.”, ALIGNMENT_CENTER, ATTR_FONTTYPE_A, TS_WIDTH_0 | TS_HEIGHT_0); …… PrintDataInPM(); Rev. 1.00 - 40 -...
  • Page 41: Sethorizontalpositioninpm

    The function is not supported. * Example ConnectToPrinter(………..); …… // Select Page Mode if (SelectPageMode(true) != SUCCESS) return; SetPrintAreaInPM(0, 0, 416, 416); SetPrintDirectionInPM(PAGEMODE_ROTATE_90); SetVerticalPositionInPM(160, false); SetHorizontalPositionInPM(40, false); PrintText(“Bixolon Printer.”, ALIGNMENT_CENTER, ATTR_FONTTYPE_A, TS_WIDTH_0 | TS_HEIGHT_0); …… PrintDataInPM(); Rev. 1.00 - 41 -...
  • Page 42: Readstartmsr

    POS/Mobile Printer 3-30 ReadStartMSR Switch the printer status to MSR Ready. If it returns SUCCESS, it is identified as normal. Only mobile printers are supported. long ReadStartMSR() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. NOT_SUPPORT -124 MSR function is not supported.
  • Page 43: Readcancelmsr

    POS/Mobile Printer 3-31 ReadCancelMSR Disable the MSR Ready status. Only mobile printers are supported. long ReadCancelMSR() [Parameters] None [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed. NOT_SUPPORT -124 MSR function is not supported. * Example ConnectToPrinter(………..);...
  • Page 44: Readmsrdata

    POS/Mobile Printer 3-32 ReadMSRData Read the MSR data. When the data is read, it returns the data value otherwise the read mode can be canceled using ReadCancelMSR. Only mobile printers are supported. long ReadMSRData(char *pMSRData1, char *pMSRData2, char *pMSRData3, const unsigned int bufLen) [Parameters] * char *pMSRData1 [out] Read MSR Data Track 1 to the buffer defined by the caller.
  • Page 45: Scrpowerup

    POS/Mobile Printer 3-33 ScrPowerUp Turn on the SCR. This function is only available on SPP-R210 SCR. long ScrPowerUp(char *pATR, unsigned int *ATRLen, char *pResponse) [Parameters] * char *pATR [in, out] ATR(Answer To Reset) data * unsigned int *ATRLen [in, out] ATR data length * char *pResponse [in, out] Response to power up [Return Values]...
  • Page 46: Scrpowerdown

    POS/Mobile Printer 3-34 ScrPowerDown Turn off the SCR. This function is only available on SPP-R210 SCR. long ScrPowerDown(char *pResponse); [Parameters] * char *pResponse [in, out] Response to power up [Return Values] Constant Value Description SUCCESS The function is successful. WRITE_ERROR -105 Data transmission failed.
  • Page 47: Scroperationmode

    POS/Mobile Printer 3-35 ScrOperationMode Set the operation mode. This function is only available on SPP-R210 SCR. long ScrOperationMode(uint mode, char *pResponse); [Parameters] * UINT mode [in] Operating mode. Constant Value Description SCR_MODE_APDU APDU mode SCR_MODE_TPDU TPDU mode * char *pResponse [in, out] Response to power up [Return Values] Constant...
  • Page 48: Screxchangeapdu

    POS/Mobile Printer 3-36 ScrExchangeAPDU Enable APDU/TPDU data communication. This function is only available on SPP-R210 SCR. long ScrExchangeAPDU (const char *APDUCmd, unsigned int APDULen, char *APDURsp, unsigned int *APDURspLen, char *pResponse); [Parameters] * const char *APDUCmd [in] APDU data command * unsigned int APDULen [in] APDU command length * char *APDURsp...
  • Page 49: Scrcheckstatus

    POS/Mobile Printer 3-37 ScrCheckStatus Check the smart card status. This function is only available on SPP-R210 SCR. long ScrCheckStatus (char *status, char *pResponse); [Parameters] * char *status [in, out] Smart card status data * char *pResponse [in, out] Response to the command [Return Values] Constant Value...
  • Page 50: Scrselectcard

    POS/Mobile Printer 3-38 ScrSelectCard Select Smart card, SAM1 and SAM2 for communication. This function is only available on SPP-R210 SCR. long ScrSelectCard (uint card, char *pResponse); [Parameters] * UINT card [in] Smart card for communication Constant Value Description SCR_SMARTCARD Set Smart card for communication. SCR_SAM1 Set SAM1 for communication.

Table of Contents