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.mzph.cn/news/880868.shtml

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

相关文章

矩阵系统源码搭建的具体步骤,支持oem,源码搭建

一、前期准备 明确需求 确定矩阵系统的具体用途&#xff0c;例如是用于社交媒体管理、电商营销还是其他领域。梳理所需的功能模块&#xff0c;如多账号管理、内容发布、数据分析等。 技术选型 选择适合的编程语言&#xff0c;如 Python、Java、Node.js 等。确定数据库类型&…

Activiti7 工作流引擎学习

目录 一. 什么是 Activiti 工作流引擎 二. Activiti 流程创建步骤 三. Activiti 数据库表含义 四. BPMN 建模语言 五. Activiti 使用步骤 六. 流程定义与流程实例 一. 什么是 Activiti 工作流引擎 Activiti 是一个开源的工作流引擎&#xff0c;用于业务流程管理&#xf…

Linux开发讲课45--- 链表

Linux内核代码中广泛使用了数据结构和算法,其中最常用的有链表、队列kfifo、红黑树、基数树和位图。 链表 Linux内核代码大量使用了链表这种数据结构。链表是在解决数组不能动态扩展这个缺陷而产生的一种数据结构。 链表所包含的元素可以动态创建并插入和删除。链表的每个元素…

【经典机器学习算法】谱聚类算法及其实现(python)

&#x1f308; 个人主页&#xff1a;十二月的猫-CSDN博客 &#x1f525; 系列专栏&#xff1a; &#x1f3c0;深度学习_十二月的猫的博客-CSDN博客 &#x1f4aa;&#x1f3fb; 十二月的寒冬阻挡不了春天的脚步&#xff0c;十二点的黑夜遮蔽不住黎明的曙光 目录 1. 前言 2. 前…

躺平成长:微信小程序运营日记第二天

在进行属于生活的开源之后&#xff0c;自己更加感受到自己存在的渺茫&#xff0c;同时更加开始深刻领会&#xff0c;开源的重要性&#xff0c;在开源&#xff0c;开放&#xff0c;创造&#xff0c;再创新的思维模式下&#xff0c;不发布八部金刚功相关的训练视频&#xff0c;自…

每日一题|983. 最低票价|动态规划、记忆化递归

本题求解最小值&#xff0c;思路是动态规划&#xff0c;但是遇到的问题是&#xff1a;动态规划更新的顺序和步长&#xff0c;以及可能存在的递归溢出问题。 1、确定dp数组含义 dp[i]表示第i天到最后一天&#xff08;可能不在需要出行的天数里&#xff09;&#xff0c;需要花费…

Suricata:开源网络分析和威胁检测

Suricata 是一款高性能、开源网络分析和威胁检测软件&#xff0c;被大多数私人和公共组织使用&#xff0c;并被主要供应商嵌入以保护他们的资产。 Suricata 功能 Suricata 提供全面的网络安全监控 (NSM) 功能&#xff0c;包括记录 HTTP 请求、捕获和存储 TLS 证书以及从网络流…

汽车3d动画渲染选择哪个?选择最佳云渲染解决方案

面临汽车3D动画渲染挑战&#xff1f;选择正确的云渲染服务至关重要。探索最佳解决方案&#xff0c;优化渲染效率&#xff0c;快速呈现逼真动画。 汽车3d动画渲染选择哪个&#xff1f; 对于汽车3D动画渲染&#xff0c;选择哪个渲染器取决于你的项目需求、预算和期望的效果。Ble…

yolov8/9/10模型在安全帽、安全衣检测中的应用【代码+数据集+python环境+GUI系统】

yolov8910模型安全帽、安全衣检测中的应用【代码数据集python环境GUI系统】 yolov8/9/10模型在安全帽、安全衣检测中的应用【代码数据集python环境GUI系统】 背景意义 安全帽和安全衣在工业生产、建筑施工等高风险作业环境中是保护工人免受意外伤害的重要装备。然而&#xff0…

Qt 学习第十一天:QTableWidget 的使用

一、创建QTableWidget对象&#xff0c;设置大小&#xff0c;在窗口的位置 //创建tablewidgetQTableWidget *table new QTableWidget(this);table->resize(550, 300);table->move(100, 100); //移动 二、设置表头 //设置表头QStringList headerList; //定义headerList…

