当前位置: 首页 > news >正文

安卓Android Studio读写FM1208CPU卡源码

本示例使用的发卡器:https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-21818769070.11.6c46789elLwMzv&id=615391857885 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:padding="3dp"tools:context=".CpuCardActivity"><androidx.appcompat.widget.Toolbarandroid:id="@+id/toolbar"android:layout_width="match_parent"android:layout_height="30dp"android:background="?attr/colorPrimary"app:navigationIcon="@drawable/baseline_arrow_back_ios_24"app:titleTextColor="@color/white"tools:ignore="MissingConstraints"tools:layout_editor_absoluteY="0dp"><TextViewandroid:id="@+id/TextViewlabelDispleft"android:layout_width="wrap_content"android:layout_height="match_parent"android:text="返回"android:textColor="@color/white"android:textSize="16sp"android:gravity="center"android:onClick="retmain" /><TextViewandroid:id="@+id/TextViewlabelDisp"android:layout_width="match_parent"android:layout_height="match_parent"android:text="CPU卡测试页"android:textColor="@color/white"android:gravity="center_horizontal|bottom"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="@+id/TextViewlabelDispleft"app:layout_constraintTop_toTopOf="parent" /></androidx.appcompat.widget.Toolbar><TextViewandroid:id="@+id/sample_text"android:layout_width="fill_parent"android:layout_height="100dp"android:layout_marginLeft="2dp"android:layout_marginBottom="5dp"android:background="@drawable/shape4border"android:padding="3dp"android:text="操作结果"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintLeft_toLeftOf="parent" /><ScrollViewandroid:id="@+id/scrollViewIC"android:layout_width="fill_parent"android:layout_height="0dp"android:layout_marginBottom="3dp"android:scrollbars="horizontal"app:layout_constraintBottom_toTopOf="@+id/sample_text"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/toolbar"app:layout_constraintVertical_bias="0.0"><androidx.constraintlayout.widget.ConstraintLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:padding="3dp"><Buttonandroid:id="@+id/requestcpucard"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginEnd="3dp"android:layout_marginRight="3dp"android:onClick="cpu_request"android:text="激活感应区内的CPU卡"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toTopOf="parent" /><TextViewandroid:id="@+id/textView0"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:layout_marginTop="5dp"android:text="卡片UID:"android:textSize="12sp"app:layout_constraintLeft_toRightOf="@+id/requestcpucard"app:layout_constraintTop_toTopOf="@+id/requestcpucard" /><TextViewandroid:id="@+id/textView10"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:text="每次卡片重新进入到感应区,都必须先激活!"android:textColor="#FF0000"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/requestcpucard"app:layout_constraintLeft_toRightOf="@+id/requestcpucard" /><TextViewandroid:id="@+id/textcarduid"android:layout_width="100dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:gravity="center"android:textSize="14sp"app:layout_constraintBottom_toBottomOf="@+id/textView0"app:layout_constraintLeft_toRightOf="@+id/textView0"app:layout_constraintTop_toTopOf="@+id/textView0" /><Buttonandroid:id="@+id/cpu_rsinit"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="8dp"android:onClick="cpu_rsinit"android:text="初始化CPU卡"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/requestcpucard" /><CheckBoxandroid:id="@+id/checkcleckcard"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="选择先清空卡再初始化,本次分配空间:"android:textSize="11sp"app:layout_constraintLeft_toRightOf="@+id/cpu_rsinit"app:layout_constraintTop_toTopOf="@+id/cpu_rsinit" /><EditTextandroid:id="@+id/textusespace"android:layout_width="40dp"android:layout_height="wrap_content"android:background="@drawable/shape4border"android:textColor="#FF0000"android:gravity="center"android:text="1024"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/checkcleckcard"app:layout_constraintLeft_toRightOf="@+id/checkcleckcard"app:layout_constraintTop_toTopOf="@+id/checkcleckcard" /><TextViewandroid:id="@+id/textView2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="设置卡片32位16进制密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/cpu_rsinit" /><EditTextandroid:id="@+id/cardkey"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="4dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView2"app:layout_constraintLeft_toRightOf="@+id/textView2"app:layout_constraintTop_toTopOf="@+id/cpu_rsinit"app:layout_constraintVertical_bias="0.96" /><Buttonandroid:id="@+id/butt_cpu_rseasyfileadd"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="8dp"android:onClick="cpu_rseasyfileadd"android:text="创建易写文件"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textView2" /><Buttonandroid:id="@+id/butt_cpursfileadd"android:layout_width="wrap_content"android:layout_height="wrap_content"android:onClick="cpu_rsfileadd"android:text="创建标准文件"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/butt_cpu_rseasyfileadd"app:layout_constraintLeft_toRightOf="@+id/butt_cpu_rseasyfileadd"app:layout_constraintTop_toTopOf="@+id/butt_cpu_rseasyfileadd" /><TextViewandroid:id="@+id/textviewcreafile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="请选择本次创建的文件号:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/butt_cpu_rseasyfileadd" /><Spinnerandroid:id="@+id/spin_SelCreatefilenum"android:layout_width="130dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:entries="@array/cpucardfile"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/textviewcreafile"app:layout_constraintLeft_toRightOf="@+id/textviewcreafile"app:layout_constraintTop_toTopOf="@+id/textviewcreafile" /><TextViewandroid:id="@+id/textView1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:text="文件大小:"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/spin_SelCreatefilenum"app:layout_constraintLeft_toRightOf="@+id/spin_SelCreatefilenum"app:layout_constraintTop_toTopOf="@+id/spin_SelCreatefilenum" /><EditTextandroid:id="@+id/textfileszie"android:layout_width="40dp"android:layout_height="wrap_content"android:layout_marginLeft="5dp"android:background="@drawable/shape4border"android:textColor="#FF0000"android:gravity="center"android:text="256"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView1"app:layout_constraintLeft_toRightOf="@+id/textView1"app:layout_constraintTop_toTopOf="@+id/textView1" /><TextViewandroid:id="@+id/textView3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="文件32位16进制只读密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textviewcreafile" /><EditTextandroid:id="@+id/readkey"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView3"app:layout_constraintLeft_toRightOf="@+id/textView3" /><TextViewandroid:id="@+id/textView4"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="文件32位16进制只读密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textView3" /><EditTextandroid:id="@+id/writekey"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView4"app:layout_constraintLeft_toRightOf="@+id/textView4" /><Buttonandroid:id="@+id/butt_changfilekey"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="8dp"android:onClick="cpu_rsfilekeychg"android:text="修改文件密钥"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textView4" /><Spinnerandroid:id="@+id/spin_Selchangkeyfile"android:layout_width="130dp"android:layout_height="wrap_content"android:entries="@array/cpucardfile"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/butt_changfilekey"app:layout_constraintLeft_toRightOf="@+id/butt_changfilekey"app:layout_constraintTop_toTopOf="@+id/butt_changfilekey" /><TextViewandroid:id="@+id/textviewchanekeyfile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="请选择:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/butt_changfilekey" /><Spinnerandroid:id="@+id/spin_Selauthkey"android:layout_width="180dp"android:layout_height="wrap_content"android:entries="@array/cpucardauthkey"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/textviewchanekeyfile"app:layout_constraintLeft_toRightOf="@+id/textviewchanekeyfile"app:layout_constraintTop_toTopOf="@+id/textviewchanekeyfile" /><Spinnerandroid:id="@+id/spin_SelchangRWkey"android:layout_width="180dp"android:layout_height="wrap_content"android:entries="@array/cpucardchangkey"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/spin_Selauthkey"app:layout_constraintLeft_toRightOf="@+id/spin_Selauthkey"app:layout_constraintTop_toTopOf="@+id/spin_Selauthkey" /><TextViewandroid:id="@+id/textView5"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="32位16进制认证密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/spin_Selauthkey" /><EditTextandroid:id="@+id/authkey0"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView5"app:layout_constraintLeft_toRightOf="@+id/textView5"app:layout_constraintTop_toTopOf="@+id/textView5" /><TextViewandroid:id="@+id/textView6"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="32位16进制新建密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textView5" /><EditTextandroid:id="@+id/newkey"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textView6"app:layout_constraintLeft_toRightOf="@+id/textView6"app:layout_constraintTop_toTopOf="@+id/textView6" /><Buttonandroid:id="@+id/butt_readfile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="8dp"android:onClick="cpu_readfile"android:text="读文件数据"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textView6" /><Buttonandroid:id="@+id/butt_writeeasyfile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:onClick="cpu_writeeasyfile"android:text="写数据到易写文件"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/butt_readfile"app:layout_constraintLeft_toRightOf="@+id/butt_readfile"app:layout_constraintTop_toTopOf="@+id/butt_readfile" /><Buttonandroid:id="@+id/butt_writefile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:onClick="cpu_writefile"android:text="写数据到标准文件"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/butt_writeeasyfile"app:layout_constraintLeft_toRightOf="@+id/butt_writeeasyfile"app:layout_constraintTop_toTopOf="@+id/butt_writeeasyfile" /><TextViewandroid:id="@+id/textviewrwfile"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="请选择:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/butt_readfile" /><Spinnerandroid:id="@+id/spin_SelRWfile"android:layout_width="180dp"android:layout_height="wrap_content"android:entries="@array/cpucardfile"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/textviewrwfile"app:layout_constraintLeft_toRightOf="@+id/textviewrwfile"app:layout_constraintTop_toTopOf="@+id/textviewrwfile" /><Spinnerandroid:id="@+id/spin_SelRWauthkey"android:layout_width="180dp"android:layout_height="wrap_content"android:entries="@array/cpucardauthkey"android:textSize="11sp"app:layout_constraintBottom_toBottomOf="@+id/spin_SelRWfile"app:layout_constraintLeft_toRightOf="@+id/spin_SelRWfile"app:layout_constraintTop_toTopOf="@+id/spin_SelRWfile" /><TextViewandroid:id="@+id/textviewrwauthkey"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="本次读写文件的认证密钥:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textviewrwfile" /><EditTextandroid:id="@+id/editrwauthkey"android:layout_width="235dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:gravity="center"android:inputType="textCapCharacters"android:maxLength="32"android:maxLines="1"android:text="FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textviewrwauthkey"app:layout_constraintLeft_toRightOf="@+id/textviewrwauthkey"app:layout_constraintTop_toTopOf="@+id/textviewrwauthkey" /><TextViewandroid:id="@+id/textviewrwbegin"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:text="本次读写文件的起始地址:"android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textviewrwauthkey" /><EditTextandroid:id="@+id/textrwbeginadd"android:layout_width="40dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:textColor="#FF0000"android:gravity="center"android:text="0"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textviewrwbegin"app:layout_constraintLeft_toRightOf="@+id/textviewrwbegin"app:layout_constraintTop_toTopOf="@+id/textviewrwbegin" /><TextViewandroid:id="@+id/textviewrwlen"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="52dp"android:text="本次读写长度:"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textviewrwbegin"app:layout_constraintLeft_toRightOf="@+id/textrwbeginadd"app:layout_constraintTop_toTopOf="@+id/textviewrwbegin"app:layout_constraintVertical_bias="1.0" /><EditTextandroid:id="@+id/textrwlen"android:layout_width="40dp"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:background="@drawable/shape4border"android:textColor="#FF0000"android:gravity="center"android:text="100"android:textSize="12sp"app:layout_constraintBottom_toBottomOf="@+id/textviewrwlen"app:layout_constraintLeft_toRightOf="@+id/textviewrwlen"app:layout_constraintTop_toTopOf="@+id/textviewrwlen" /><EditTextandroid:id="@+id/editrwdata"android:layout_width="match_parent"android:layout_height="80dp"android:layout_marginTop="5dp"android:background="@drawable/shape4border"android:digits="0123456789ABCDEFabcdef"android:inputType="textCapCharacters"android:maxLines="8"android:text="                                               "android:textSize="12sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/textviewrwbegin" /><Buttonandroid:id="@+id/butt_clearcupcard"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="8dp"android:onClick="cpu_cardclr"android:text="强制清空已初始化过的CPU卡"android:textSize="11sp"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintTop_toBottomOf="@+id/editrwdata" /></androidx.constraintlayout.widget.ConstraintLayout></ScrollView></androidx.constraintlayout.widget.ConstraintLayout>
package com.usbreadertest;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;import com.reader.ourmifare;
public class CpuCardActivity extends AppCompatActivity {private TextView tv;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_cpu_card);androidx.appcompat.widget.Toolbar toolbar=findViewById(R.id.toolbar);setSupportActionBar(toolbar);tv = findViewById(R.id.sample_text);tv.setText("操作结果");Spinner spls = findViewById(R.id.spin_SelRWauthkey);spls.setSelection(1);}@Overridepublic void onBackPressed(){super.onBackPressed();finish();}@Overridepublic boolean onOptionsItemSelected(MenuItem item) {if(item.getItemId()==android.R.id.home){finish();return true;}return super.onOptionsItemSelected(item);}public void retmain(View view){finish();}public void cpu_request(View view){byte status;                         //存放返回值byte[] mypiccserial = new byte[4];   //4字节设备编号byte[] myparam = new byte[4];        //4字节卡参数byte[] myver= new byte[1];byte[] mycode= new byte[1];TextView ctrcarduid;ctrcarduid = findViewById(R.id.textcarduid);ctrcarduid.setText("");tv = findViewById(R.id.sample_text);tv.setText("");status =ourmifare.cpurequest(mypiccserial,myparam, myver, mycode);if (status == 0 || status == 52) {ourmifare.pcdbeep(38);String serialnumber = "";for (int i = 0; i < 4; i++) {String bytestr = "00" + Integer.toHexString(mypiccserial[i] & 0xff);serialnumber = serialnumber + bytestr.substring(bytestr.length() - 2, bytestr.length());}ctrcarduid.setText(serialnumber);tv.setText("CPU卡已激活,卡号:"+serialnumber);} else {PrintErrInf(status);   //返回代码提示}}public void cpu_rsinit(View view){byte status;                         //存放返回值byte[] mypicckey = new byte[16];     //卡片认证密码,16进制,最好不要随便修改,此密码不影响数据安全byte mykeylen = 16 ;                 //卡片密码长度int  spacesize;                      //应用空间字节大小(要大于所有文件总和),根据不同容量的卡设不同值byte emptycard;                      //初始化前是否清空卡内数据,取值1将先清空卡,取值为0不清空现有数据String cardkeystr;CheckBox ctrcheck;EditText ctrcardkey;EditText ctrspace;ctrcheck=findViewById(R.id.checkcleckcard) ;if(ctrcheck.isChecked()) {emptycard=1;}else {emptycard=0;}ctrspace=findViewById(R.id.textusespace) ;spacesize=Integer.parseInt(ctrspace.getText().toString().trim());ctrcardkey=findViewById(R.id.cardkey) ;cardkeystr=ctrcardkey.getText().toString().trim();if (cardkeystr.length() < 32){tv.setText("卡密钥是32位16进制数据,请输入正确的卡片密钥!");return;}else {for (int i = 0; i < 16; i++) {mypicckey[i] = (byte) Integer.parseInt(cardkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}status =ourmifare.cpursinit(emptycard, mypicckey, mykeylen, spacesize);if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText("初始化卡成功!" );} else {PrintErrInf(status);   //返回代码提示}}public void cpu_rseasyfileadd(View view){byte status;                         //存放返回值byte RKLen = 16 ;                    //文件 只读权限密码 长度byte[] RFilekey = new byte[RKLen];   //文件 只读权限密码byte WKLen = 16 ;                    //文件 读写权限密码 长度byte[] WFilekey = new byte[WKLen];   //文件 读写权限密码,此权限高,可认证此密码修改只读密码,要记住文件密码Spinner spls = findViewById(R.id.spin_SelCreatefilenum);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号EditText ctrfilesize = findViewById(R.id.textfileszie);  //文件大小int FileSize=Integer.parseInt(ctrfilesize.getText().toString().trim());EditText ctrreadkey=findViewById(R.id.readkey) ;String readkeystr=ctrreadkey.getText().toString().trim();if (readkeystr.length() < 32){tv.setText("文件只读密钥是32位16进制数据,请输入正确的只读密钥!");return;}else {for (int i = 0; i < 16; i++) {RFilekey[i] = (byte) Integer.parseInt(readkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrwritekey=findViewById(R.id.writekey) ;String writekeystr=ctrwritekey.getText().toString().trim();if (writekeystr.length() < 32){tv.setText("文件读写密钥是32位16进制数据,请输入正确的读写密钥!");return;}else {for (int i = 0; i < 16; i++) {WFilekey[i] = (byte) Integer.parseInt(writekeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}status =ourmifare.cpursfileadds(FileIndex, RFilekey, RKLen, WFilekey, WKLen, FileSize) ;  //if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText(Integer.toHexString(FileIndex+1)+" 号文件创建成功!");} else {PrintErrInf(status);   //返回代码提示}}public void cpu_rsfileadd(View view){byte status;                         //存放返回值byte RKLen = 16 ;                    //文件 只读权限密码 长度byte[] RFilekey = new byte[RKLen];   //文件 只读权限密码byte WKLen = 16 ;                    //文件 读写权限密码 长度byte[] WFilekey = new byte[WKLen];   //文件 读写权限密码,此权限高,可认证此密码修改只读密码,要记住文件密码Spinner spls = findViewById(R.id.spin_SelCreatefilenum);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号EditText ctrfilesize = findViewById(R.id.textfileszie);  //文件大小int FileSize=Integer.parseInt(ctrfilesize.getText().toString().trim());EditText ctrreadkey=findViewById(R.id.readkey) ;String readkeystr=ctrreadkey.getText().toString().trim();if (readkeystr.length() < 32){tv.setText("文件只读密钥是32位16进制数据,请输入正确的只读密钥!");return;}else {for (int i = 0; i < 16; i++) {RFilekey[i] = (byte) Integer.parseInt(readkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrwritekey=findViewById(R.id.writekey) ;String writekeystr=ctrwritekey.getText().toString().trim();if (writekeystr.length() < 32){tv.setText("文件读写密钥是32位16进制数据,请输入正确的读写密钥!");return;}else {for (int i = 0; i < 16; i++) {WFilekey[i] = (byte) Integer.parseInt(writekeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}status =ourmifare.cpursfileadd(FileIndex, RFilekey, RKLen, WFilekey, WKLen, FileSize) ;  //if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText(Integer.toHexString(FileIndex+1)+" 号文件创建成功!");} else {PrintErrInf(status);   //返回代码提示}}public void cpu_rsfilekeychg(View view){byte status;                         //存放返回值byte OldKey;byte AKLen = 16 ;                    //文件 认证密码 长度byte[] Autkey = new byte[AKLen];     //文件 认证密码byte NKLen = 16 ;                    //文件 新密码密码 长度byte[] Newkey = new byte[NKLen];     //文件 新密码密码Spinner spls = findViewById(R.id.spin_Selchangkeyfile);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号Spinner spcharw = findViewById(R.id.spin_SelchangRWkey);byte ChaKey= (byte)(spcharw.getSelectedItemId());       //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证Spinner spsuthkey = findViewById(R.id.spin_Selauthkey);if (spsuthkey.getSelectedItemId()==0) {OldKey = 0;               //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证}else {OldKey=2;}byte ctrlCode=(byte)(ChaKey+OldKey);EditText ctrauthkey=findViewById(R.id.authkey0) ;String authkeystr=ctrauthkey.getText().toString().trim();if (authkeystr.length() < 32){tv.setText("文件认证密钥是32位16进制数据,请输入正确的认证密钥!");return;}else {for (int i = 0; i < 16; i++) {Autkey[i] = (byte) Integer.parseInt(authkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrnewkey=findViewById(R.id.newkey) ;String newkeystr=ctrnewkey.getText().toString().trim();if (newkeystr.length() < 32){tv.setText("文件新密钥是32位16进制数据,请输入正确的新密钥!");return;}else {for (int i = 0; i < 16; i++) {Newkey[i] = (byte) Integer.parseInt(newkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}status =ourmifare.cpursfilekeychg(FileIndex, ctrlCode, Autkey, AKLen, Newkey, NKLen) ;//& 0xff用于转为无符号行数据if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText(Integer.toHexString(FileIndex+1)+" 号文件密码修改成功!" );} else {PrintErrInf(status);   //返回代码提示}}public void cpu_readfile(View view){byte status;                          //存放返回值byte AKLen = 16 ;                     //文件 认证密码 长度byte[] Autkey = new byte[AKLen];      //文件 认证密码byte DataStart=0;                     //读起始位置byte DataLen = 0 ;                   //读长度最大不能超过255,如文件长度>255 要循环读取byte[] DataBuf = new byte[300];      //读文件数据缓冲byte ctrlCode=0;                     //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证EditText ctrrwdata = findViewById(R.id.editrwdata);ctrrwdata.setText("");Spinner spls = findViewById(R.id.spin_SelRWfile);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号Spinner spsuthkey = findViewById(R.id.spin_SelRWauthkey);if (spsuthkey.getSelectedItemId()==0) {ctrlCode = 0;               //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证}else {ctrlCode=2;}EditText ctrauthkey=findViewById(R.id.editrwauthkey) ;String authkeystr=ctrauthkey.getText().toString().trim();if (authkeystr.length() < 32){tv.setText("文件认证密钥是32位16进制数据,请输入正确的认证密钥!");return;}else {for (int i = 0; i < 16; i++) {Autkey[i] = (byte) Integer.parseInt(authkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrbeginadd = findViewById(R.id.textrwbeginadd);  //操作起始地址DataStart=(byte)Integer.parseInt(ctrbeginadd.getText().toString().trim());EditText ctrrwlen = findViewById(R.id.textrwlen);          //读写长度DataLen=(byte)Integer.parseInt(ctrrwlen.getText().toString().trim());if (DataLen<1 || DataLen>255){tv.setText("一次读取的数据长度应大于0,小于256!如要读取更多的数据请使用循环的方式读取。");return;}status = ourmifare.cpursfiledataread(FileIndex, ctrlCode, Autkey, AKLen, DataStart, DataBuf,DataLen) ;//& 0xff用于转为无符号行数据if (status == 0 ) {ourmifare.pcdbeep(38);String filedata="";for (int i = 0; i < DataLen; i++) {String bytestr = "00" + Integer.toHexString(DataBuf[i] & 0xff);filedata = filedata + bytestr.substring(bytestr.length() - 2, bytestr.length()) +" ";}ctrrwdata.setText(filedata);} else {PrintErrInf(status);   //返回代码提示}}public void cpu_writeeasyfile(View view){byte status;                          //存放返回值byte AKLen = 16 ;                    //文件 认证密码 长度byte[] Autkey = new byte[AKLen];     //文件 认证密码byte DataStart=0;                    //写起始位置byte DataLen  ;                      //写长度最大不能超过247,如文件长度>247 要循环写入byte[] DataBuf = new byte[300];      //写文件数据缓冲byte ctrlCode=0;                     //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证Spinner spls = findViewById(R.id.spin_SelRWfile);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号Spinner spsuthkey = findViewById(R.id.spin_SelRWauthkey);if (spsuthkey.getSelectedItemId()==0) {ctrlCode = 0;               //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证}else {ctrlCode=2;}EditText ctrauthkey=findViewById(R.id.editrwauthkey) ;String authkeystr=ctrauthkey.getText().toString().trim();if (authkeystr.length() < 32){tv.setText("文件认证密钥是32位16进制数据,请输入正确的认证密钥!");return;}else {for (int i = 0; i < 16; i++) {Autkey[i] = (byte) Integer.parseInt(authkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrbeginadd = findViewById(R.id.textrwbeginadd);  //操作起始地址DataStart=(byte)Integer.parseInt(ctrbeginadd.getText().toString().trim());EditText ctrrwlen = findViewById(R.id.textrwlen);          //读写长度DataLen=(byte)Integer.parseInt(ctrrwlen.getText().toString().trim());if (DataLen<1 || DataLen>247){tv.setText("一次写入的数据长度应大于0,小于248,如要写入更多的数据可使用循环的方式写入。");return;}EditText ctrrwdata = findViewById(R.id.editrwdata);        //读写数据String rwdatahex=ctrrwdata.getText().toString().trim();String[] strArr = rwdatahex.split("\\ ");    /*分割接收到的数据后再分析、处理、返回指令 */if (strArr.length<DataLen){tv.setText("写入数据不足,请输入"+Integer.toString(DataLen*2)+"位16进制写入数据!");return;}else{for(int p=0;p<strArr.length;p++) {DataBuf[p]=(byte)(Integer.parseInt(strArr[p],16));}}status =ourmifare.cpursfiledatawrites(FileIndex, ctrlCode, Autkey, AKLen, DataStart, DataBuf,DataLen) ;//& 0xff用于转为无符号行数据if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText("写数据成功!" );} else {PrintErrInf(status);   //返回代码提示}}public void cpu_writefile(View view){byte status;                          //存放返回值byte AKLen = 16 ;                    //文件 认证密码 长度byte[] Autkey = new byte[AKLen];     //文件 认证密码byte DataStart=0;                    //写起始位置byte DataLen  ;                      //写长度最大不能超过247,如文件长度>247 要循环写入byte[] DataBuf = new byte[300];      //写文件数据缓冲byte ctrlCode=0;                     //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证Spinner spls = findViewById(R.id.spin_SelRWfile);byte FileIndex = (byte)(spls.getSelectedItemId());   //指定文件号Spinner spsuthkey = findViewById(R.id.spin_SelRWauthkey);if (spsuthkey.getSelectedItemId()==0) {ctrlCode = 0;               //取值 0 表示用只读密码来认证,取值 2 表示用读写密码来认证}else {ctrlCode=2;}EditText ctrauthkey=findViewById(R.id.editrwauthkey) ;String authkeystr=ctrauthkey.getText().toString().trim();if (authkeystr.length() < 32){tv.setText("文件认证密钥是32位16进制数据,请输入正确的认证密钥!");return;}else {for (int i = 0; i < 16; i++) {Autkey[i] = (byte) Integer.parseInt(authkeystr.substring(i * 2, i * 2 + 2), 16);//只有用Integer.parseInt才能杜绝大于128时的错误}}EditText ctrbeginadd = findViewById(R.id.textrwbeginadd);  //操作起始地址DataStart=(byte)Integer.parseInt(ctrbeginadd.getText().toString().trim());EditText ctrrwlen = findViewById(R.id.textrwlen);          //读写长度DataLen=(byte)Integer.parseInt(ctrrwlen.getText().toString().trim());if (DataLen<1 || DataLen>247){tv.setText("一次写入的数据长度应大于0,小于248,如要写入更多的数据可使用循环的方式写入。");return;}EditText ctrrwdata = findViewById(R.id.editrwdata);        //读写数据String rwdatahex=ctrrwdata.getText().toString().trim();String[] strArr = rwdatahex.split("\\ ");    /*分割接收到的数据后再分析、处理、返回指令 */if (strArr.length<DataLen){tv.setText("写入数据不足,请输入"+Integer.toString(DataLen*2)+"位16进制写入数据!");return;}else{for(int p=0;p<strArr.length;p++) {DataBuf[p]=(byte)(Integer.parseInt(strArr[p],16));}}status =ourmifare.cpursfiledatawrite(FileIndex, ctrlCode, Autkey, AKLen, DataStart, DataBuf,DataLen) ;//& 0xff用于转为无符号行数据if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText("写数据成功!" );} else {PrintErrInf(status);   //返回代码提示}}public void cpu_cardclr(View view){byte status=ourmifare.cpurscardclr() ;//& 0xff用于转为无符号行数据if (status == 0 ) {ourmifare.pcdbeep(38);tv.setText("强制清空卡成功!");} else if(status == 64){tv.setText("此卡为未经过我们cpursinit函数成功初始化的卡!");}else{PrintErrInf(status);   //返回代码提示}}public void PrintErrInf(byte errcode) {String dispstr;switch(errcode){case 8:dispstr="错误代码:8,未寻到卡,请重新拿开卡后再放到感应区!";break;case 21:dispstr="错误代码:21,没有动态库!";break;case 22:dispstr="错误代码:22,动态库或驱动程序异常!";break;case 23:dispstr="错误代码:23,驱动程序错误或尚未安装!";break;case 24:dispstr="错误代码:24,操作超时,一般是动态库没有反映!";break;case 25:dispstr="错误代码:25,发送字数不够!";break;case 26:dispstr="错误代码:26,发送的CRC错!";break;case 27:dispstr="错误代码:27,接收的字数不够!";break;case 28:dispstr="错误代码:28,接收的CRC错!";break;case 50:dispstr="错误代码:50,RATS错误,厂家调试代码,用户不需理会!";break;case 51:dispstr="错误代码:51,PPS错误,厂家调试代码,用户不需理会!";break;case 52:dispstr="错误代码:52,已进入了14443-4协议状态,可进行CPU卡功能所有操作了!";break;case 53:dispstr="错误代码:53,CPU卡功能通讯错误,请先激活卡片!";break;case 54:dispstr="错误代码:54,数据不足,需要接着发送未完成的数据至卡上!";break;case 55:dispstr="错误代码:55,发送ACK指令给卡,让卡接着发送数据回来!";break;case 56:dispstr="错误代码:56,清空根目录失败!";break;case 57:dispstr="错误代码:57,卡片不支持功能!";break;case 58:dispstr="错误代码:58,卡片初始化失败!";break;case 59:dispstr="错误代码:59,分配的空间不足!";break;case 60:dispstr="错误代码:60,本次操作的实体已存在!";break;case 61:dispstr="错误代码:61,无足够空间!";break;case 62:dispstr="错误代码:62,文件不存在!";break;case 63:dispstr="错误代码:63,权限不足,有可能是用只读密码认证,导致无法更改读写密码或无法写文件!";break;case 64:dispstr="错误代码:64,密码不存在,或密钥文件未创建!";break;case 65:dispstr="错误代码:65,传送长度错误!";break;case 66:dispstr="错误代码:66,Le错误,即接收的数据长度指定过大!";break;case 67:dispstr="错误代码:67,功能不支持或卡中无MF 或卡片已锁定!";break;case 68:dispstr="错误代码:68,密码认证错误次数过多,该密码已被锁死!";break;case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:dispstr="错误代码:"+Integer.toString(errcode)+",密码错误,剩余次数为"+Integer.toString(errcode-70)+",如果为0,该密码将锁死,无法再认证!";break;case 86:dispstr="错误代码:"+Integer.toString(errcode)+",更改后的密码长度必须和创建时的长度一致!";break;case 87:dispstr="错误代码:"+Integer.toString(errcode)+",应用目录不存在!";break;case 88:dispstr="错误代码:"+Integer.toString(errcode)+",应用文件不存在!";break;case 89:dispstr="错误代码:"+Integer.toString(errcode)+",文件号不能超过 5 ";break;case 90:dispstr="错误代码:"+Integer.toString(errcode)+",读取文件时返回的长度不足,数据可能不正确!";break;case 91:dispstr="错误代码:"+Integer.toString(errcode)+",一次读文件的长度不能超过 255";break;case 92:dispstr="错误代码:"+Integer.toString(errcode)+",一次写文件的长度不能超过 247";break;default:dispstr="未知错误,错误代码:"+Integer.toString(errcode);break;}tv = findViewById(R.id.sample_text);tv.setText(dispstr);}
}

