Tag: 条码扫描器

通过RS232串口将数据发送到条形码扫描器

我有一个条形码扫描仪,通过RS232串口连接。 我需要编写一个程序来将该设备与PC连接并传输数据。 我已经写了一些初始化通信链接的基本方法,并尝试通过向设备发送BEEP命令进行测试,但它没有按预期发出蜂鸣声。 所以我认为我的源代码有问题。 请有人帮我完成源代码。 以下是书面源代码 01)DeviceRS232.h #ifndef DEVICERS232_H #define DEVICERS232_H extern “C” { #include #include #include #include #include #include #include #include #include } #include #define MAX_SERIAL_PORT_NO 30 class DeviceRS232 { public: DeviceRS232(); virtual ~DeviceRS232(); int fdRS232; // file descriptor for the serial port void setSerialPort(std::string sp); void setBaudRate(long baud); void setDataBits(int dataBit); void setStopBits(int […]