安卓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);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/603120.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

安卓之图形绘制的应用场景以及各种技术优劣分析

一、文章摘要 安卓系统作为全球最流行的移动操作系统之一&#xff0c;其图形绘制功能在各种应用场景中发挥着重要作用。无论是创意绘图、教育应用、游戏开发还是虚拟现实&#xff0c;图形绘制都是关键的一环。本文将深入探讨安卓图形绘制的应用场景&#xff0c;并分析各种技术的…

Winform中使用Websocket4Net实现Websocket客户端并定时存储接收数据到SQLite中

场景 SpringBootVue整合WebSocket实现前后端消息推送&#xff1a; SpringBootVue整合WebSocket实现前后端消息推送_websocket vue3.0 springboot 往客户端推送-CSDN博客 上面实现ws推送数据流程后&#xff0c;需要在windows上使用ws客户端定时记录收到的数据到文件中&#x…

RT_Thread 调试笔记:信号量,互斥量,事件集 的创建和使用流程

说明&#xff1a;记录日常使用 RT_Thread 开发时做的笔记。 持续更新中&#xff0c;欢迎收藏。 1. 信号量 1. 使用流程 /* 信号量的定义和使用流程 *//*step1&#xff1a; 定义用于接收消息的信号量*/ static struct rt_semaphore rx_sem; 或者 static rt_sem_t rx_sem;/*…

vue3 的内置组件汇总

官方给出的说明&#xff1a; Fragment: Vue 3 组件不再要求有一个唯一的根节点&#xff0c;清除了很多无用的占位 div。Teleport: 允许组件渲染在别的元素内&#xff0c;主要开发弹窗组件的时候特别有用。Suspense: 异步组件&#xff0c;更方便开发有异步请求的组件。 一、fr…

模仿Activiti工作流自动建表机制,实现Springboot项目启动后自动创建多表关联的数据库与表的方案

文/朱季谦 熬夜写完&#xff0c;尚有不足&#xff0c;但仍在努力学习与总结中&#xff0c;而您的点赞与关注&#xff0c;是对我最大的鼓励&#xff01; 在一些本地化项目开发当中&#xff0c;存在这样一种需求&#xff0c;即开发完成的项目&#xff0c;在第一次部署启动时&…

基于SpringBoot的个人理财系统

文章目录 项目介绍主要功能截图部分代码展示设计总结项目获取方式🍅 作者主页:超级无敌暴龙战士塔塔开 🍅 简介:Java领域优质创作者🏆、 简历模板、学习资料、面试题库【关注我,都给你】 🍅文末获取源码联系🍅 项目介绍 基于SpringBoot的个人理财系统,java项目。…

3C电子制造:智慧物流引领产业升级

在当今科技飞速发展的时代&#xff0c;3C电子制造行业正面临着一系列挑战和机遇。市场需求的多变和技术革新的加速&#xff0c;使得企业必须不断创新和升级。在这个过程中&#xff0c;智慧物流成为了一个关键的环节&#xff0c;它能够有效地提高生产效率、降低成本并增强企业的…

Docker学习与应用(二)-docker常用命令

注&#xff1a;此为笔者学习狂神说Docker的笔记&#xff0c;其中包含个人的笔记和理解&#xff0c;更多详细资讯请出门左拐B站&#xff1a;狂神说!!! Docker的常用命令 帮助命令 docker version # 显示docker的版本信息 docker info # 显示docker的系统信息&am…

【学习笔记】1、数字逻辑概论

1.1 数字信号 数字信号&#xff0c;在时间和数值上均是离散的。数字信号的表达方式&#xff1a;二值数字逻辑和逻辑电平描述的数字波形。 &#xff08;1&#xff09; 数字波形的两种类型 数值信号又称为“二值信号”。数字波形又称为“二值位形图”。 什么是一拍 一定的时…

新手可理解的PyTorch 损失函数:优化机器学习模型的关键

目录 torch.nn子模块Loss Functions详解 nn.L1Loss 用途 用法 使用技巧 注意事项 代码示例 nn.MSELoss 用途 用法 使用技巧 注意事项 代码示例 nn.CrossEntropyLoss 用途 用法 使用技巧 注意事项 代码示例 使用类别索引 使用类别概率 nn.CTCLoss 用途 …

