0% found this document useful (0 votes)
210 views16 pages

Android UHF Interface User Manual

This document provides a manual for using an Android UHF interface. It describes a UHFService class that provides functions for controlling a UHF device, including turning it on/off, reading temperature and power levels, reading and writing tag data, and registering callback functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
210 views16 pages

Android UHF Interface User Manual

This document provides a manual for using an Android UHF interface. It describes a UHFService class that provides functions for controlling a UHF device, including turning it on/off, reading temperature and power levels, reading and writing tag data, and registering callback functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Android UHF Interface

User Manual

www.seuic.com

Jiangsu SUEIC Technology Co.Ltd 1st


Content
Abstract ......................................................................................................................................... 4th
Hardware platform ................................................................................................................ 4th
Software platform ................................................................................................................. 4th
Object oriented ..................................................................................................................... 4th
Quote method ....................................................................................................................... 4th
UHF Interface ................................................................................................................................ 5th
UHFService class.................................................................................................................... 5th
Using method ................................................................................................................ 5th
Function interface ......................................................................................................... 5th
1. Switch UHF on ............................................................................................... 6th
2. Switch UHF off ............................................................................................... 6th
3. Whether UHF is turned on ............................................................................ 6th
4. Get the firmware version number................................................................. 7th
5. Get the temperature ..................................................................................... 7th
6. Get the power ............................................................................................... 7th
7. Set the power ................................................................................................ 7th
8. Get field ......................................................................................................... 7th
9. Set field ......................................................................................................... 8th
10. Singe tag reading ........................................................................................... 8th
11. Start continuous tag reading ........................................................................ 8th
12. Stop start tag reading ................................................................................... 8th
13. Get the quantity of the continuous tags reading ......................................... 8th
14. Get the continuous tag reading ID ............................................................... 9th
15. Read the label............................................................................................... 9th
16. Write the label ............................................................................................ 10th
17. Block write the label................................................................................... 11th
18. Block erase the label .................................................................................. 12th
19. Lock label .................................................................................................. 13rd
20. Destroy label ............................................................................................. 13rd
21. Set parameters.......................................................................................... 13rd
22. Set the parameter bytes (supported by new modules). ........................... 13rd
23. Read the LED label .................................................................................... 13rd
24. Read the temperature label ...................................................................... 14th
25. Callback functions ..................................................................................... 14th
26. Register the callback function................................................................... 15th
27. Unload the callback function .................................................................... 15th

Jiangsu SUEIC Technology Co.Ltd 2nd


EPC class .............................................................................................................................. 16th
Class member variable ................................................................................................ 16th
Using method .............................................................................................................. 16th
Function interface ....................................................................................................... 16th
1. Get the ID data from EPC oriented object ................................................... 16th
2. Match the ID number .................................................................................. 16th
3. Get additional data (new module support)................................................. 16th

Jiangsu SUEIC Technology Co.Ltd 3rd


Abstract
This document is created to provide the users the manual for the interface related to D500 device,
to help them better use the special functions of the terminal product.

Hardware platform

SDK is applicable to the devices listed below:


⚫ UTouch

Without further limits definition in functional interface instruction, it’s using range shall be
redeemed as applicable to all.

Software platform

SDK is based on Android 4.4, and it supports the eclipse development tool and Android studio.

Object oriented

It’s designed for the developers who would like to use UHF module besides the Android standard
functions.

Quote method

1. Take Eclipse for example, right click Program, then Properties, Java Build Path, Libraries, Add
External JARs, select uhf.jar.

Jiangsu SUEIC Technology Co.Ltd 4th


2. AndroidManifest.xml uses uses-library to ID the uhf.jar is quoted package.
<application
……
<uses-library
android:name="com.seuic.uhf" />
……
</application>

UHF Interface
Package name com.seuic.uhf
Package file uhf.jar
System package Yes
Class UHFService
Function Provide the control interface related to UHF

UHFService class

Using method

import com.seuic.uhf.UHFService;
UHFService mDevice = UHFService.getInstance();

If you want the system UHFDemo service to exit, use the getInstance interface with parameters.
UHFService mDevice = UHFService.getInstance(Context context);

