Python 了解简单串行接口编程协议-条形码扫描仪

Python 了解简单串行接口编程协议-条形码扫描仪,python,c,serial-port,barcode,barcode-scanner,Python,C,Serial Port,Barcode,Barcode Scanner,问题陈述: 我正在尝试构建一个简单的应用程序来读取QR/条形码信息并向用户显示显示(首选C/或Python) 用户将在系统中按下一个键 单击后,应启用条形码触发,并准备好扫描请求的条形码(QR/代码39) 用户扫描成功后,其数据应显示在屏幕上 读取/写入串行数据不是问题。我能做到 对于我正在使用的扫描仪型号,文档位于: 我唯一的困惑是形成帧SSI命令 我看到很多这样的例子。但是,我仍然不能清楚地遵循逻辑 unsigned char ledOn[] = {0x05, 0xE7, 0x04, 0x0

问题陈述:

我正在尝试构建一个简单的应用程序来读取QR/条形码信息并向用户显示显示(首选C/或Python)

  • 用户将在系统中按下一个键
  • 单击后,应启用条形码触发,并准备好扫描请求的条形码(QR/代码39)
  • 用户扫描成功后,其数据应显示在屏幕上
  • 读取/写入串行数据不是问题。我能做到

    对于我正在使用的扫描仪型号,文档位于:

    我唯一的困惑是形成帧SSI命令

    我看到很多这样的例子。但是,我仍然不能清楚地遵循逻辑

    unsigned char ledOn[] = {0x05, 0xE7, 0x04, 0x00, 0x0D, 0x00};
    unsigned char SSIBuffer[] = {0x00, 0xC6, 0x04, 0x08, 0x11, 0xEE, 0x01};
    
    以上是我从Stackoverflow()中获得的一些示例:

    通过与上面的扫描仪参考文档进行比较,我对信息进行了解码,以便进一步理解

    问题1

    在文档中,状态字段涉及4位数据:

        Bit 0: Retransmit
        0 = First transmission
        1 = Subsequent transmission
        Bit 1: Continuation
        0 = Last packet of a multipacket message
        1 = Intermediate packet
    
    我不清楚何时会设置上述位及其影响

    问题2

    ledOn[] = {0x05, 0xE7, 0x04, 0x00, 0x0D, 0x00};
    Length(Byte-1)
    Command(Byte-2)( LED_ON)
    Decoder(Byte-3)
    Status(Byte-4)
    LED Selection(Byte-5) //**Don’t know where to get this info**
    
    
    SSIBuffer[] = {0x00, 0xC6, 0x04, 0x08, 0x11, 0xEE, 0x01};
    Length(Byte-1) (Will change the buffer later from 0)
    Command(Byte-2) (PARAM_SEND)
    Decoder(Byte-3)
    Status(Byte-4) – Making barcode to set this config permenanent
    BEEP_CODE(Byte-5)
    Param_data (Byte-6) (Decode Data Packet Format – ref-pl3307)
    Param_value(Byte-7)
    
    再次参考数据表,我看到了(SE3300型号)许多操作模式。我想我应该使用普通解码模式和电平触发模式。我不知道使用“快照模式”有什么好处

    最后,如何连接多个命令

    例如,如果我需要使用液位触发模式程序,根据数据表,这些步骤包括:

    The system is initialized as follows:
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The host sends the Acquisition Stop command.
        • The host sends the Barcode Decode mode command.
        • The SE3300 optimizes the image output for bar code decoding.
        • The SE3300 enters standby mode (or low power mode if enabled).
    Upon a trigger pull:
        • The host sends the Illumination On command.
        • The SE3300 exits standby mode (or low power mode if enabled).
        • The host sends the Aim On command.
        • The host sends the Acquisition Start command.
        • The SE3300 begins outputting images.
        • The host attempts to decode the images.
    Upon a good decode or trigger release:
        • The host sends the Acquisition Stop command.
        • The SE3300 stops outputting images.
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The SE3300 enters standby mode (or low power mode if enabled).
    

    是否有人能指导我使用SSI命令为此形成一个简单流程?

    您是否试图从规范中编程?如果规范在线,请链接到该规范。
    The system is initialized as follows:
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The host sends the Acquisition Stop command.
        • The host sends the Barcode Decode mode command.
        • The SE3300 optimizes the image output for bar code decoding.
        • The SE3300 enters standby mode (or low power mode if enabled).
    Upon a trigger pull:
        • The host sends the Illumination On command.
        • The SE3300 exits standby mode (or low power mode if enabled).
        • The host sends the Aim On command.
        • The host sends the Acquisition Start command.
        • The SE3300 begins outputting images.
        • The host attempts to decode the images.
    Upon a good decode or trigger release:
        • The host sends the Acquisition Stop command.
        • The SE3300 stops outputting images.
        • The host sends the Aim Off command.
        • The host sends the Illumination Off command.
        • The SE3300 enters standby mode (or low power mode if enabled).