212 std::tuple<bool, TuningAdvice, TuningFailureReason>
startTuning(
int bank);
316 uint16_t port = 0,
const std::string& username =
"opensrx",
317 const std::string& password =
"opensrx");
362 template <BankParam P>
364 std::ostringstream cmd;
365 cmd <<
"RB," << std::setw(2) << std::setfill(
'0') << bank << std::setw(3)
366 << std::setfill(
'0') <<
static_cast<int>(P);
377 template <BankParam P>
379 std::ostringstream cmd;
380 cmd <<
"WB," << std::setw(2) << std::setfill(
'0') << bank << std::setw(3)
392 template <TuningParam P>
394 std::string cmd =
"RC," + std::to_string(
static_cast<int>(P));
404 template <TuningParam P>
418 template <OperationParam P>
420 std::string cmd =
"RP," + std::to_string(
static_cast<int>(P));
430 template <OperationParam P>
444 template <CommParam P>
446 std::string cmd =
"RN," + std::to_string(
static_cast<int>(P));
456 template <CommParam P>
Data returned from a barcode read operation.
Abstract interface for communicating with a scanner.
Definition ICommInterface.hpp:45
Embedded FTP server for receiving images from the scanner.
Definition ImageServer.hpp:25
Image waitForImage()
Block until the scanner delivers an image via FTP, decode it, and return the raw pixel data.
std::string model
Scanner model string.
Definition Scanner.hpp:489
void enablePointer()
Enable the laser aiming pointer.
std::string getModel() const
Get the scanner model string (e.g. "SR-X300").
Definition Scanner.hpp:218
void saveBackupSettings(int backupNumber)
Save settings to a backup slot.
auto getParam() -> ParamCppT< paramType(P)>
Read a tuning parameter.
Definition Scanner.hpp:393
Code startReading()
Start a blocking read operation.
void setImageCallback(std::function< void(const Image &)> cb)
Set a callback invoked on the watcher thread each time a new image is decoded.
BusyStatus getBusyStatus()
Query the scanner's busy status.
void loadSavedSettings()
Load settings from non-volatile memory.
void finishQuickSetupCodeReading()
Exit quick-setup code reading mode (RCOFF).
void quitTestMode()
Quit test mode (reading rate or read time).
std::string checkResponse(const std::string &response)
Parse and validate a scanner response string.
ErrorStatus getErrorStatus()
Query the scanner's error status.
void readTimeTest(int bank)
Start a read time test on a specific bank.
void clearPLCLinkError()
Clear the PLC link error flag.
void reset()
Reset the scanner.
void clearSendBuffer()
Clear the scanner's send buffer.
void stopReading()
Cancel an in-progress read operation.
CommandStatus getCommandStatus()
Query the scanner's command processing status.
std::deque< Image > getImages()
Return all images currently queued.
void adjustFocus()
Run auto-focus adjustment (blocks until complete).
void turnOnOutputTerminal(int terminalNumber)
Turn on a specific output terminal.
void readingRateTest(int bank)
Start a reading rate test on a specific bank.
std::tuple< bool, TuningAdvice, TuningFailureReason > startTuning(int bank)
Start tuning on a specific bank (blocks until complete).
Code startReading(int bank)
Start a blocking read operation on a specific bank.
std::string captureImage(int bank)
Capture an image and return the remote file path.
void disablePointer()
Disable the laser aiming pointer.
void turnOffAllOutputTerminals()
Turn off all output terminals.
void setTime(const Timestamp ×tamp)
Set the scanner's internal clock.
bool getInputTerminalState(int terminalNumber)
Get the state of an input terminal.
std::string getMacAddress() const
Get the scanner MAC address string.
Definition Scanner.hpp:224
void setParam(int bank, const ParamCppT< paramType(P)> &value)
Write a bank parameter.
Definition Scanner.hpp:378
std::unique_ptr< SavedImageDests > savedImageDests
Definition Scanner.hpp:502
Scanner(ICommInterface &comm)
Connect to a scanner on the given communication interface.
void readTimeTest()
Start a read time test on all banks.
std::string firmwareVersion
Scanner firmware version string.
Definition Scanner.hpp:490
ICommInterface & comm
Communication interface to the scanner.
Definition Scanner.hpp:488
ImageServer * getImageServer()
Access the underlying ImageServer (nullptr if not started).
Definition Scanner.hpp:352
void copyBankConfiguration(int sourceBank, int targetBank)
Copy configuration from one bank to another.
void setParam(const ParamCppT< paramType(P)> &value)
Write a tuning parameter.
Definition Scanner.hpp:405
auto getParam(int bank) -> ParamCppT< paramType(P)>
Read a bank parameter.
Definition Scanner.hpp:363
void resetToFactorySettings()
Reset all settings to factory defaults.
void turnOffOutputTerminal(int terminalNumber)
Turn off a specific output terminal.
Code parseReadResult(const std::string &raw)
Parse a raw read-result string into a Code struct.
bool tryGetImage(Image &image)
Return the next image if one is available, without blocking.
std::unique_ptr< ImageServer > imageServer
Embedded FTP image server (if started).
Definition Scanner.hpp:492
friend class TestScanner
Definition Scanner.hpp:105
void startImageServer(const std::string &localIP, ImageSaveConfig saveConfig={}, uint16_t port=0, const std::string &username="opensrx", const std::string &password="opensrx")
Start an embedded FTP server and configure the scanner to send images to it.
Timestamp getTime()
Read the scanner's internal clock.
std::string checkQuickSetupCodeResult()
Check the result of a quick-setup code reading.
void startQuickSetupCodeReading()
Enter quick-setup code reading mode (RCON).
std::string macAddress
Scanner MAC address string.
Definition Scanner.hpp:491
std::string getFirmwareVersion() const
Get the scanner firmware version string.
Definition Scanner.hpp:221
void readingRateTest()
Start a reading rate test on all banks.
void saveSettings()
Save all current settings to non-volatile memory.
void stopTuning()
Cancel an in-progress tuning operation.
void turnOnAllOutputTerminals()
Turn on all output terminals.
void clearFTPCommsError()
Clear the FTP communication error flag.
void loadBackupSettings(int backupNumber)
Load settings from a backup slot.
Simple date/time representation used by the scanner's clock.
Definition Timestamp.hpp:11
Definition AsioInterface.hpp:5
ParamCppT< PT > parseParam(const std::string &raw)
Parse a raw response string into the C++ type for a given ParamType.
TuningFailureReason
Reason for a tuning failure.
Definition Scanner.hpp:57
@ UNSTABLE_READING
Reading is unstable.
Definition Scanner.hpp:59
@ CODE_DETECTION_IMPOSSIBLE
Code detection is impossible.
Definition Scanner.hpp:58
typename ParamCppType< PT >::type ParamCppT
Shorthand: the C++ type for a given ParamType.
Definition ParamTraits.hpp:306
std::string formatParam(const ParamCppT< PT > &value)
Format a C++ value into the string to send as a parameter value.
TuningAdvice
Advice returned by tuning on how to improve results.
Definition Scanner.hpp:48
@ BRIGHTNESS_INSUFFICIENT
Brightness is insufficient.
Definition Scanner.hpp:53
@ USE_AN_IMAGE_FILTER
Try using an image filter.
Definition Scanner.hpp:50
@ CONSIDER_INSTALLATION_LIGHTING_PRINTING_CONDITIONS
Check installation/lighting/printing.
Definition Scanner.hpp:51
BusyStatus
Scanner busy status.
Definition Scanner.hpp:39
@ UPDATE_PROCESSING
Update processing in progress.
Definition Scanner.hpp:42
@ AUTO_FOCUSING
Auto-focus in progress.
Definition Scanner.hpp:44
@ IDLE
Not busy.
Definition Scanner.hpp:40
@ TRG_BUSY
Trigger processing in progress.
Definition Scanner.hpp:41
@ SAVING_FILE
Saving a file.
Definition Scanner.hpp:43
std::tuple< std::string, std::string > parseVersionInfo(const std::string &raw)
Parse a raw version info string ("MODEL,FIRMWARE") into components.
@ NONE
Definition ParamValues.hpp:151
CommandStatus
Scanner command processing status.
Definition Scanner.hpp:18
@ NO_PROCESSING
No command is being processed.
Definition Scanner.hpp:19
@ WAIT_FOR_SETTING
Waiting for a setting to be applied.
Definition Scanner.hpp:20
@ UPDATING
A setting update is in progress.
Definition Scanner.hpp:21
constexpr ParamType paramType(BankParam p)
Definition ParamTypeMap.hpp:91
ImageSavingDestination
Image saving destination (commands 500–504).
Definition ParamValues.hpp:211
ErrorStatus
Scanner error status codes.
Definition Scanner.hpp:25
@ PROFINET_ERROR
PROFINET error.
Definition Scanner.hpp:33
@ SET_VALUE_ERROR
Set value error.
Definition Scanner.hpp:29
@ PLC_LINK_ERROR
PLC link error.
Definition Scanner.hpp:32
@ DUPLICATE_IP_ERROR
Duplicate IP address detected.
Definition Scanner.hpp:30
@ UPDATE_ERROR
Update error.
Definition Scanner.hpp:28
@ LUA_SCRIPT_ERROR
Lua script error.
Definition Scanner.hpp:34
@ CONNECTION_ERROR
Host connection error.
Definition Scanner.hpp:35
@ NO_ERROR
No error.
Definition Scanner.hpp:26
@ BUFF_OVERFLOW_ERROR
Buffer overflow error.
Definition Scanner.hpp:31
@ SYSTEM_ERROR
System error.
Definition Scanner.hpp:27
Result of a barcode read operation.
Definition Code.hpp:42
Configuration for which image types to save via FTP.
Definition Scanner.hpp:74
bool capture
SAVE_DEST_CAPTURE (504)
Definition Scanner.hpp:79
bool verificationNG
SAVE_DEST_VERIFICATION_NG (501)
Definition Scanner.hpp:76
bool readError
SAVE_DEST_READ_ERROR (502)
Definition Scanner.hpp:77
bool readOK
SAVE_DEST_READ_OK (500)
Definition Scanner.hpp:75
bool unstable
SAVE_DEST_UNSTABLE (503)
Definition Scanner.hpp:78
Raw decoded image data.
Definition Image.hpp:18
Previous SAVE_DEST values saved by startImageServer, restored on stop.
Definition Scanner.hpp:495
ImageSavingDestination verificationNG
Definition Scanner.hpp:497
ImageSavingDestination readOK
Definition Scanner.hpp:496
ImageSavingDestination unstable
Definition Scanner.hpp:499
ImageSavingDestination capture
Definition Scanner.hpp:500
ImageSavingDestination readError
Definition Scanner.hpp:498