Note: The UHF module will be powered off when the system sleeps, so you need to call the close
interface before the system sleeps, and call the open interface to reopen the module after the
system wakes up.

Function interface

Function Specification
open Switch UHF on
close Switch UHF off
isOpen Whether UHF is turned on
getFirmwareVersion Get the firmware version number
getTemperature Get the temperature
getPower Get the power
setPower Set the power
getRegion Get field
setRegion Set field

Jiangsu SUEIC Technology Co.Ltd 5th


inventoryOnce Singe tag reading
inventoryStart Start continuous tag reading
inventoryStop Stop continuous tag reading
getTagIDCount Get the quantity of the continuous tags reading
getTagIDs Get the continuous tag reading ID
readTagData Read the label
writeTagData Write the label
blockWriteTagData Block write the label
blockEraseTagData Block erase the label
killTag Destroy the label
setParameters Set parameters
setParamBytes Set the parameter bytes
readTagLED Read the LED label
readTagTemperature Read the temperature label
registerReadTags Register the callback function
unregisterReadTags Unload the callback function
startFindTag Start find tag functions
stopFindTag Stop find tag functions
setFindTagListenner find tag interface Callback interface

1. Switch UHF on
boolean open ()
Parameters
non
Return value
boolean; true for success and false for failure

2. Switch UHF off


void close ()
Parameters
Non
Return value
non

3. Whether UHF is turned on


boolean isOpen ()
parameter
non
Return value

Jiangsu SUEIC Technology Co.Ltd 6th


boolean; true: on, false: off

4. Get the firmware version number


String getFirmwareVersion ()
Parameters
non
Return value
String: not null for success and null for failure

5. Get the temperature


String getTemperature ()
Parameters
non
Return value
String: not null for success and null for failure (℃)

6. Get the power


int getPower ()
Parameters
non
Return value
int; not-o for success and 0 for failure (0~30 dBm)

7. Set the power


boolean setPower (int power)
Parameters
power
Set the power as (0~30 dBm)
Return value
boolean; true for success and false for failure

8. Get field
String getRegion ()
Parameters
non
Return value
String; non blank for success and null for failure
Range value including:”FCC” , ”ETSI”, ”China1” , ”China2”

Jiangsu SUEIC Technology Co.Ltd 7th


9. Set field
boolean setRegion (String region)
Parameters
region
Range value including:”FCC” , ”ETSI”
Return value
boolean; true for success and false for failure

10. Singe tag reading


boolean inventoryOnce(EPC epc, int timeout)
Parameters
epc
EPC class oriented object
timeout
Order time out (0~500 ms)
Return value
boolean; true for success and false for failure
shown:
EPC epc = new EPC();
boolean result = mService.inventoryOnce(epc, 100);

11. Start continuous tag reading


boolean inventoryStart ()
Parameters
non
Return value
boolean; true for success and false for failure
Note: Obtain the search data through getTagIDs and pair it with the inventoryStop() interface.
shown:
boolean result = mService.inventoryStart();

12. Stop start tag reading


boolean inventoryStop ()
Parameters
non
Return value
boolean; true for success and false for failure
shown:
Boolean result = mService.inventoryStop();

13. Get the quantity of the continuous tags reading

Jiangsu SUEIC Technology Co.Ltd 8th


int getTagIDCount ()
Parameters
non
Return value
int; non-0 for the quantity of the labels got, and 0 for noting getting any label

14. Get the continuous tag reading ID


