VbScript脚本Request获取RFID读卡器以HTTP提交的访问文件中的参数Response回应驱动读卡器显示、播报语音

这篇具有很好参考价值的文章主要介绍了VbScript脚本Request获取RFID读卡器以HTTP提交的访问文件中的参数Response回应驱动读卡器显示、播报语音。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

本示例使用的设备:RFID网络WIFI无线TCP/UDP/HTTP可编程二次开发读卡器POE供电语音-淘宝网 (taobao.com) 文章来源地址https://www.toymoban.com/news/detail-668159.html


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<%
Function bin2str(bindata)
    Dim rsStream, strls
    Set rsStream = Server.CreateObject("ADODB.Stream")
    rsStream.Type = 2
    rsStream.Open
    rsStream.WriteText bindata
    rsStream.Position = 0
    rsStream.Charset = "utf-8" 
    rsStream.Position = 2
    strls = rsStream.ReadText
    rsStream.Close
    Set rsStream = Nothing
    bin2str = strls
End Function

Function getpostval(totalstr, namestr)
    Dim p1, p2, k, strls
    k = Len(namestr) + 2
    strls = "&" + totalstr + "&"
    p1 = InStr(strls, "&" + namestr + "=")
    If p1 = 0 Then
        getpostval = ""
        Exit Function
    End If
    p2 = InStr(p1 + k, strls, "&")
    If p2 > (p1 + k) Then
        getpostval = Mid(strls, p1 + k, p2 - (p1 + k))
    Else
        getpostval = ""
    End If
End Function