web开发(1)-基础

这是对b站课程的总结&#xff0c;后续可能会继续更 01 前后端分离介绍_哔哩哔哩_bilibili01 前后端分离介绍是Web应用开发-后端基础-基于Springboot框架的第1集视频&#xff0c;该合集共计29集&#xff0c;视频收藏或关注UP主&#xff0c;及时了解更多相关视频内容。https://w…

GPG error golang 1.19

1. 问题描述及原因分析 在飞腾2000的服务器&#xff0c;OS为Kylin Linux Advanced Server release V10环境下&#xff0c;docker版本为18.09.0&#xff08;docker-engine-18.09.0-101.ky10.aarch64&#xff09;&#xff0c;基于容器镜像golang:1.19编译新的容器镜像&#xff0…

【C++篇】启航——初识C++(上篇)

下篇&#xff1a;【C篇】启航——初识C&#xff08;下篇&#xff09; 目录 引言 一、C的起源和发展史 1.起源 2.C版本更新 二、C在⼯作领域中的应⽤ 三、C入门建议 1.参考文档 2.推荐书籍 四、C的第一个程序 1.C语言写法 2.C写法 五、命名空间 1.为什么要有命名空…

AI 对话工具汇总

&#x1f423;个人主页 可惜已不在 &#x1f424;这篇在这个专栏AI_可惜已不在的博客-CSDN博客 &#x1f425;有用的话就留下一个三连吧&#x1f63c; 目录 前言: 正文: 前言: 在科技飞速发展的时代&#xff0c;AI 对话正逐渐成为我们获取信息、交流思想的新方式。它以强…

若无向图G(V,E)中含7个顶点,为保证图G在任何情况下都是连通的,则需要的边数最少是多少?

这乍一看是不是可抽象&#xff08;迷糊&#xff09;了&#xff0c;butttt待我小翻译一下。 先举少一点的例子&#xff0c;假如我们有三个点&#xff0c;我给你两条边&#xff0c;那是不是不管咋连都一定一定是连通的。 那我们再进一步&#xff0c;假如四个点呢&#xff1f;我给…

RabbitMQ 界面管理说明

1.RabbitMQ界面访问端口和后端代码连接端口不一样 界面端口是15672 http://localhost:15672/ 后端端口是 5672 默认账户密码登录 guest 2.总览图 3.RabbitMq数据存储位置 4.队列 4.客户端消费者连接状态 5.队列运行状态 6.整体运行状态

在Linux中将设备驱动的地址映射到用户空间

本期主题&#xff1a; MMU的简单介绍&#xff0c;以及如何实现设备地址映射到用户空间 往期链接&#xff1a; Linux内核链表零长度数组的使用inline的作用嵌入式C基础——ARRAY_SIZE使用以及踩坑分析Linux下如何操作寄存器&#xff08;用户空间、内核空间方法讲解&#xff09;…

Redis篇(最佳实践)(持续更新迭代)

介绍一&#xff1a;键值设计 一、优雅的key结构 Redis 的 Key 虽然可以自定义&#xff0c;但最好遵循下面的几个最佳实践约定&#xff1a; 遵循基本格式&#xff1a;[业务名称]:[数据名]:[id]长度不超过 44 字节不包含特殊字符 例如&#xff1a; 我们的登录业务&#xff0…

『功能项目』宠物的攻击巨型化【80】

本章项目成果展示 我们打开上一篇79宠物的召唤跟随的项目&#xff0c; 本章要做的事情是实现在战斗中有几率触发宠物巨型化攻击将怪物击飞的效果 首先在主角预制体中增加隐藏的宠物巨型化 制作巨型化宠物的攻击效果 将该动画控制器放置在隐藏的巨型化宠物的动画控制器上 首先查…

Linux下的基本指令/命令(一)

目录 基本命令 1. Is命令/指令: 罗列当前目录下指定的文件或者目录. 2. pwd命令&#xff1a; 查看当前工作的路径 3. cd命令&#xff1a; 切换到指定路径下。 只能切换到目录中 4. tree命令: 树状显式目录 使用前要输入命令 yum install -y tree &#xff0c;用来安装一个…