Implementing CITAQ V8 with POS Device .

Posted in: Blog

CITAQ V8 is an embedded touch-screen POS machine designed for O2O mobile internet. It supports LAN, WIFI, 3G under Android OS and enables transmission of data to cloud servers. It realizes intelligent HCI by an 8-inch multi-touch screen with 1024×768 resolutions. Its high speed 80mm thermal printer prints receipts, rapidly. This unit has special protection design to resist water and oil. Its interfaces enable peripherals such as scanner, customer display, cashbox, mouse, MSR and RFID reader.

One of Appdev360’s clients required CITAQ V8 to be implemented with his POS device. Appdev360 engineers encountered the following issues during its implementation:

Problem 1: The USB port on the device did not work for debugging.

Problem2: Communication with the Printer was not enabled irregular. They had to enable it via built-in android tablet using the CITAQ library.

Appdev360 engineers conducted a thorough research to understand the working of CITAQ V8 and came up with the following solutions of problems mentioned above:

Solution (Problem 1):
They opened the device and split its parts to separate it from the tablet and found a mini USB port. They then plugged the cable permanently to connect the device for debugging.

Solution (Problem 2):
They complied and integrated the SO files, provided by the client,  into the project. After which they read the serial port parameters using the following code:

/* Read serial port parameters */
SharedPreferences sp = getSharedPreferences("android_serialport_api.sample_preferences", MODE_PRIVATE);
String path = sp.getString("DEVICE", "");
int baudrate = Integer.decode(sp.getString("BAUDRATE", "-1"));

/* Check parameters */
if ( (path.length() == 0) || (baudrate == -1)) {
    throw new InvalidParameterException();

They checked the access for opening the serial port by inserting the following code:

/* Check access permission */
if (!device.canRead() || !device.canWrite()) {
try {
/* Missing read/write permission, trying to chmod the file */
Process su;
su = Runtime.getRuntime().exec("/system/bin/su");
String cmd = "chmod 666 " + device.getAbsolutePath() + "\n"
+ "exit\n";
if ((su.waitFor() != 0) || !device.canRead()
|| !device.canWrite()) {
throw new SecurityException();
} catch (Exception e) {
throw new SecurityException();

mFd = open(device.getAbsolutePath(), baudrate, flags, flowCon);
if (mFd == null) {
Log.e(TAG, "native open returns null");
throw new IOException();
mFileInputStream = new FileInputStream(mFd);
mFileOutputStream = new FileOutputStream(mFd);

After communicating with the printer, they printed a text using the device library that worked with the byte code format.

Leave a Reply

Your email address will not be published. Required fields are marked *