OpenSRX 0.1.0
C++ library for interfacing with Keyence SR series barcode readers
Loading...
Searching...
No Matches
Utils.hpp File Reference
#include <string>
#include <tuple>

Go to the source code of this file.

Functions

std::string stripEcho (const std::string &response, const std::string &command)
 Strip a command echo prefix from a response string.
 
std::tuple< std::string, std::string > parseVersionInfo (const std::string &raw)
 Parse a raw version-info string ("MODEL,FIRMWARE") into components.
 

Function Documentation

◆ parseVersionInfo()

std::tuple< std::string, std::string > parseVersionInfo ( const std::string & raw)

Parse a raw version-info string ("MODEL,FIRMWARE") into components.

Parameters
rawThe raw string from the KEYENCE command.
Returns
A tuple of (model, firmwareVersion).
Exceptions
std::runtime_errorif the format is unexpected.

◆ stripEcho()

std::string stripEcho ( const std::string & response,
const std::string & command )

Strip a command echo prefix from a response string.

Parameters
responseThe raw response from the device.
commandThe command that was sent (potential echo).
Returns
The response with any leading echo removed.