相关文章:

安卓Android Studio读写FM1208CPU卡源码

本示例使用的发卡器&#xff1a;https://item.taobao.com/item.htm?spma1z10.5-c-s.w4002-21818769070.11.6c46789elLwMzv&id615391857885 <?xml version"1.0" encoding"utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout x…...

二、Redis的特性与应用场景

Redis是一个在内存中存储数据的中间件&#xff0c;主要用于作为数据库、数据缓存&#xff0c;在分布式系统中有着非常重要的地位。面试中可以围绕Redis的特性进行介绍。 一、Redis特性 1、在内存中存储数据 MySQL主要是“表”的方式来存储组织数据的&#xff0c;是“关系型数…...

编程笔记 html5cssjs 019 HTML实体

编程笔记 html5&css&js 019 HTML实体 一、HTML 字符实体二、HTML 符号实体小结 在HTML文档中&#xff0c;用一些标记表示特定的格式&#xff0c;那我们想使用这些标记字符本身时就出了问题&#xff0c;直接使用时&#xff0c;会被浏览器解析为标记的&#xff0c;要想显…...

数据结构:树详解

创建二叉树 给出了完整的先序遍历序列&#xff0c;子树为空用’#’表示&#xff0c;所以这样我们在通过先序遍历序列创建二叉树时我们直到先序遍历序列是先进行根结点&#xff0c;然后左子树最后右子树的顺序进行遍历的&#xff0c;所以对于完整的先序遍历序列我们可以直到先序…...

