C API Samples: Difference between revisions

From wizarPOS
No edit summary
No edit summary
 
(33 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== JNI Samples ==
== C API Samples ==
=== Printer ===
In order to use the [http://{{SERVERNAME}}/jniinterfaceapi/ C API interface] of the device, we provide some examples that you can download:
The following code shows how to print some content:
{| class="wikitable"
  int result = PrinterInterface.open();
|-
  if (result <0){
! Description & History !! Download
    return;
|-
  }
|  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]
  Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(),
|-
                R.drawable.printer_barcode_low);
| 20190505 || [ftp://sdkuser:wizsdkar@ftp.wizarpos.com/device/c/apidemo_c_20201021.zip API demo 1.5.3]
  byte[] arryBeginText = null;
|-
  byte[] arryEndText = null;
| 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]
  try {
|-
    arryBeginText = mContext.getResources().getString(R.string.print_QR_code).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]
    arryEndText = "This is a Bitmap of Barcode".getBytes("GB2312");
|-
  } catch (UnsupportedEncodingException e) {
| For printer api || [http://ftp.wizarpos.com/device/c/PrinterModelDemo.zip printer demo]
    e.printStackTrace();
|-
  }
| 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]
  int result = PrinterInterface.begin();
|}
  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();
=== Contactless card reader ===

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.