C API Samples: Difference between revisions

From wizarPOS
(Created page with "== Printer == The following code shows how to print some content: int result = PrinterInterface.open(); if (result <0){ return; } Bitmap bitmap = BitmapFactory.dec...")
 
No edit summary
 
(35 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Printer ==
== C API Samples ==
The following code shows how to print some content:
In order to use the [http://{{SERVERNAME}}/jniinterfaceapi/ C API interface] of the device, we provide some examples that you can download:
  int result = PrinterInterface.open();
{| class="wikitable"
  if (result <0){
|-
    return;
! Description & History !! Download
  }
|-
  Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(),
|  Includes all the devices API demo of the POS, Add printHtml for D3. || [http://ftp.wizarpos.com/device/c/apidemo_c_20201021.zip API demo 1.5.3.1]
                R.drawable.printer_barcode_low);
|-
  byte[] arryBeginText = null;
| 20190505 || [ftp://sdkuser:wizsdkar@ftp.wizarpos.com/device/c/apidemo_c_20201021.zip API demo 1.5.3]
  byte[] arryEndText = null;
|-
  try {
| Includes all the devices API demo of the POS, Add Tuzheng new fingerpirnt implement. || [http://ftp.wizarpos.com/device/c/apidemo_c_1.5.0.2.zip API demo 1.5.0.2]
    arryBeginText = mContext.getResources().getString(R.string.print_QR_code).getBytes("GB2312");
|-
    arryEndText = "This is a Bitmap of Barcode".getBytes("GB2312");
| Includes all the devices API demo of the POS || [http://ftp.wizarpos.com/device/c/apidemo_c_1.5.0.zip API demo 1.5.0]
  } catch (UnsupportedEncodingException e) {
|-
    e.printStackTrace();
| For printer api || [http://ftp.wizarpos.com/device/c/PrinterModelDemo.zip printer demo]
  }
|-
  int result = PrinterInterface.begin();
| A simple demo to simulate payment, includes MSR swipe, PINPAD input, printing || [http://ftp.wizarpos.com/device/c/MSRPrinterPinpadDemo-1.4.0.zip Simple demo for MSR, Printer, PINPAD]
  if (result <0){
|}
    return;
 
  }
We will update the API demo version regularly. You can download the latest version from here.
  result = PrinterInterface.write(arryBeginText, arryBeginText.length);
  if (result <0){
    return;
  }
  // print line break
  writeLineBreak(2);     
  PrinterBitmapUtil.printBitmap(bitmap, 0, 0, true);
  // print line break
  writeLineBreak(2);
  // print text
  write(arryEndText);
  // print line break
  writeLineBreak(2);
  result = PrinterInterface.end();
  if (result <0){
    return;
  }
PrinterInterface.close();

Latest revision as of 09:25, 30 July 2021

C API Samples

In order to use the C API interface of the device, we provide some examples that you can download:

Description & History Download
Includes all the devices API demo of the POS, Add printHtml for D3. API demo 1.5.3.1
20190505 API demo 1.5.3
Includes all the devices API demo of the POS, Add Tuzheng new fingerpirnt implement. API demo 1.5.0.2
Includes all the devices API demo of the POS API demo 1.5.0
For printer api printer demo
A simple demo to simulate payment, includes MSR swipe, PINPAD input, printing Simple demo for MSR, Printer, PINPAD

We will update the API demo version regularly. You can download the latest version from here.