Skip to content

Commit

Permalink
Update Android SDK
Browse files Browse the repository at this point in the history
Add new API setAutoOff, the API only work for specific customer, the
purpose is saving battery
  • Loading branch information
FeitianSmartcardReader committed Sep 5, 2017
1 parent ed833a6 commit c331cef
Show file tree
Hide file tree
Showing 41 changed files with 66 additions and 27 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2017/09/05
Update Android SDK, Add new API setAutoOff, the new API using for OEM customer for battery saving
2016/04/18
Rearrange the SDK
Update iOS SDK, add get reader type API - FtGetCurrentReaderType.
Expand Down
Binary file modified SDK/Android/BIN/FtBtDemo.apk
Binary file not shown.
Binary file added SDK/Android/Lib/bR301_v2.0.9_debug.jar
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions SDK/Android/Readme.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2017/09/05
Update Android SDK
2016/10/17
Fix auto PPS issue, update lib to 2.0.5
2016/01/07
Expand Down
Binary file removed SDK/Android/Sample code/Standard Sample code.7z.rev
Binary file not shown.
2 changes: 1 addition & 1 deletion SDK/Android/Sample code/Standard Sample code/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ public static final class drawable {
public static final int ic_launcher=0x7f020001;
}
public static final class id {
public static final int BExit=0x7f080012;
public static final int BExit=0x7f080013;
public static final int BGetAtr=0x7f080007;
public static final int BGetSerial=0x7f080009;
public static final int BGetStatus=0x7f080008;
public static final int BList=0x7f080001;
public static final int BPowerOff=0x7f080006;
public static final int BPowerOn=0x7f080005;
public static final int BReadFlash=0x7f08000f;
public static final int BSelectBlue=0x7f080015;
public static final int BSendCmd=0x7f08000c;
public static final int BSendData=0x7f08000a;
public static final int BWriteFlash=0x7f08000e;
public static final int BclearReceiveData=0x7f080011;
public static final int BReadFlash=0x7f080010;
public static final int BSelectBlue=0x7f080016;
public static final int BSendCmd=0x7f08000d;
public static final int BSendData=0x7f08000b;
public static final int BSetAutoOff=0x7f08000a;
public static final int BWriteFlash=0x7f08000f;
public static final int BclearReceiveData=0x7f080012;
public static final int Bconnect=0x7f080003;
public static final int BdisConnect=0x7f080004;
public static final int ESSreceive=0x7f080013;
public static final int ESendData=0x7f08000b;
public static final int EWriteFlash=0x7f080010;
public static final int Ereceive=0x7f080014;
public static final int deviceTextView=0x7f080016;
public static final int menu_settings=0x7f080017;
public static final int ESSreceive=0x7f080014;
public static final int ESendData=0x7f08000c;
public static final int EWriteFlash=0x7f080011;
public static final int Ereceive=0x7f080015;
public static final int deviceTextView=0x7f080017;
public static final int menu_settings=0x7f080018;
public static final int spinner1=0x7f080002;
public static final int spinner2=0x7f08000d;
public static final int spinner2=0x7f08000e;
public static final int textView2=0x7f080000;
}
public static final class layout {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-12
target=android-19
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@

<Button
android:id="@+id/BGetStatus"
android:layout_width="175dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GetStat"
android:textSize="20dip" />
Expand All @@ -104,6 +104,12 @@
android:layout_height="wrap_content"
android:text="SerialNum"
android:textSize="20dip" />
<Button
android:id="@+id/BSetAutoOff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SetAutoOff"
android:textSize="20dip" />
</LinearLayout>

<LinearLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
android:layout_height="wrap_content"
android:text="GetSerialNum"
android:textSize="20dip" />

<Button
android:id="@+id/BSetAutoOff"
android:layout_width="175dp"
android:layout_height="wrap_content"
android:text="SetAutoOff"
android:textSize="20dip" />
</LinearLayout>

<LinearLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
* This is the main Activity that displays the current chat session.
*/
public class BlueTooth extends Activity implements OnClickListener {
// 宏消息定义
// Define Macro Value
private static final boolean Debug = true;
private static final String TAG = "Bluetooth";
// Key names received from the BluetoothService Handler
public static final String DEVICE_NAME = "device_name";
public static final String TOAST = "toast";

// 控件、
// Controls
private Button mSend;
private Button mList;
private Button mConnect;
Expand All @@ -56,13 +56,14 @@ public class BlueTooth extends Activity implements OnClickListener {
private Button mExit;
private Button mclearReceiveData;
private Button mGetCardSerialNum;
private Button mSetAutoOff;
private Button mWriteFlash;
private Button mReadFlash;
private Button mSendCmd;
// private Button mDisconnect;
private Button mGetStatus;
private EditText mEditSend;// 发送数据
private EditText mEditFlash;// 发送flash数据
private EditText mEditSend;// Send data
private EditText mEditFlash;// Send flash data
private EditText mEditReceive;
private Spinner deviceListSpinner;

Expand Down Expand Up @@ -130,6 +131,8 @@ public void onCreate(Bundle savedInstanceState) {
mGetStatus.setOnClickListener(this);
mGetCardSerialNum = (Button) findViewById(R.id.BGetSerial);
mGetCardSerialNum.setOnClickListener(this);
mSetAutoOff = (Button) findViewById(R.id.BSetAutoOff);
mSetAutoOff.setOnClickListener(this);

mWriteFlash = (Button) findViewById(R.id.BWriteFlash);
mWriteFlash.setOnClickListener(this);
Expand All @@ -153,7 +156,7 @@ public void onCreate(Bundle savedInstanceState) {
mSendCmd = (Button) findViewById(R.id.BSendCmd);
mSendCmd.setOnClickListener(this);

/* 获取 */
/* Get Bluetooth device list */
arrayForBlueToothDevice = new ArrayList<BluetoothDevice>();

list = new ArrayList<String>();
Expand Down Expand Up @@ -187,12 +190,12 @@ public void onNothingSelected(AdapterView<?> arg0) {



// step 2 为下拉列表定义一个适配器,用到定义的额list2
// step 2 Define a adapter for droplist
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, list3);
// step 3 select style for 下拉列表
// step 3 select style for droplist
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// step 4 将适配器添加到下拉列表上
// step 4 Add adapter to droplist
devListSpinner2.setAdapter(adapter);

devListSpinner2
Expand Down Expand Up @@ -389,6 +392,17 @@ public void onClick(DialogInterface dialog,
serialNum[serialLen[0]] = '\0';
String str = new String(serialNum);
displayData("GetSerialNum", str);
} else if (v == mSetAutoOff){
int ret = mReader.setAutoOff(true);

if(ret == DK.RETURN_SUCCESS){
displayData("SetAutoOff", "success");
}else if(ret == DK.IFD_NOT_SUPPORTED){
displayData("SetAutoOff", "not support");
}else{
displayData("SetAutoOff", "failed");
}

} else if (v == mReadFlash) {
byte buf[] = new byte[512];
if (DK.RETURN_SUCCESS == mReader.readFlash(buf, 0, 255)) {
Expand Down Expand Up @@ -483,6 +497,7 @@ private void stat_disconnect() {
mConnect.setEnabled(true);
mDisConnect.setEnabled(false);
mGetCardSerialNum.setEnabled(false);
mSetAutoOff.setEnabled(false);
mWriteFlash.setEnabled(false);
mReadFlash.setEnabled(false);
mSendCmd.setEnabled(false);
Expand All @@ -505,6 +520,7 @@ private void stat_connect() {
mConnect.setEnabled(false);
mDisConnect.setEnabled(true);
mGetCardSerialNum.setEnabled(true);
mSetAutoOff.setEnabled(true);
mWriteFlash.setEnabled(true);
mReadFlash.setEnabled(true);
mSendCmd.setEnabled(false);
Expand Down Expand Up @@ -551,7 +567,7 @@ public void onDestroy() {

private void displayData(String Tag, String text) {
SimpleDateFormat formatter = new SimpleDateFormat(" HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
Date curDate = new Date(System.currentTimeMillis());//Get current date
String str = formatter.format(curDate);
if (text.length() > 0) {
mEditReceive.setText(mEditReceive.getText() + "From:" + Tag + str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public String getDkVersion(){
public int getCardStatus() throws FtBlueReadException{
return inner_card.getcardStatus();
}

public int setAutoOff(boolean isAutoOff){
return inner_card.FTSetAutoTurnOff(isAutoOff);
}
/**/
public int getSerialNum(byte[] serial,int serialLen[]){
return inner_card.FtGetSerialNum(serial, serialLen);
Expand Down

0 comments on commit c331cef

Please sign in to comment.