List<EPC> getTagIDs ()
Parameters
non
Return value
List<EPC>; The List collection of all EPC oriented objects
Note: The returned List collection has been reprocessed.
shown:
List<EPC> mAllEpcs = new ArrayList<EPC>();
class InventoryThread extends Thread {
@Override
public void run() {
while (mInventoryStart) {
try {
sleep(100);
mAllEpcs = mService.getTagIDs();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

15. Read the label


boolean readTagData (byte[] Epc, byte[] PassWord, int Bank, int Offset ,int Len, byte[] Data)
Parameters
Epc
The ID of the tag (PC+EPC) // Please use the getId() method of the EPC to get the epc
PassWord
Visit password (length as 4 bytes)
Bank
Label saving area(0 for password,1 for EPC, 2 for TID and 3 for users)
Offset
Starting address (unit as byte)
Len
the length to read, with unit as byte

Jiangsu SUEIC Technology Co.Ltd 9th


Data
save the data to be read in the label
Return value
boolean; true for success and false for failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
byte[] data = new byte[256];
boolean result = mService.readTagData(getHexByteArray(epcID),
getHexByteArray(psw),
Integer.parseInt(bank),
Integer.parseInt(offset),
Integer.parseInt(len), data);

/**
* String to hexadecimal array
*/
public static byte[] getHexByteArray(String hexString) {
byte[] buffer = new byte[hexString.length() / 2];
if (hexString == null || hexString.equals("")) {
return null;
}
hexString = hexString.toUpperCase();
int length = hexString.length() / 2;
char[] hexChars = hexString.toCharArray();
for (int i = 0; i < length; i++) {
int pos = i * 2;
buffer[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
return buffer;
}

16. Write the label


boolean writeTagData (byte[] Epc, byte[] PassWord, int Bank, int Offset ,int Len, byte[] Data)
Parameters
Epc
Label ID(PC+EPC)// Please use the getId() method of the EPC to get the epc
PassWord
Visit password (length as 4 bytes)
Bank
Label saving area(0 for password,1 for EPC, 2 for TI and 3 for users)
Offset

Jiangsu SUEIC Technology Co.Ltd 10th


Starting address (unit as byte)
Len
the length to write, with unit as byte
Data
save the data to be written into the label
Return value
boolean; true for success and false for failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
String data = “11223344”;
boolean result = mService.writeTagData(getHexByteArray(epcID),
getHexByteArray(psw),
Integer.parseInt(bank),
Integer.parseInt(offset),
Integer.parseInt(len),
getHexByteArray(data))

17. Block write the label


boolean blockWriteTagData (byte[] Epc, byte[] PassWord, int Bank, int Offset ,int Len, byte[]
Data)
Parameters
Epc
Label ID(PC+EPC)Please use the getId() method of the EPC to get the epc
PassWord
Visit password (length as 4 bytes)
Bank
Label saving area(0 for password,1 for EPC, 2 for TI and 3 for users)
Offset
Starting address (unit as byte)
Len
The length to write, with unit as byte
Data
save the data to be written into the label
Return value
boolean; true for success and false for failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
String data = “11223344”;
boolean result = mService.blockWriteTagData(getHexByteArray(epcID),
getHexByteArray(psw),
Integer.parseInt(bank),

Jiangsu SUEIC Technology Co.Ltd 11th


Integer.parseInt(offset),
Integer.parseInt(len),
getHexByteArray(data))

18. Block erase the label


boolean blockEraseTagData (byte[] Epc, byte[] PassWord, int Bank, int Offset ,int Len)
Parameters
Epc
Label ID(PC+EPC)//Please use the getId() method of the EPC to get the epc
PassWord
Visit password (length as 4 bytes)
Bank
Label saving area(0 for password,1 for EPC, 2 for TI and 3 for users)
Offset
Starting address (unit as byte)
Len
The length to erase, with unit as byte
Return value
boolean; true for success and false for failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
boolean result = mService.blockEraseTagData(getHexByteArray(epcID),
getHexByteArray(psw),
Integer.parseInt(bank),
Integer.parseInt(offset),
Integer.parseInt(len))

19. Lock label


boolean lockTag(byte[] Epc, byte[] PassWord, int Flag)
parameter
Epc
ID of the tag (PC+EPC) //Please use the getId() method of EPC to get the epc
PassWord
Access password (4 bytes long).
Flag
0,1,2,3 unlock the tag (0: password area 1: EPC area 2: TI area 3: user area).
10, 11, 12, 13 lock tags (10: password area 11: EPC area 12: TI area 13: user area).
20, 21, 22, 23 Permanent lock tag (20: password area 21: EPC area 22: TI area 23: user
area).
Return value
boolean; true: succeeded, false: failed
shown:

Jiangsu SUEIC Technology Co.Ltd 12th


String epcID = “1122334455667788”;
String psw = “12345678”;
mLockFlag = 13;//Lock the user area
boolean result = mService.lockTag(getHexByteArray(epcID),
getHexByteArray(psw),
mLockFlag)

20. Destroy the label


boolean killTag(byte[] Epc, byte[] KillPwd)
parameter
Epc
ID of the tag (PC+EPC) //Please use the getId() method of EPC to get the epc
KillPwd
Destroy password (4 bytes long) (destroy password must be non-0).
Return value
boolean; true: success, false: failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
boolean result = mService.killTag(getHexByteArray(epcID),
getHexByteArray(psw))

21. Set parameters


boolean setParameters(int id, int value)
parameter
Parameter description reference document: Android UHF setParameters interface instruction
manual .doc
Return value
boolean; true: success, false: failure
shown:
int setsession = 1;
mService.setParameters(UHFService.PARAMETER_INVENTORY_SESSION, setsession);

22. Set parameter bytes (supported by new modules)


boolean setParamBytes(int id, byte[] value)
parameter
Parameter description reference document: Android UHF setParameters interface instruction
manual .doc
Return value
boolean; true: success, false: failure

23. Read the LED label


boolean readTagLED(byte[] Epc, byte[] PassWord, int Manufacturer)

Jiangsu SUEIC Technology Co.Ltd 13th


parameter
Epc
The ID of the tag (PC+EPC) (set null if not specified) is obtained using the getId() method
of EPC epc
PassWord
Access password (4 bytes in length, null by default if no password).
Manufacturer
The manufacturer of the label (1: Yi Chain ).
Return value
boolean; true: success, false: failure
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
mService.readTagLED(BaseUtil.getHexByteArray(epcID), psw, 1);

24. Read the temperature label


double readTagTemperature(byte[] Epc, byte[] PassWord, int Manufacturer)
parameter
Epc
The ID of the tag (PC+EPC) (set null if not specified) is obtained using the getId() method
of EPC epc
PassWord
Access password (4 bytes in length, null by default if no password).
Manufacturer
The manufacturer of the label (1: Yilian, 2: Yuehe).
Return value
double; -100: Failed (°C).
shown:
String epcID = “1122334455667788”;
String psw = “12345678”;
mService.readTagTemperature(BaseUtil.getHexByteArray(epcID), psw, 1);

25. Callback functions


interface IReadTagsListener{
void tagsRead(List<EPC> epclist);
}
parameter
epclist
The list of EPC collections, which returns the latest stored tag EPC.
Return value
non
Example:

Jiangsu SUEIC Technology Co.Ltd 14th


private IReadTagsListener mIReadTagsListener = new IReadTagsListener(){
@Override
public void tagsRead(List<EPC> epcList){
mEPCList.addAll(epcList);
}
};

26. Register the callback function


void registerReadTags (IReadTagsListener listener)
parameter
listener
To implement the IReadTagsListener interface, you need to implement the tagsRead
interface.
Return value
non
Example:
mService.registerReadTags(mIReadTagsListener);

27. Unload the callback function


void unregisterReadTags (IReadTagsListener listener)
parameter
listener
The object when registerReadTags is called.
Return value
non
Example:
mService.unregisterReadTags(mIReadTagsListener);

28. Start find tag interface


void startFindTag(String epcId)

29. Stop find label interface


void stopFindTag()

30. find tag interface Callback interface

void setFindTagListenner(UhfDevice.FindTagListenner findTagListenner)

Jiangsu SUEIC Technology Co.Ltd 15th


EPC class

Class member variable

byte[] id;
int len;
int rssi;
int count;

Using method

import com.seuic.uhf.EPC;
EPC epc = new EPC();

Function interface

1. Get the ID data from EPC oriented object


String getId()
Parameters
non
Return value
String; a hexadecimal string

2. Match the ID number


boolean equals(Object obj)
Parameters
EPC oriented object
Return value
boolean; true for success and false for failure

3. Get additional data (new module support)


String getEmbeded()
parameter
not
Return value
String; A string of hexadecimal representations

Jiangsu SUEIC Technology Co.Ltd 16th

You might also like