VB.net读写NDEF标签URI智能海报WIFI蓝牙连接

 本示例使用的发卡器:https://item.taobao.com/item.htm?ft=t&id=615391857885

Public Class Form1Dim oldpicckey(0 To 5) As Byte  '卡片旧密码Dim newpicckey(0 To 5) As Byte  '卡片新密码Function GetTagUID() As StringDim status As ByteDim myctrlword As ByteDim mypiccserial(0 To 7) As ByteDim mypickey(0 To 5) As ByteDim mypicdata(0 To 47) As ByteDim mypiccseriallen(0 To 1) As ByteGetTagUID = ""myctrlword = 0status = piccreadex_ntag(myctrlword, mypiccserial(0), mypickey(0), 4, 1, mypicdata(0))If status = 0 Then  'Ntag21x卡   For i = 0 To 6GetTagUID = GetTagUID + mypiccserial(i).ToString("X02")NextElsestatus = iso15693readex(myctrlword, 0, 0, 1, mypiccserial(0), mypicdata(0))If status = 0 Then  '15693卡For i = 0 To 7GetTagUID = GetTagUID + mypiccserial(i).ToString("X02")NextElsemyctrlword = 23mypickey(0) = "&HFF" : mypickey(1) = "&HFF" : mypickey(2) = "&HFF" : mypickey(3) = "&HFF" : mypickey(4) = "&HFF" : mypickey(5) = "&HFF"status = piccreadex(myctrlword, mypiccserial(0), 0, 1, mypickey(0), mypicdata(0))If status = 0 Then  'MifareClass卡For i = 0 To 3GetTagUID = GetTagUID + mypiccserial(i).ToString("X02")NextElsemyctrlword = 23mypickey(0) = "&HA0" : mypickey(1) = "&HA1" : mypickey(2) = "&HA2" : mypickey(3) = "&HA3" : mypickey(4) = "&HA4" : mypickey(5) = "&HA5"status = piccreadex(myctrlword, mypiccserial(0), 0, 1, mypickey(0), mypicdata(0))If status = 0 ThenFor i = 0 To 3GetTagUID = GetTagUID + mypiccserial(i).ToString("X02")NextElsemyctrlword = 0If (forumtype4request(myctrlword, mypiccserial(0), mypiccseriallen(0)) = 0) Or (forumtype4request(myctrlword, mypiccserial(0), mypiccseriallen(0)) = 52) ThenFor i = 0 To mypiccseriallen(0) - 1 'forumtype4卡GetTagUID = GetTagUID + mypiccserial(i).ToString("X02")NextEnd IfEnd IfEnd IfEnd IfEnd IfEnd FunctionFunction checkcardtype() As IntegerDim status As ByteDim myctrlword As ByteDim mypiccserial(0 To 7) As ByteDim mypickey(0 To 5) As ByteDim mypicdata(0 To 47) As ByteDim mypiccseriallen(0 To 1) As Bytecheckcardtype = 0myctrlword = 0status = piccreadex_ntag(myctrlword, mypiccserial(0), mypickey(0), 4, 1, mypicdata(0))If status = 0 Thencheckcardtype = 1   'Ntag21x卡Elsestatus = iso15693readex(myctrlword, 0, 0, 1, mypiccserial(0), mypicdata(0))If status = 0 Thencheckcardtype = 2   '15693卡Elsemyctrlword = 23mypickey(0) = "&HFF" : mypickey(1) = "&HFF" : mypickey(2) = "&HFF" : mypickey(3) = "&HFF" : mypickey(4) = "&HFF" : mypickey(5) = "&HFF"status = piccreadex(myctrlword, mypiccserial(0), 0, 1, mypickey(0), mypicdata(0))If status = 0 Thencheckcardtype = 3   'MifareClass卡Elsemyctrlword = 23mypickey(0) = "&HA0" : mypickey(1) = "&HA1" : mypickey(2) = "&HA2" : mypickey(3) = "&HA3" : mypickey(4) = "&HA4" : mypickey(5) = "&HA5"status = piccreadex(myctrlword, mypiccserial(0), 0, 1, mypickey(0), mypicdata(0))If status = 0 Thencheckcardtype = 3Elsemyctrlword = 0If (forumtype4request(myctrlword, mypiccserial(0), mypiccseriallen(0)) = 0) Or (forumtype4request(myctrlword, mypiccserial(0), mypiccseriallen(0)) = 52) Thencheckcardtype = 4   'forumtype4卡Elsecheckcardtype = 0End IfEnd IfEnd IfEnd IfEnd IfEnd FunctionPrivate Sub NtagPageLock()      '锁定ntag2数据页,锁定后标签不可以再次修改,请谨慎使用锁定功能Dim status As ByteDim mypicclockdata(0 To 3) As Bytemypicclockdata(0) = "&H00" : mypicclockdata(1) = "&H00" : mypicclockdata(2) = "&HFF" : mypicclockdata(3) = "&HFF"status = picclock_ntag(0, mypicclockdata(0))    '静态锁mypicclockdata(0) = "&HFF" : mypicclockdata(1) = "&HFF" : mypicclockdata(2) = "&HFF" : mypicclockdata(3) = "&H00"status = picclock_ntag(1, mypicclockdata(0))    '动态锁End SubPrivate Sub NtagKeyEn(ByRef mypiccserial As Byte, ByVal havekey As Boolean, ByVal addkey As Boolean)  '开启或关ntag2x卡密码保护功能Dim myctrlword As ByteDim status As ByteDim mypiccdata(0 To 15) As ByteIf havekey Then     '卡片已经有密码保护myctrlword = "&H10"Elsemyctrlword = 0End IfIf addkey Then      '开启卡密码保护功能mypiccdata(0) = 0 : mypiccdata(1) = 0 : mypiccdata(2) = 0 : mypiccdata(3) = 4       '密码保护起始页myctrlword = myctrlword + 1mypiccdata(4) = 0 / 8   '认证次数mypiccdata(5) = 0 : mypiccdata(6) = 0 : mypiccdata(7) = 0   '启用计数器myctrlword = myctrlword + 2For i = 0 To 3mypiccdata(8 + i) = newpicckey(i)Nextmypiccdata(12) = "&H16" : mypiccdata(13) = "&H16" : mypiccdata(14) = 0 : mypiccdata(15) = 0myctrlword = myctrlword + 4Elsemypiccdata(0) = 0 : mypiccdata(1) = 0 : mypiccdata(2) = 0 : mypiccdata(3) = "&HFF"myctrlword = myctrlword + 1mypiccdata(4) = 0 : mypiccdata(5) = 0 : mypiccdata(6) = 0 : mypiccdata(7) = 0myctrlword = myctrlword + 2End Ifstatus = piccinit_ntag(myctrlword, mypiccserial, oldpicckey(0), mypiccdata(0))End SubPrivate Sub button4_Click(sender As Object, e As EventArgs) Handles button4.ClickDim xms As Integerxms = 50Dim status As Byte = pcdbeep(xms)If status <> 0 Thendisperrinf(status)End IfEnd SubPrivate Sub button8_Click(sender As Object, e As EventArgs) Handles button8.ClickDim status As Byte   '存放返回值Dim devno(3) As Byte '设备编号status = pcdgetdevicenumber(devno(0))If status = 0 ThenMsgBox("设备编号:" + devno(0).ToString("D3") + "-" + devno(1).ToString("D3") + "-" + devno(2).ToString("D3") + "-" + devno(3).ToString("D3"), vbInformation + vbOKOnly, "提示")Elsedisperrinf(status)End IfEnd SubPrivate Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Loadoldpicckey(0) = "&H19" : oldpicckey(1) = "&H74" : oldpicckey(2) = "&H02" : oldpicckey(3) = "&H02" : oldpicckey(4) = "&H01" : oldpicckey(5) = "&H11"newpicckey(0) = "&H19" : newpicckey(1) = "&H74" : newpicckey(2) = "&H02" : newpicckey(3) = "&H02" : newpicckey(4) = "&H01" : newpicckey(5) = "&H11" '为防止测试中忘记以设定的密码,标签统一用此组密码加密,客户可自行设置其他的标签保护密码comboBox1.SelectedIndex = 2comboBox2.SelectedIndex = 7comboBox3.SelectedIndex = 4comboBox4.SelectedIndex = 3End SubPrivate Sub WriteDataBufToTag(ByVal NDEFinfo As String, ByVal havelock As Boolean, ByVal keyEn As Boolean)Dim status As ByteDim afi As ByteDim i As IntegerDim myctrlword As Byte              '控制字Dim mypiccserial(0 To 7) As Byte    '卡序列号Dim mypiccseriallen(0 To 1) As ByteDim carduid As StringDim cardtype As Byte = checkcardtype()Select Case cardtypeCase 1  'Ntag2x标签If havelock Then myctrlword = "&H10" Else myctrlword = 0status = forumtype2_write_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0))If status = 0 ThenIf CheckBox5.Checked = False Then NtagKeyEn(mypiccserial(0), havelock, keyEn) '开启或关闭Ntag2x标签密码保护功能'If (keyEn) Then NtagPageLock() '锁定Ntag2标签数据块,锁定后不可再改修改,请谨慎使用pcdbeep(38)carduid = "Ntag2UID:"For i = 0 To 6carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + "," + NDEFinfo + "写入成功!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 2  '15693标签myctrlword = 0afi = 0status = forumtype5_write_ndeftag(myctrlword, afi, mypiccserial(0))If status = 0 Then'If (keyEn) Then iso15693lockblock(34, 1, mypiccserial(0)) '15693卡锁定块数据后只能读取不可再修改,为防止卡片锁死,仅在确定需要才开启此段代码。pcdbeep(38)carduid = "15693UID:"For i = 0 To 7carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + "," + NDEFinfo + "写入成功!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 3  'MifareClass标签If havelock Then myctrlword = 208 Else myctrlword = 144If keyEn Then myctrlword = myctrlword + 4status = piccwrite_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0), newpicckey(0))If status = 0 Thenpcdbeep(38)carduid = "MifareClassUID:"For i = 0 To 3carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + "," + NDEFinfo + "写入成功!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 4  'ForumType4标签myctrlword = 0     '0表示标签无密码,如设置密码取值  &H40 ,mypicckey 存放密码status = forumtype4_write_ndeftag(myctrlword, mypiccserial(0), mypiccseriallen(0), newpicckey(0))If status = 0 Thenpcdbeep(38)carduid = "ForumType4UID:"For i = 0 To mypiccseriallen(0) - 1carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + "," + NDEFinfo + "写入成功!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase ElseMessageBox.Show("请刷有效的NFC标签!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)End SelectEnd SubPrivate Sub button1_Click(sender As Object, e As EventArgs) Handles button1.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim textstr As String = textBox1.Text.TrimDim textstrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(textstr).Lengthstatus = tagbuf_addtext(languagecodestr, languagecodestrlen, textstr, textstrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF纯文本标签数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF纯文本标签", havelock, keyEn)End IfEnd SubPrivate Sub button3_Click(sender As Object, e As EventArgs) Handles button3.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息Dim taguidstr As String = ""tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        If CheckBox5.Checked Thentaguidstr = "?uid=" & GetTagUID()End IfDim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = textBox4.Text.Trim     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = comboBox1.SelectedIndex '前缀Dim uristr As String = textBox5.Text.Trim & taguidstr   'uriDim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度Dim ntag21xmirrorbuf(0 To 6) As Byte    'Ntag21x UID或计数器镜像功能配置值缓冲Dim i As Integerntag21xmirrorbuf(0) = 0If CheckBox3.Checked Then   '启用UID镜像ntag21xmirrorbuf(0) = ntag21xmirrorbuf(0) + "&H40"End IfIf CheckBox4.Checked Thenntag21xmirrorbuf(0) = ntag21xmirrorbuf(0) + "&H80"End IfFor i = 1 To 6ntag21xmirrorbuf(i) = Asc("0")NextIf ntag21xmirrorbuf(0) > 0 Thenstatus = tagbuf_adduri1(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen, ntag21xmirrorbuf(0))   '可以用此方法写入多条记录到数据缓冲Elsestatus = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲End IfIf status <> 0 ThenMessageBox.Show("生成NDEF智能海报数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF智能海报标签", havelock, keyEn)End IfEnd SubPrivate Sub button5_Click(sender As Object, e As EventArgs) Handles button5.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = textBox7.Text.Trim     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = 0 '地理位置没有链接前缀Dim uristr As String = "geo:" + textBox6.Text.Trim + "," + textBox8.Text.Trim   'uriDim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度status = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF地图坐标数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF地图坐标标签", havelock, keyEn)End IfEnd SubPrivate Sub button6_Click(sender As Object, e As EventArgs) Handles button6.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = ""     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = 5 '呼叫电话的链接前缀为5Dim uristr As String = textBox9.Text.Trim   'uri呼叫电话Dim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度status = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF呼叫电话数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF呼叫电话标签", havelock, keyEn)End IfEnd SubPrivate Sub button7_Click(sender As Object, e As EventArgs) Handles button7.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim infostr As String = "BEGIN:VCARD" & Chr(10)    'infostr = infostr + "VERSION:3.0" & Chr(10)infostr = infostr + "FN:" + textBox12.Text.Trim() & Chr(10)   '姓名infostr = infostr + "TEL:" + textBox11.Text.Trim() & Chr(10)  '电话infostr = infostr + "ORG:" + textBox10.Text.Trim() & Chr(10)  '单位名称infostr = infostr + "ADR:" + textBox15.Text.Trim() & Chr(10)  '地址infostr = infostr + "EMAIL:" + textBox13.Text.Trim() & Chr(10) '邮箱infostr = infostr + "URL:" + textBox14.Text.Trim() & Chr(10)  '官网infostr = infostr + "END:VCARD" & Chr(10)Dim infostrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(infostr).Length '名片长度status = tagbuf_addbusinesscard(infostr, infostrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF电子名片数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF电子名片标签", havelock, keyEn)End IfEnd SubPrivate Sub button9_Click(sender As Object, e As EventArgs) Handles button9.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim ssidstr As String = textBox16.Text.Trim    '热点名称        Dim ssidstrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(ssidstr).Length '热点名称长度Dim authtype As Integer = comboBox2.SelectedIndex '认证方式Dim crypttype As Integer = comboBox3.SelectedIndex '加密算法Dim keystr As String = textBox17.Text.Trim '密码Dim keystrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(keystr).Length '密码长度status = tagbuf_addwifi(ssidstr, ssidstrlen, authtype, crypttype, keystr, keystrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF无线连接数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF无线连接标签", havelock, keyEn)End IfEnd SubPrivate Sub button10_Click(sender As Object, e As EventArgs) Handles button10.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim blenamestr As String = textBox19.Text.Trim    '设备名称        Dim blenamestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(blenamestr).Length '设备名称长度Dim macstr() As String = Split(textBox18.Text.Trim, ":")Dim macbuf(0 To 5) As ByteTrymacbuf(0) = "&H" & macstr(0)macbuf(1) = "&H" & macstr(1)macbuf(2) = "&H" & macstr(2)macbuf(3) = "&H" & macstr(3)macbuf(4) = "&H" & macstr(4)macbuf(5) = "&H" & macstr(5)Catch ex As ExceptionMessageBox.Show("蓝牙设备的MAC地址输入错误,请输入正确的MAC地址!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)textBox18.Select()End Trystatus = tagbuf_addbluetooth(blenamestr, blenamestrlen, macbuf(0))   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF蓝牙连接数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF蓝牙连接标签", havelock, keyEn)End IfEnd SubPrivate Sub comboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles comboBox4.SelectedIndexChangedDim appstr() As String = Split(comboBox4.Text.Trim, ":")textBox20.Text = appstr(1)End SubPrivate Sub button11_Click(sender As Object, e As EventArgs) Handles button11.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim packagestr As String = textBox20.Text.Trim    'APP名称        Dim packagestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(packagestr).Length 'APP名称长度status = tagbuf_addapp(packagestr, packagestrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF启动应用数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF启动应用标签", havelock, keyEn)End IfEnd SubPrivate Sub button2_Click(sender As Object, e As EventArgs) Handles button2.ClickDim status As ByteDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲        Dim typestr As String = textBox2.Text.Trim    '数据类型 Dim typestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(typestr).Length '数据类型长度Dim datastr As String = textBox3.Text.Trim    '数据Dim datastrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(datastr).Length '数据长度status = tagbuf_adddata(typestr, typestrlen, datastr, datastrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF数据标签缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseWriteDataBufToTag("NDEF数据标签", havelock, keyEn)End IfEnd SubPrivate Sub button12_Click(sender As Object, e As EventArgs) Handles button12.ClickDim status As ByteDim afi As ByteDim myctrlword As ByteDim mypiccserial(0 To 7) As ByteDim mypiccseriallen(0 To 1) As ByteDim revstrlen(0 To 1) As ByteDim recordnumber(0 To 1) As ByteDim mypiccdata(0 To 2047) As ByteDim carduid As String = ""Dim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护textBox21.Text = ""status = 255Dim cardtype As Byte = checkcardtype()Select Case cardtypeCase 1  'Ntag2x标签If havelock Then myctrlword = "&H10" Else myctrlword = 0status = forumtype2_read_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0))carduid = "Ntag2UID:"For i = 0 To 6carduid = carduid + mypiccserial(i).ToString("X02")NextCase 2  '15693标签myctrlword = 0afi = 0status = forumtype5_read_ndeftag(myctrlword, afi, mypiccserial(0))carduid = "15693UID:"For i = 0 To 7carduid = carduid + mypiccserial(i).ToString("X02")NextCase 3  'MifareClass标签myctrlword = 144status = piccread_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0))carduid = "MifareClassUID:"For i = 0 To 3carduid = carduid + mypiccserial(i).ToString("X02")NextCase 4  'ForumType4标签myctrlword = 0     '0表示标签无密码,如设置密码取值  &H40 ,mypicckey 存放密码status = forumtype4_read_ndeftag(myctrlword, mypiccserial(0), mypiccseriallen(0), oldpicckey(0))carduid = "ForumType4UID:"For i = 0 To mypiccseriallen(0) - 1carduid = carduid + mypiccserial(i).ToString("X02")NextCase ElseMessageBox.Show("请刷有效的NFC标签!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)End SelectIf status = 0 Thenpcdbeep(38)tagbuf_read(mypiccdata(0), revstrlen(0), recordnumber(0))Dim ndefstr As String = System.Text.Encoding.Default.GetString(mypiccdata)textBox21.Text = carduid & Chr(13) & Chr(10) & ndefstrEnd IfEnd SubPrivate Sub button13_Click(sender As Object, e As EventArgs) Handles button13.ClickDim status As ByteDim afi As ByteDim i As IntegerDim myctrlword As Byte              '控制字Dim mypiccserial(0 To 7) As Byte    '卡序列号Dim mypiccseriallen(0 To 1) As ByteDim carduid As StringDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = False            '清空标签,强制清空密钥checkBox2.Checked = False               '清空标签,强制清空密钥tagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲  Dim cardtype As Byte = checkcardtype()Select Case cardtypeCase 1  'Ntag2x标签If havelock Then myctrlword = "&H10" Else myctrlword = 0status = forumtype2_write_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0))If status = 0 ThenNtagKeyEn(mypiccserial(0), havelock, keyEn)   '开启或关闭Ntag2x标签密码保护功能pcdbeep(38)carduid = "Ntag2UID:"For i = 0 To 6carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + ",NDEF标签信息已清空!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 2  '15693标签myctrlword = 0afi = 0status = forumtype5_write_ndeftag(myctrlword, afi, mypiccserial(0))If status = 0 Thenpcdbeep(38)carduid = "15693UID:"For i = 0 To 7carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + ",NDEF标签信息已清空!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 3  'MifareClass标签If havelock Then myctrlword = 210 Else myctrlword = 146status = piccclear_ndeftag(myctrlword, mypiccserial(0), oldpicckey(0))If status = 0 Thenpcdbeep(38)carduid = "MifareClassUID:"For i = 0 To 3carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + ",NDEF标签信息已清空!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase 4  'ForumType4标签myctrlword = 0     '0表示标签无密码,如设置密码取值  &H40 ,mypicckey 存放密码status = forumtype4_write_ndeftag(myctrlword, mypiccserial(0), mypiccseriallen(0), oldpicckey(0))If status = 0 Thenpcdbeep(38)carduid = "ForumType4UID:"For i = 0 To mypiccseriallen(0) - 1carduid = carduid + mypiccserial(i).ToString("X02")NextMessageBox.Show(carduid + ",NDEF标签信息已清空!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)Elsedisperrinf(status)End IfCase ElseMessageBox.Show("请刷有效的NFC标签!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)End SelectEnd SubPrivate Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Clicktagbuf_forumtype4_clear()   '清空现有标签数据缓冲tagbuf_clear()              '清空现有标签数据缓冲MessageBox.Show("NDEF数据缓冲已经清除!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End SubPrivate Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.ClickDim havelock As Boolean = checkBox1.Checked     '卡片是否已加密保护Dim keyEn As Boolean = checkBox2.Checked        '是否启用密码保护写入的NDEF信息WriteDataBufToTag("NDEF组合标签", havelock, keyEn)End SubPrivate Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.ClickDim status As ByteDim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim textstr As String = textBox1.Text.TrimDim textstrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(textstr).Lengthstatus = tagbuf_addtext(languagecodestr, languagecodestrlen, textstr, textstrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF纯文本标签数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF纯文本标签数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.ClickDim status As ByteDim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = textBox4.Text.Trim     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = comboBox1.SelectedIndex '前缀Dim uristr As String = textBox5.Text.Trim   'uriDim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度status = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF智能海报数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF智能海报数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.ClickDim status As ByteDim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = textBox7.Text.Trim     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = 0 '地理位置没有链接前缀Dim uristr As String = "geo:" + textBox6.Text.Trim + "," + textBox8.Text.Trim   'uriDim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度status = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF地图坐标数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF地图坐标数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.ClickDim status As ByteDim languagecodestr As String = "en"    '语言编码,英文为en,中文为zhDim languagecodestrlen As Integer = languagecodestr.LengthDim titlestr As String = ""     '标题Dim titlestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(titlestr).Length    '标题长度Dim uriheaderindex As Integer = 5 '呼叫电话的链接前缀为5Dim uristr As String = textBox9.Text.Trim   'uri呼叫电话Dim uristrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(uristr).Length 'uri长度status = tagbuf_adduri(languagecodestr, languagecodestrlen, titlestr, titlestrlen, uriheaderindex, uristr, uristrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF呼叫电话数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF呼叫电话数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.ClickDim status As ByteDim infostr As String = "BEGIN:VCARD" & Chr(10)    'infostr = infostr + "VERSION:3.0" & Chr(10)infostr = infostr + "FN:" + textBox12.Text.Trim() & Chr(10)   '姓名infostr = infostr + "TEL:" + textBox11.Text.Trim() & Chr(10)  '电话infostr = infostr + "ORG:" + textBox10.Text.Trim() & Chr(10)  '单位名称infostr = infostr + "ADR:" + textBox15.Text.Trim() & Chr(10)  '地址infostr = infostr + "EMAIL:" + textBox13.Text.Trim() & Chr(10) '邮箱infostr = infostr + "URL:" + textBox14.Text.Trim() & Chr(10)  '官网infostr = infostr + "END:VCARD" & Chr(10)Dim infostrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(infostr).Length '名片长度status = tagbuf_addbusinesscard(infostr, infostrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF电子名片数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF电子名片数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.ClickDim status As ByteDim ssidstr As String = textBox16.Text.Trim    '热点名称        Dim ssidstrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(ssidstr).Length '热点名称长度Dim authtype As Integer = comboBox2.SelectedIndex '认证方式Dim crypttype As Integer = comboBox3.SelectedIndex '加密算法Dim keystr As String = textBox17.Text.Trim '密码Dim keystrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(keystr).Length '密码长度status = tagbuf_addwifi(ssidstr, ssidstrlen, authtype, crypttype, keystr, keystrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成WIFI无线连接数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成WIFI无线连接数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.ClickDim status As ByteDim blenamestr As String = textBox19.Text.Trim    '设备名称        Dim blenamestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(blenamestr).Length '设备名称长度Dim macstr() As String = Split(textBox18.Text.Trim, ":")Dim macbuf(0 To 5) As ByteTrymacbuf(0) = "&H" & macstr(0)macbuf(1) = "&H" & macstr(1)macbuf(2) = "&H" & macstr(2)macbuf(3) = "&H" & macstr(3)macbuf(4) = "&H" & macstr(4)macbuf(5) = "&H" & macstr(5)Catch ex As ExceptionMessageBox.Show("蓝牙设备的MAC地址输入错误,请输入正确的MAC地址!", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)textBox18.Select()End Trystatus = tagbuf_addbluetooth(blenamestr, blenamestrlen, macbuf(0))   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF蓝牙连接数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF蓝牙连接数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.ClickDim status As ByteDim packagestr As String = textBox20.Text.Trim    'APP名称        Dim packagestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(packagestr).Length 'APP名称长度status = tagbuf_addapp(packagestr, packagestrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF启动应用数据缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF启动应用数据缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.ClickDim status As ByteDim typestr As String = textBox2.Text.Trim    '数据类型 Dim typestrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(typestr).Length '数据类型长度Dim datastr As String = textBox3.Text.Trim    '数据Dim datastrlen As Integer = System.Text.Encoding.GetEncoding(936).GetBytes(datastr).Length '数据长度status = tagbuf_adddata(typestr, typestrlen, datastr, datastrlen)   '可以用此方法写入多条记录到数据缓冲If status <> 0 ThenMessageBox.Show("生成NDEF数据标签缓冲时返回码错误代码:" + status, "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Error)ElseMessageBox.Show("    生成NDEF数据标签缓冲成功,可以向缓冲区继续添加记录,也可以将缓冲区内数据写标签。", "示例提示", MessageBoxButtons.OK, MessageBoxIcon.Information)End IfEnd SubPrivate Sub disperrinf(ByVal errcode As Byte)Select Case errcodeCase 1MessageBox.Show("错误代码:" + errcode.ToString() + ",0~2块都没读出来,可能刷卡太块。但卡序列号已被读出来!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 2MessageBox.Show("错误代码:" + errcode.ToString() + ",第0块已被读出,但1~2块读取失败。卡序列号已被读出来!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 3MessageBox.Show("错误代码:" + errcode.ToString() + ",第0、1块已被读出,但2块读取失败。卡序列号已被读出来!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 8MessageBox.Show("错误代码:" + errcode.ToString() + ",未寻到卡,请重新拿开卡后再放到感应区!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 9MessageBox.Show("错误代码:" + errcode.ToString() + ",寻卡过程中防冲突失败,读序列吗错误!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 10MessageBox.Show("错误代码:" + errcode.ToString() + ",该卡可能已被休眠,无法选中卡片!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 11MessageBox.Show("错误代码:" + errcode.ToString() + ",密码装载失败!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 12MessageBox.Show("错误代码:" + errcode.ToString() + ",标签密码认证错误!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 13MessageBox.Show("错误代码:" + errcode.ToString() + ",读标签失败,原因是刷卡太快或本块所对应的区还没通过密码认证!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 14MessageBox.Show("错误代码:" + errcode.ToString() + ",写标签失败,可能需要验证密码!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 21MessageBox.Show("错误代码:" + errcode.ToString() + ",没有动态库!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 22MessageBox.Show("错误代码:" + errcode.ToString() + ",动态库或驱动程序异常!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 23MessageBox.Show("错误代码:" + errcode.ToString() + ",未检测到发卡器!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 24MessageBox.Show("错误代码:" + errcode.ToString() + ",操作超时,一般是动态库没有反映!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 25MessageBox.Show("错误代码:" + errcode.ToString() + ",发送字数不够!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 26MessageBox.Show("错误代码:" + errcode.ToString() + ",发送的CRC错!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 27MessageBox.Show("错误代码:" + errcode.ToString() + ",接收的字数不够!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 28MessageBox.Show("错误代码:" + errcode.ToString() + ",接收的CRC错!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 45MessageBox.Show("错误代码:" + errcode.ToString() + ",此卡不支持更改UID号或UID块已被锁定!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 46MessageBox.Show("错误代码:" + errcode.ToString() + ",标签存储空间不足!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case 254MessageBox.Show("错误代码:" + errcode.ToString() + ",标签存储空间不足!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)Case ElseMessageBox.Show("错误代码:" + errcode.ToString() + ",未知错误!", "Note:", MessageBoxButtons.OK, MessageBoxIcon.Stop)End SelectEnd Sub
End Class

源码下载:Vb.net读写Ndef标签源码资源-CSDN文库

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

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

相关文章

Python编程和开发过程中让人编程效率和舒适度很高的工具Anaconda

编程工作为什么需要提高效率&#xff1f; 在日益繁忙的工作环境中&#xff0c;选择合适的编程工具已成为提升开发者工作效率的关键。不同的工具能够帮助我们简化代码编写、自动化任务、提升调试速度&#xff0c;甚至让团队协作更加顺畅。 那么&#xff0c;编写python代码过程中…

c#使用winscp库实现FTP/SFTP/SCP的获取列表、上传和下载功能

网上写c#调用winscp实现的资料很少&#xff0c;且写的不够详细。本人查了下winscp的libraries说明&#xff0c;写了个小工具&#xff0c;供大家参考。 winscp的接口说明地址如下&#xff1a; WinSCP .NET Assembly and COM Library :: WinSCP 一、先展示一下小工具的界面 1、…

资源《Arduino 扩展板3-WS2812》说明。

资源链接&#xff1a; Arduino 扩展板3-WS2812 1.文件明细&#xff1a; 2.文件内容说明 包含&#xff1a;AD工程、原理图、PCB。 3.内容展示 4.简述 该文件为PCB工程&#xff0c;采用AD做的。 该文件打板后配合Arduino使用&#xff0c;属于Arduino的扩展板。 该文件主要…

AI助力CMIP6数据处理技术及在气候变化、生态农业、水文多领域实践应用

查看原文>>>AI助力CMIP6数据处理技术及在气候变化、生态农业、水文多领域实践应用 目录 专题一 CMIP6中的模式比较计划 专题二 数据下载 专题三 基础知识3.1 Python基础 专题四 单点降尺度 专题五 统计方法的区域降尺度 专题六 基于WRF模式的动力降尺度 专题七…

RabbitMQ的相关题

一、 MQ的作⽤及应⽤场景 类似问题: 项⽬什么场景下使⽤到了MQ, 为什么需要MQ? RabbitMQ 的作⽤?使⽤场景有哪些? RabbitMQ…

【Linux】第一个小程序——进度条实现

&#x1f525; 个人主页&#xff1a;大耳朵土土垚 &#x1f525; 所属专栏&#xff1a;Linux系统编程 这里将会不定期更新有关Linux的内容&#xff0c;欢迎大家点赞&#xff0c;收藏&#xff0c;评论&#x1f973;&#x1f973;&#x1f389;&#x1f389;&#x1f389; 文章目…

Docker仓库搭建

目录 一、Docker Hub 二、私有Registry仓库搭建 1、下载并开启仓库镜像registry 2、Registry加密传输 3、建立一个registry仓库 4、为客户端建立证书 5、测试 6、为仓库建立登录认证 三、Harbor仓库搭建 Docker 仓库&#xff08;Docker Registry&#xff09; 是用于存…

PHP程序如何实现限制一台电脑登录?

PHP程序如何实现限制一台电脑登录&#xff1f; 可以使用以下几种方法&#xff1a; 1. IP地址限制&#xff1a;在PHP中&#xff0c;可以通过获取客户端的IP地址&#xff0c;然后与允许登录的IP地址列表进行比对。如果客户端的IP地址不在列表中&#xff0c;就禁止登录。 “php $…

快速创建第一个Spring Boot 项目

一、介绍 Spring Boot 是一个开源的 Java 基础框架&#xff0c;它基于 Spring 框架&#xff0c;用于创建独立、生产级别的基于 Spring 的应用程序&#xff0c;你可以“跑起来”&#xff08;run&#xff09;你的 Spring 应用程序。Spring Boot 让基于 Spring 的应用开发变得更容…

基于单片机的两轮直立平衡车的设计

本设计基于单片机设计的两轮自平衡小车&#xff0c;其中机械部分包括车体、车轮、直流电机、锂电池等部件。控制电路板采用STC12C5A60S2作为主控制器&#xff0c;采用6轴姿态传感器MPU6050测量小车倾角&#xff0c;采用TB6612FNG芯片驱动电机。通过模块化编程完成了平衡车系统软…

leetcode:380. O(1) 时间插入、删除和获取随机元素

实现RandomizedSet 类&#xff1a; RandomizedSet() 初始化 RandomizedSet 对象bool insert(int val) 当元素 val 不存在时&#xff0c;向集合中插入该项&#xff0c;并返回 true &#xff1b;否则&#xff0c;返回 false 。bool remove(int val) 当元素 val 存在时&#xff0…

前端框架对比和选择指南

前端框架对比和选择指南 随着 Web 开发技术的快速发展&#xff0c;前端框架已经成为了现代 Web 开发的核心工具之一。它们为开发人员提供了快速构建高效、交互性强的应用的基础。当前流行的前端框架主要包括 React.js、Vue.js 和 Angular.js。在这篇技术博客中&#xff0c;我们…

如何创建一个docker,给它命名,且下次重新打开它

1.创建一个新的docker并同时命名 docker run -it --name one ubuntu:18.04 /bin/bash 这时候我们已经创建了一个docker,并且命名为"one" 2.关闭当前docker exit 3.这时docker已经终止了&#xff0c;我们需要使用它要重新启动 docker start one 4.现在可以重新打…

react crash course 2024(7) react router dom

安装 npm i react-router-dom 引入 import {Route,createBrowserRouter,createRoutesFromElements,RouterProvider} from react-router-dom 在app.jsx const router createBrowserRouter(createRoutesFromElements(<Route index element {<h1>My App</h1>…

基于51单片机的3路电压测量-proteus仿真

地址&#xff1a;https://pan.baidu.com/s/1PG2vzudc1QKHGSBfjPF0eQ 提取码&#xff1a;1234 仿真图&#xff1a; 芯片/模块的特点&#xff1a; AT89C52/AT89C51简介&#xff1a; AT89C52/AT89C51是一款经典的8位单片机&#xff0c;是意法半导体&#xff08;STMicroelectron…

金智维KRPA之Excel自动化

Excel自动化操作概述 Excel自动化主要用于帮助各种类型的企业用户实现Excel数据处理自动化&#xff0c;Excel自动化是可以从单元格、列、行或范围中读取数据&#xff0c;向其他电子表格或工作簿写入数据等活动。 通过相关命令&#xff0c;还可以对数据进行排序、进行格式…

QT 界面编程中使用协程

QT 界面编程中使用协程 一、概述二、集成2.1、编译 Acl2.2、将 Acl 库集成到 QT 项目中2.3、开始编写代码2.3.1、QT 程序初始化时初始化 Acl 协程2.3.2、在界面中创建协程2.3.3、界面程序退出前需要停止协程调度2.3.4、在界面线程中下载数据2.3.5、在协程中延迟创建窗口 2.4、效…

[sql-04] 连续出现至少三次的数字

数据准备 CREATE TABLE leecode_01 (id bigint not null AUTO_INCREMENT,num int DEFAULT NULL COMMENT 用户名,primary key(id) ) ENGINEInnoDB DEFAULT CHARSETutf8mb4 COMMENT leecode(连续出现3次的数字)insert into leecode_01(num) values(12); insert into leecode_01…

C++入门基础 (超详解)

文章目录 前言1. C关键字2. C的第一个程序3. 命名空间3.1 namespace的定义3.2 命名空间的嵌套3.3 命名空间使用3.4 查找优先级总结 4. C输入和输出4.1 标准输入输出 (iostream库)4.2 文件输入输出 (fstream库)4.3 字符串流 (sstream库)4.4 C格式化输出4.5 std::endl和\n的区别 …

废物利用,三百块电脑如何升级并安装双系统便携使用

文章目录 引言最初的配置开始改装更换内存升级硬盘2.5 英寸 sata 固态msata 加装 升级电池其他的升级娱乐大师跑分 双系统安装前提条件设置 Bios安装 win 10安装 Manjaro时间同步问题 屏幕问题黑屏难开 引言 最近浏览 b 站的二手笔记本信息&#xff0c;想要整个二手笔记本玩玩…