list1.Sort((m, n) => m.Id - n.Id); id是double类型的为什么回报错

问题产生的地方 原因 对于 double 类型的属性&#xff0c;不能直接使用减法运算符进行比较。减法运算符只能用于数值类型&#xff0c;而 double 是浮点数类型。 要在 double 属性上进行排序&#xff0c;可以使用 CompareTo 方法或者使用自定义的比较器。 更改 要在 double 属性…...

GoLang vs Python

Python和Go是两种非常不同的编程语言&#xff0c;它们在设计哲学、用途和特性方面有各自的优势和局限性。以下是它们的一些主要区别&#xff1a; 设计哲学: Python: 设计简洁明了&#xff0c;强调代码的可读性和简洁性。Python遵循"只有一种方式来做一件事"的原则。…...

Hello 2024(A~D,F1)

新年坐大牢 A - Wallet Exchange 题意&#xff1a;共有俩钱包&#xff0c;每回合从其中一个钱包中拿走一块钱&#xff0c;谁拿走最后一块钱谁赢。 思路&#xff1a;奇偶讨论即可。 // Problem: A. Wallet Exchange // Contest: Codeforces - Hello 2024 // URL: https://cod…...

Python+Torch+FasterCNN网络目标检测识别

程序示例精选 PythonTorchFasterCNN网络目标检测识别 如需安装运行环境或远程调试&#xff0c;见文章底部个人QQ名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 这篇博客针对《PythonTorchFasterCNN网络目标检测识别》编写代码&#xff0c;代码整洁&#xff0c;规…...