Function getjsonval(totalstr, namestr)
    Dim p1, p2, k, n, strls
    n = Len(totalstr)
    If n < 5 Then
        getjsonval = ""
        Exit Function
    End If
    If (Left(totalstr, 1) <> "{") Or (Right(totalstr, 1) <> "}") Then
        getjsonval = ""
        Exit Function
    End If
    strls = "," + Mid(totalstr, 2, n - 2) + ","
    k = Len(namestr) + 4
    p1 = InStr(strls, ",""" + namestr + """:")
    If p1 < 1 Then
        getjsonval = ""
        Exit Function
    End If
    p2 = InStr(p1 + k, strls, ",")
    If p2 > (p1 + k) Then
        getjsonval = Mid(strls, p1 + k, p2 - (p1 + k))
        If (Left(getjsonval, 1) <> """") Or (Right(getjsonval, 1) <> """") Then
            getjsonval = ""
            Exit Function
        End If
        n = Len(getjsonval)
        If n < 3 Then
            getjsonval = ""
            Exit Function
        End If
        getjsonval = Mid(getjsonval, 2, n - 2)
    Else
        getjsonval = ""
    End If
End Function

'Parse Get information------------------------------------------------------------
info = Request.QueryString("info")     'Information frame
jihao = Request.QueryString("jihao")   'Equipment number(can modify)
caretype = Request.QueryString("cardtype") 'The card type can be IC, ID, or ISO15693
card = Request.QueryString("card")     'Hexadecimal card printing number
Data = Request.QueryString("data")     'Card sector data
dn = Request.QueryString("dn")         'Hardware serial number of equipment, factory has been cured, unique in the world
Status = Request.QueryString("status") 'Read card status. For example, the password authentication failure is 12

If ((info <> "") And (jihao <> "") And (caretype <> "") And (card <> "")) Then   
    Str = "Response="    'Fixed prefix that our device uses to retrieve the return information
    Str = Str + "1,"     'Information type: 1 indicates the display and sound of the driving device
    Str = Str + info     'Information frame	
    Str = Str + ",{CardNo:}"  + card  + "\nWelcome to user !"   'LCD display infomation
    Str = Str + ",20"    'Display delay of 20 seconds
    Str = Str + ",1"     'Buzzer sound type
    Str = Str + ",0"     'Chinese phonetic code
    response.Write (Str)
    response.end
Else
    'Parse POST information**********************************
    poststrlen = Request.TotalBytes 'length
    If poststrlen > 0 Then		
        poststr = bin2str(Request.BinaryRead(poststrlen))		        
        info = getpostval(poststr, "info")         'Information frame
        jihao = getpostval(poststr, "jihao")       'Equipment number(can modify)
        caretype = getpostval(poststr, "cardtype") 'The card type can be IC, ID, or ISO15693
        card = getpostval(poststr, "card")         'Hexadecimal card printing number
        Data = getpostval(poststr, "data")         'Card sector data
        dn = getpostval(poststr, "dn")             'Hardware serial number of equipment, factory has been cured, unique in the world
        Status = getpostval(poststr, "status")     'Read card status. For example, the password authentication failure is 12
        If ((info <> "") And (jihao <> "") And (caretype <> "") And (card <> "")) Then
            Str = "Response="      'Fixed prefix that our device uses to retrieve the return information
            Str = Str + "1,"       'Information type: 1 indicates the display and sound of the driving device
            Str = Str + info       'Information frame	
	        Str = Str + ",{CardNo:}"  + card  + "\nWelcome to user !"   ''LCD display infomation
            Str = Str + ",20"      'Display delay of 20 seconds
            Str = Str + ",1"       'Buzzer sound type
            Str = Str + ",0"       'Chinese phonetic code
            response.Write (Str)
            response.end
        Else
            'Parse  json information**********************************
            info = getjsonval(poststr, "info")         'Information frame
            jihao = getjsonval(poststr, "jihao")       'Equipment number(can modify)
            caretype = getjsonval(poststr, "cardtype") 'The card type can be IC, ID, or ISO15693
            card = getjsonval(poststr, "card")         'Hexadecimal card printing number
            Data = getjsonval(poststr, "data")         'Card sector data
            dn = getjsonval(poststr, "dn")             'Hardware serial number of equipment, factory has been cured, unique in the world
            Status = getjsonval(poststr, "status")     'Read card status. For example, the password authentication failure is 12
            If ((info <> "") And (jihao <> "") And (caretype <> "") And (card <> "")) Then
                Str = "Response="      'Fixed prefix that our device uses to retrieve the return information
                Str = Str + "1,"       'Information type: 1 indicates the display and sound of the driving device
                Str = Str + info       'Information frame	
                Str = Str + ",{CardNo:}"  + card  + "\nWelcome to user !"   ''LCD display infomation
                Str = Str + ",20"      'Display delay of 20 seconds
                Str = Str + ",1"       'Buzzer sound type
                Str = Str + ",0"       'Chinese phonetic code
                response.Write (Str)
                response.end
            End If            
        End If
    End If
End If

%>

到了这里,关于VbScript脚本Request获取RFID读卡器以HTTP提交的访问文件中的参数Response回应驱动读卡器显示、播报语音的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • PHP实现轻量级WEB服务器接收HTTP提交的RFID刷卡信息并回应驱动读卡器显示播报语音

     本示例使用的读卡器:RFID网络WIFI无线TCP/UDP/HTTP可编程二次开发读卡器POE供电语音-淘宝网 (taobao.com)

    2024年02月12日
    浏览(28)
  • STM32CubeMX教程30 USB_DEVICE - MSC外设_读卡器

    正点原子stm32f407探索者开发板V2.4 STM32CubeMX软件(Version 6.10.0) keil µVision5 IDE(MDK-Arm) ST-LINK/V2驱动 野火DAP仿真器 XCOM V2.6串口助手 使用STM32CubeMX软件配置STM32F407开发板 USB_OTG_FS为工作在Mass Storage Class(大容量存储类)模式下的USB_DEVICE(USB从机),使其作为SD卡读卡器在Windows系

    2024年02月19日
    浏览(29)
  • 实时在线云消费机、考勤门禁控制器、网络读卡器服务端C# Socket源码

      消费机UDP通讯协议介绍: 设备向服务器发送的指令格式,每个字段用半角逗号(,)分隔。 序号 指令名称 指令格式 指令说明 示例 1 响应服务器的搜索 100,包序列号,终端IP,子网掩码,网关IP,远程电脑主机IP,端口号,终端硬件号 响应电脑发出的搜寻局域网内所有终端设备指令000

    2024年02月10日
    浏览(41)
  • 身份证阅读器和社保卡读卡器Harmony鸿蒙系统ArkTS语言SDK开发包

    项目需求,用ArkTS新一代开发语言实现了在Harmony鸿蒙系统上面兼容身份证阅读器和社保卡读卡器,调用了DonseeDeviceLib.har这个读卡库。 需要注意的是,鸿蒙系统的app扩展名为.hap,本项目编译输出的应用为:entry-default-signed.hap 下面是调用身份证阅读器读取身份证信息的接口,支

    2024年02月03日
    浏览(54)
  • 晨控CK-FR03-EIP读卡器与欧姆龙NX/NJ系列EtherNet/IP通讯手册

    晨控CK-FR03-EIP读卡器与欧姆龙NX/NJ系列EtherNet/IP通讯手册 CK-FR03-EIP是一款基于射频识别技术的高频RFID标签读卡器,读卡器工作频率为13.56MHZ,支持对I-CODE 2、I-CODE SLI等符合ISO15693国际标准协议格式标签的读取。 读卡器同时支持标准工业通讯协议EtherNet IP,方便用户通集成到PLC等

    2024年02月01日
    浏览(38)
  • 【正点原子STM32连载】 第六十章 USB读卡器实验摘自【正点原子】STM32F103 战舰开发指南V1.2

    1)实验平台:正点原子stm32f103战舰开发板V4 2)平台购买地址:https://detail.tmall.com/item.htm?id=609294757420 3)全套实验源码+手册+视频下载地址: http://www.openedv.com/thread-340252-1-1.html# 本章,我们将向大家介绍如何利用USB OTG FS在STM32F1开发板实现一个USB 读卡器。本章分为如下几个部分

    2024年02月16日
    浏览(38)
  • 【正点原子STM32连载】 第六十一章 USB读卡器(Slave)实验摘自【正点原子】APM32F407最小系统板使用指南

    1)实验平台:正点原子APM32F407最小系统板 2)平台购买地址:https://detail.tmall.com/item.htm?id=609294757420 3)全套实验源码+手册+视频下载地址: http://www.openedv.com/thread-340252-1-1.html## 本章将介绍使用APM32F407作为USB从设备,模拟出USB读卡器,使得PC与APM32F407通过USB连接后,能够访问与

    2024年02月21日
    浏览(38)
  • VBScript (vbs) 脚本实例

    欢迎小伙伴的点评✨✨ 本文将会给大家带来,VBScript简介及代码实例。 VBS是基于Visual Basic的脚本语言。VBS的全称是:Microsoft Visual Basic Script Edition。(微软公司可视化BASIC脚本版)。 vbs是系统内置的,用它编写的脚本不用编译成二进制文件,直接就由Windows系统宿主host解释源代

    2024年02月03日
    浏览(27)
  • STM32F103+RFID-RC522模块 实现简单读卡写卡demo

    本仓库发布的程序,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。 本人对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害。 间接使用脚本的任何用户,包括但不限于建立VPS或

    2023年04月09日
    浏览(32)
  • 使用VBScript脚本的快乐体验

    借鉴这位博主http://t.csdn.cn/y9NKS 1.关于vbs的创建,这个脚本是微软自带的,所以直接用txt文件修改后缀为vbs即可,注意,利用shift+ctrl+s另存为的时候将编码改为ANSI,不然运行的时候会出问题 2.之后就是直接在这个文件中写代码了,可以弹窗还是很好玩的: (1)msgbox和WScript.Echo两

    2024年02月12日
    浏览(25)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包