【Pytorch】学习记录分享13——OCR(Optical Character Recognition,光学字符识别)

[TOC](OCR(Optical Character Recognition,光学字符识别)) 1. OCR资源汇总 OCR(Optical Character Recognition,光学字符识别)指提取图像中的文字信息&#xff0c;通常包括文本检测和文本识别。 文字检测&#xff1a;将图片中的文字区域位置检测出来&#xff08;如图1(b)所示…

Dash+Plotly | Web应用开发(1)

本文为https://github.com/CNFeffery/DataScienceStudyNotes的学习笔记&#xff0c;部分源码来源于此仓库。 本期内容主要为基础概念、web布局方法和交互回调。 文章目录 Dash的主要模块Highlightlayoutcallback 惰性交互阻止初次回调忽略回调匹配错误控制部分回调输出不更新获…

【总线接口】1.以Xilinx开发板为例,直观的认识硬件板卡和接口

初接触硬件&#xff0c;五花八门的总线、接口一定会让你有些疑惑&#xff0c;我尝试用一系列文章来解开你的疑惑 系列文章 【总线接口】1.以Xilinx开发板为例&#xff0c;直观的认识硬件接口 【总线接口】2.学习硬件这些年接触过的硬件接口、总线 大汇总 【总线接口】…

【STM32】STM32学习笔记-DMA数据转运+AD多通道(24)

00. 目录 文章目录 00. 目录01. DMA简介02. DMA相关API2.1 DMA_Init2.2 DMA_InitTypeDef2.3 DMA_Cmd2.4 DMA_SetCurrDataCounter2.5 DMA_GetFlagStatus2.6 DMA_ClearFlag 03. DMA数据单通道接线图04. DMA数据单通道示例05. DMA数据多通道接线图06. DMA数据多通道示例一07. DMA数…

关于一个热成像仪的总结(一)硬件篇电源电路

1、电源部分 电源部分电路原理是这样的通过3.7V的锂电池供电&#xff0c;用Type-C选用TP4056作为充电电路给电池充电。使用MP2161开关电源作为5转3.3V 电源为MCU供电。 1-1电池 待定 1-2充电管理芯片TP4056 参考datasheet&#xff1a;https://atta.szlcsc.com/upload/publi…

数据传输:连接数字世界的纽带

在当今数字化时代&#xff0c;数据传输已经成为了我们日常生活和工作中不可或缺的一部分。无论是通过互联网发送电子邮件、传输文件&#xff0c;还是在智能手机上浏览网页、观看视频&#xff0c;都离不开数据传输的支持。本文将对数据传输进行深度分析&#xff0c;探讨其原理、…

Vue 3中toRaw和markRaw的使用

Vue 3的响应性系统 在Vue 3中&#xff0c;响应性系统是构建动态Web应用程序的关键部分。Vue使用响应性系统来跟踪依赖关系&#xff0c;使数据更改能够自动更新视图。这使得Vue应用程序在数据变化时能够高效地更新DOM。Vue 3引入了新的Proxy对象来替代Vue 2中的Object.definePro…

vue3+echart绘制中国地图并根据后端返回的坐标实现涟漪动画效果

1.效果图 2.前期准备 main.js app.use(BaiduMap, {// ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */ak: sRDDfAKpCSG5iF1rvwph4Q95M6tDCApL,// v:3.0, // 默认使用3.0// type: WebGL // ||API 默认API (使用此模式 BMapBMapGL) });i…

CSDN博客重新更新

说来惭愧&#xff0c;好久没更新博客文章&#xff0c;导致个人博客网站&#xff1a;https://lenky.info/ 所在的网络空间和域名都过期了都没发觉&#xff0c;直到有个同事在Dim上问我我的个人博客为啥打不开了。。。幸好之前有做整站备份&#xff0c;后续慢慢把内容都迁回CSDN上…

学习笔记——C++运算符之比较运算符

作用&#xff1a;用于表达式的比较&#xff0c;并返回一个真值或假值 比较运算符有以下符号&#xff1a; #include<bits/stdc.h> using namespace std; int main(){//int a10;int b20;cout<<(ab)<<endl;//0//!cout<<(a!b)<<endl;//1//>cout&…