v8 pwn利用合集

文章目录 前置知识JS Object 相关Ignition 相关JIT - turboFan 相关starCTF2019 OOB【越界读写map字段】googleCTF2018 jit【浮点数精度丢失导致越界读写】数字经济线下 Browser【Object::toNumber中callback导致的越界写】前置知识 JS Object 相关 V8 中的对象表示 ==> 基…...

JVM:字节码

JVM&#xff1a;字节码 前言1. JVM概述1.1 JVM vs JDK vs JRE1.1.1 JVM1.1.2 JDK1.1.2.1 常用的JDK8是Oracle JDK 还是 OpenJDK 1.1.3 JRE1.1.4 三者之间的关系与区别 1.2 什么是字节码?采用字节码的好处是什么?1.3 Java 程序从源代码到运行的过程1.4 JVM的生命周期1.5 JVM架…...

常见网络设备及功能详解

网络设备 - 交换机 交换机&#xff1a;距离终端用户最近的设备&#xff0c;用于终端用户接入网络、对数据帧进行交换等。 交换机的功能&#xff1a; 终端设备&#xff08;PC、服务器等&#xff09;的网络接入二层交换&#xff08;Layer 2 Switching&#xff09; 网络设备 - …...

Python教程(20)——python面向对象编程基本概念

面向对象 类和对象初始化方法属性和方法self关键字继承多态 面向对象&#xff08;Object-oriented&#xff09;是一种常用的程序设计思想&#xff0c;它以对象作为程序的基本单元&#xff0c;将数据和操作封装在一起&#xff0c;通过对象之间的交互来实现程序的功能。 在面向对…...

C# Winform教程(一):MD5加密

1、介绍 在C#中&#xff0c;MD5&#xff08;Message Digest Algorithm 5&#xff09;是一种常用的哈希函数&#xff0c;用于将任意长度的数据转换为固定长度的哈希值&#xff08;通常是128位&#xff09;。MD5广泛用于校验数据完整性、密码存储等领域。 2、示例 创建MD5加密…...

Mongodb使用指定索引删除数据

回顾Mongodb删除语法 db.collection.deleteMany(<filter>,{writeConcern: <document>,collation: <document>,hint: <document|string>} ) 删除语法中&#xff0c;除了指定过滤器外&#xff0c;还可以指定写入策略&#xff0c;字符序和使用的索引。 …...

虾皮怎么选品:虾皮(Shopee)跨境电商业务成功的关键步骤

在虾皮&#xff08;Shopee&#xff09;平台上进行跨境电商业务&#xff0c;选品是至关重要的一环。有效的选品策略可以帮助卖家更好地了解市场需求&#xff0c;提高销售业绩和客户满意度。以下是一些成功的选品策略&#xff0c;可以帮助卖家在虾皮平台上取得更好的业务成绩。 先…...

QML —— 使用Qt虚拟键盘示例(附完整源码)

示例效果 使用"虚拟键盘"注意 &#xff08;例子的Qt版本:5.12.4&#xff09; 注意一&#xff1a;      /* 必须在main.cpp开始处加入如下代码&#xff0c;否则无法使用"虚拟键盘" */      qputenv(“QT_IM_MODULE”,QByteArray(“qtvirtualkeybo…...

Nacos 持久化及集群的搭建【微服务】

文章目录 一、统一配置管理二、微服务配置拉取三、配置热更新四、多环境共享配置五、Nacos 集群搭建1. 集群结构2. 初始化数据库3. 搭建集群 六、Nginx 反向代理七、启动项目测试 一、统一配置管理 案例练习的时候我们只有两个微服务&#xff0c;管理起来非常简单&#xff0c;但…...

win10下vscode+cmake编译C代码操作详解

0 工具准备 1.Visual Studio Code 1.85.1 2.cmake 3.24.01 前言 当我们只有一个.c文件时直接使用vscodeCode Runner插件即可完成编译&#xff0c;如果我们的工程很复杂包含多个.c文件时建议使用cmake来生成对应的make&#xff0c;指导编译器完成编译&#xff0c;否则会提示各…...

网络安全红队常用的攻击方法及路径

一、信息收集 收集的内容包括目标系统的组织架构、IT资产、敏感信息泄露、供应商信息等各个方面&#xff0c;通过对收集的信息进行梳理&#xff0c;定位到安全薄弱点&#xff0c;从而实施下一步的攻击行为。 域名收集 1.备案查询 天眼查爱企查官方ICP备案查询 通过以上三个…...

【基于openGauss2.1.0企业版安装X-Tuner参数调优工具】

【基于openGauss2.1.0企业版安装X-Tuner参数调优工具】 一、前提条件二、安装X-Tuner 2.1.0: 一、前提条件 已安装了openGauss2.1.0企业版 二、安装X-Tuner 2.1.0: 以root用户登录到服务器 安装以下依赖&#xff1a; yum -y groupinstall "Development tools" yum…...

SpringBoot+Vue轻松实现考试管理系统

简介 本系统基于 Spring Boot 搭建的方便易用、高颜值的教学管理平台&#xff0c;提供多租户、权限管理、考试、练习、在线学习等功能。主要功能为在线考试、练习、刷题&#xff0c;在线学习。课程内容支持图文、视频&#xff0c;考试类型支持考试、练习、问卷。 源码下载 网…...

详解Keras:keras.preprocessing.image

keras.preprocessing.image Keras 库中的一个模块&#xff0c;用于处理和增强图像数据&#xff0c;它提供了一些实用的函数&#xff0c;如图像的加载、预处理、增强等。 常用函数 1、load_img 用于加载图像文件&#xff0c;并返回一个 NumPy 数组表示该图像 示例 from ker…...

来瞅瞅Java 11都有啥新特性

第1章&#xff1a;引言 大家好&#xff0c;我是小黑&#xff01;今天小黑要和咱们聊聊Java 11&#xff0c;这个在Java发展史上占有一席之地的版本。说起Java&#xff0c;咱们都知道&#xff0c;它是一门历史悠久又持续发展的编程语言。Java不仅因其“一次编写&#xff0c;到处…...

Copilot在IDEA中的应用:提升编码效率的得力助手

Copilot在IDEA中的应用&#xff1a;提升编码效率的得力助手 前言: 欢迎来到本篇博客&#xff0c;今天我们将深入探讨 GitHub Copilot 在 IntelliJ IDEA 中的应用。GitHub Copilot 是一款由 GitHub 与 OpenAI 共同开发的人工智能代码生成工具&#xff0c;它能够根据上下文提示…...

【Python】Excel不同sheet另存为不同CSV

我有一个excel&#xff0c;内有不同sheet&#xff0c;现在批量生成不通csv文件&#xff0c;并以sheet名命名&#xff0c;或根据sheet名调整命名。 # 读取新的Excel文件 df pd.read_excel(rD:\itm\data.xlsx, sheet_nameNone)# 遍历每个sheet&#xff0c;将其另存为不同的CSV文…...

软件测试|深入学习 Docker Logs

简介 Docker 是一种流行的容器化技术&#xff0c;它能够帮助用户将应用程序及其依赖项打包成一个可移植的容器。Docker logs 是 Docker 提供的用于管理容器日志的命令&#xff0c;本文将深入学习 Docker logs 的使用和管理&#xff0c;帮助用户更好地监测和解决容器问题。 Do…...

试除法求约数算法总结

知识概览 试除法求一个数的约数的时间复杂度是。 例题展示 题目链接 活动 - AcWing 系统讲解常用算法与数据结构&#xff0c;给出相应代码模板&#xff0c;并会布置、讲解相应的基础算法题目。https://www.acwing.com/problem/content/871/ 题解 用试除法求约数&#xff0c;…...

[JavaWeb玩耍日记] 数据库

mysql版本&#xff1a;5.7.24 使用Navicat for MySQL辅助学习(2015年版)&#xff0c;这个在粘贴本博客的块引用内容时会有额外的不可见内容导致sql运行出问题&#xff0c;不过有影响的地方笔者已排除 目录 一.数据库创建 二.使用数据库与创建表 三.表内列的数据类型 四.修…...

rime中州韵小狼毫 inputShow lua Translator 输入字符透传翻译器

在 rime中州韵小狼毫 help lua Translator 中我们分享了如何使用 lua 脚本定义一个 translator&#xff0c;并以 五笔・拼音 为例引用了该 translator&#xff0c;并且达到了预期的效果。 今天&#xff0c;我们继续通过 lua 脚本为 rime中州韵/小狼毫 输入法打造一个 translat…...

【RockChip | RV1126】学习与开发

【RockChip | RV1126】学习与开发 文章目录 【RockChip | RV1126】学习与开发1. 资料1. 资料 您好,这是关于A191型RV1126的资料包,请您及时接收哦~链接: https://pan.baidu.com/s/1FXWVxa27Q78nI78d2QKlBQ?pwd=j7mk 提取码: j7mk 若您在开发过程中遇到技术问题,需要帮助时:…...

为博彩做网站日入两万/网站推广的方法有哪些?

工具&#xff1a;1.U盘1个(8G)以上。2.系统镜像文件3.驱动精灵(带网卡网卡驱动版)从网上下载U盘PE制作工具&#xff0c;如老毛桃&#xff0c;大白菜等。下载完后&#xff0c;将U盘接入电脑&#xff0c;打开软件&#xff0c;选择接入的U盘&#xff0c;写入模式一般默认为HDD-FAT…...

深圳网站建设 卓/网络营销外包

1、数组内存大小判断方法 直接用关键词sizeof进行判断。 2、案例 2.1 源文件 andyandy-virtual-machine:~/GNU_C_Programming/unpakage_dir$ tree . ├── array.c └── sizeArray.c 0 directories, 2 files andyandy-virtual-machine:~/GNU_C_Programming/unpakage_dir$ …...

用自己照片做衣服 杯子的是哪个网站/佛山旺道seo优化

Linux知识盲区整理grep相关用法整理linux命令详解之pwd命令USERADD命令详解Linux下的chkconfig命令详解Linux ntsysv命令主机ping虚拟机请求超时&#xff0c;虚拟机ping主机正常ping通导致ssh连接问题centos 如何查看操作系统是哪个版本主机ping通虚拟机&#xff0c;而不能用xs…...

一级a做爰片 A视频网站/互联网营销顾问是做什么的

对于专科生来说&#xff0c;选择一个好的专业&#xff0c;关乎以后自己能否找到一个好的工作&#xff0c;下面小编为大家提供大专都有哪些专业&#xff0c;仅供大家参考。大专有什么专业大专的具备的专业和本科的专业没有太大的区别&#xff0c;一般本科具备的专业&#xff0c;…...

python做视频点播网站/seo搜索引擎工具

&#xfeff; 提示&#xff1a;点击上方"NX网"↑ 免费订阅 关注老叶最近一段时间&#xff0c;有多位NX网友反应&#xff0c;在UG编程创建工序型腔铣计算刀路的时候和在3D动态仿真的时候&#xff0c;总是会报错提示&#xff1a;此特征在当前平台上不受支持。之后还会弹…...

网站服务商查询/如何查看百度搜索指数

荣耀30pro和nova7pro其实两款手机定位都是非常相似的&#xff0c;都主打年轻消费群体&#xff0c;但是nova系列主打线zhi下渠道&#xff0c;荣耀主打线上销售&#xff0c;这两款手机中我会更加倾向于选择荣耀30Pro&#xff0c;因为荣耀30Pro各方面配置更均衡一些&#xff0c;下…...