# AsReaderBarcodeDevice ## `sharedInstance` Gets the singleton instance of `AsReaderBarcodeDevice`. Use this to share a single instance across the entire app. ```objectivec + (instancetype)sharedInstance; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `instancetype` - Instance object of the AsReaderBarcodeDevice class ``` ### Sample Code ```objectivec AsReaderBarcodeDevice *asReaderBarcodeDevice = [AsReaderBarcodeDevice sharedInstance]; ``` --- {#startscan} ## `startScan` Starts barcode scanning. Specify the maximum number of barcodes to read and the maximum scan duration (in seconds) to start scanning. **After calling this method, the results are returned via the following callback methods:** - [`receivedBarcodeData`](./10_AsReaderBarcodeProtocol.md#receivedbarcodedata) - [`receivedScanData`](../common/common/8_AsReaderDeviceProtocol.md#receivedscandata) - [receivedScanBarcodeData (この機能は ASR-025S など、一部のモデルのみ対応しています)](./10_AsReaderBarcodeProtocol.md#receivedscanbarcodedata) ```objectivec - (BOOL)startScan:(uint8_t)numberOfTags readUntilInSec:(uint8_t)readUntilInSec; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `numberOfTags` - `uint8_t` - Maximum number of barcodes to read.
・`0x00`: Scan one barcode and stop.
・`0x01` to `0xFE`: Read the specified number of barcodes
(e.g., `0x05` → 5 barcodes).
・`0xFF`: Continuous scanning until manually stopped.

*Recommended usage is typically up to 10-20 barcodes. Specifying too many may take longer.* * - `readUntilInSec` - `uint8_t` - Maximum scan duration (seconds).
・`0x00`: Stop scan immediately according to `numberOfTags`.
・`0x01` to `0xFE`: Scan for the specified number of seconds
(e.g., `0x10` → 16 seconds).
・`0xFF`: Continuous scanning until manually stopped.

*Typically, 5 to 30 seconds is recommended.* ``` ### Notes - Normally, setting both `numberOfTags` and `readUntilInSec` to `0x00` will **scan one barcode and stop immediately**. - To scan more barcodes, it is recommended to change only one of the two parameters. - If `0xFF` is specified, scanning continues until manually stopped. ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Scan started successfully.
NO: Failed to start scan. ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice startScan:0 readUntilInSec:0]; if (status) { // Scan started successfully } else { // Failed to start scan } ``` --- ## `stopScan` Stops barcode scanning. Use this to stop scanning started by `startScan`. ```objectivec - (BOOL)stopScan; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Successfully stopped scanning.
NO: Failed to stop scanning. ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice stopScan]; if (status) { // Successfully executed the method } else { // Failed to execute the method } ``` --- ## `doFactoryReset` Resets the barcode module settings to factory defaults. Use this when you want to restore initial settings. **After calling this method, the result is returned via the [`receiveFactoryReset`](./10_AsReaderBarcodeProtocol.md#receivefactoryreset) callback.** > ⚠️ **Note** > This method is supported only on **ASR-230D, ASR-0231D, ASR-0240D, ASR-022D** models. ```objectivec - (BOOL)doFactoryReset; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Reset succeeded.
NO: Reset failed. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice doFactoryReset]; if (status) { // Reset succeeded } else { // Reset failed } ``` --- ## `sendBarcodeSettingData:` Sends barcode setting commands to the device. Mainly used when changing scanner settings. ```objectivec - (BOOL)sendBarcodeSettingData:(NSData*)sendData; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `sendData` - `NSData *` - Barcode setting data to send ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Send succeeded.
NO: Send failed. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice sendBarcodeSettingData:data]; if (status) { // Setting sent successfully } else { // Failed to send setting } ``` --- ## `getSymbologies` Gets the barcode symbologies supported for reading. After calling this method, the status of barcode symbologies is returned via the callback [`receivedSymbologies`](./10_AsReaderBarcodeProtocol.md#receivedsymbologies). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getSymbologies; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Method succeeded.
NO: Method failed. ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getSymbologies]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setSymbologyPrefix` Adds a prefix to all read barcodes based on the symbology type. Use this when you want to identify the barcode type. > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. > Calling on unsupported models returns `NO`. ```objectivec - (BOOL)setSymbologyPrefix; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Setting succeeded.
NO: Unsupported model or failed because scanning is in progress. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setSymbologyPrefix]; if (status) { // Prefix setting succeeded } else { // Unsupported model or scan in progress, failed to set } ``` --- ## `setDisableSymbologyPrefix` Disables the prefix added to barcodes. Use this to cancel the prefix set by `setSymbologyPrefix`. > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. > Unsupported models or scanning states return `NO`. ```objectivec - (BOOL)setDisableSymbologyPrefix; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Disabled prefix successfully.
NO: Unsupported model or failed due to scanning. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setDisableSymbologyPrefix]; if (status) { // Prefix disabled successfully } else { // Unsupported model or scan in progress, failed to disable } ``` --- ## `setCustomPrefix:` Sets the same custom prefix for all barcodes. For details on prefix strings, refer to [Lower ASCII Reference Table](../common/17_compatibility_charts.md#lower-ascii-reference-table). > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. ```objectivec - (BOOL)setCustomPrefix:(NSString *)prefix; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `prefix` - `NSString *` - The prefix string to set ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Setting succeeded.
NO: Setting failed. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setCustomPrefix:@"01"]; if (status) { // Prefix set successfully } else { // Failed to set prefix } ``` --- ## `setDisableCustomPrefix` Disables (clears) the custom prefix added to barcodes. Use this to cancel the prefix set by `setCustomPrefix:`. > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. ```objectivec - (BOOL)setDisableCustomPrefix; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Successfully disabled.
NO: Failed to disable. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setDisableCustomPrefix]; if (status) { // Prefix disabled successfully } else { // Failed to disable prefix } ``` --- ## `setCustomSuffix:` Sets the same custom suffix for all barcodes. For details on suffix strings, refer to [Lower ASCII Reference Table](../common/17_compatibility_charts.md#lower-ascii-reference-table). > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. ```objectivec - (BOOL)setCustomSuffix:(NSString *)suffix; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `suffix` - `NSString *` - The suffix string to set ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Setting succeeded.
NO: Setting failed. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setCustomSuffix:@"01"]; if (status) { // Suffix set successfully } else { // Failed to set suffix } ``` --- ## `setDisableCustomSuffix` Clears the set suffix. Use this to cancel the suffix added by `setCustomSuffix:`. > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, ASR-0240D, ASR-022D**. ```objectivec - (BOOL)setDisableCustomSuffix; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Successfully cleared.
NO: Failed to clear. ``` ### Usage Example ```objectivec BOOL status = [asReaderDevice setDisableCustomSuffix]; if (status) { // Suffix cleared successfully } else { // Failed to clear suffix } ``` --- ## `setBarcodeEngineUserCommand:` Sets the barcode module operation via command. For detailed command specifications, please refer to the barcode setting manual corresponding to your device model. > ⚠️ **Note** > This feature is supported only on **some models** such as **ASR-0230D, 0240D, 022D**. ```objectivec - (BOOL)setBarcodeEngineUserCommand:(NSString *)command; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `command` - `NSString *` - Command code string (e.g., `"BEPPWR1."`) ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setBarcodeEngineUserCommand:@"BEPPWR1."]; if (status) { // Command sent successfully } else { // Failed to send command } ``` --- ## `setCodeID:isBeepOn:` Sets the Code ID type and beep sound on/off during scanning. > ⚠️ **Note** > This method is supported only on **ASR-M24D**. It cannot be used on other models. ```objectivec + (NSData*)setCodeID:(int)codeID beepOn:(BOOL)isBeepOn; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `codeID` - `int` - [CodeID type (enum)](../common/enum/12_AsReaderInfoDefine.md#codeid) * - `isBeepOn` - `BOOL` - YES: Beep on, NO: Beep off ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setCodeID:CODEID_NONE isBeepOn:YES]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setOCRType:isBeepOn:` Sets the OCR type and beep sound on/off. > ⚠️ **Note** > This method is supported only on **ASR-M24D**. It cannot be used on other models. ```objectivec - (BOOL)setOCRType:(OCRType)type isBeepOn:(BOOL)isBeepOn; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `type` - `OCRType` - [OCR type (enum)](../common/enum/12_AsReaderInfoDefine.md#ocrtype) * - `isBeepOn` - `BOOL` - YES: Beep on, NO: Beep off ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setOCRType:OCR_TYPENONE isBeepOn:YES]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setiOSHIDEnable:` Enables or disables HID mode. > ⚠️ **Note** > This method is supported only on **ASR-M24D**. It cannot be used on other models. ```objectivec - (BOOL)setiOSHIDEnable:(BOOL)isOn; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `isOn` - `BOOL` - YES: Enable, NO: Disable ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setiOSHIDEnable:YES]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setPresentationMode:isBeepOn:` Enables or disables presentation mode. When enabled, scanning automatically starts when a barcode enters the reading area. > ⚠️ **Note** > This method is supported only on **ASR-M24D**. It cannot be used on other models. ```objectivec - (BOOL)setPresentationMode:(BOOL)isOn isBeepOn:(BOOL)isBeepOn; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `isOn` - `BOOL` - Presentation mode on/off (YES: On, NO: Off) * - `isBeepOn` - `BOOL` - Beep sound on/off (YES: On, NO: Off) ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setPresentationMode:YES isBeepOn:YES]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getCodeID` Gets the current CodeID. After calling this method, the CodeID is returned via the callback [`receivedCodeID`](./10_AsReaderBarcodeProtocol.md#receivedcodeid). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getCodeID; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getCodeID]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getOCR` Gets the OCR status (OCR-A, OCR-B). After calling this method, the OCR status is returned via the callback [`receivedOCR`](./10_AsReaderBarcodeProtocol.md#receivedocr). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getOCR; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getOCR]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getHID` Gets the current HID mode status. After calling this method, the HID mode status is returned via the callback [`receivedHID`](./10_AsReaderBarcodeProtocol.md#receivedhid). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getHID; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getHID]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getPresentationMode` Gets the current presentation (demo) mode status. After calling this method, the demo mode status is returned via the callback [`receivedPresentationMode`](./10_AsReaderBarcodeProtocol.md#receivedpresentationmode). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getPresentationMode; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Successfully obtained demo mode status, NO: Failed ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getPresentationMode]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getSecurity` Retrieves the barcode security level. After calling this method, the security level is returned via the callback method [`receivedBarcodeSecurity`](./10_AsReaderBarcodeProtocol.md#receivedbarcodesecurity). > ⚠️ **Note** > This method is supported only on **ASR-M24D**. ```objectivec - (BOOL)getSecurity; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Successfully obtained barcode security level, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getSecurity]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `getSleepBuzzer` Gets the buzzer status for automatic shutdown. After calling this method, the execution result is returned via the callback [`didGetSleepBuzzerReceived`](./10_AsReaderBarcodeProtocol.md#didgetsleepbuzzerreceived). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)getSleepBuzzer; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getSleepBuzzer]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setSleepBuzzer` Sets the buzzer status for automatic shutdown. After calling this method, the execution result is returned via the callback [`didSetSleepBuzzer`](./10_AsReaderBarcodeProtocol.md#didsetsleepbuzzer). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)setSleepBuzzer:(BOOL)sleepBuzzer; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `sleepBuzzer` - BOOL - YES: On, NO: Off ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setSleepBuzzer:YES]; if (status) { // Method executed successfully } else { // Method execution failed } ``` ## `getAutoOffTime` Gets the auto off time of AsReader. After calling this method, the execution result is returned via the callback [`didGetAutoOffTimeReceived`](./10_AsReaderBarcodeProtocol.md#didgetautoofftimereceived). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)getAutoOffTime; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getAutoOffTime]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setAutoOffTime` Sets the auto off time of AsReader. After calling this method, the execution result is returned via the callback [`didSetAutoOffTime`](./10_AsReaderBarcodeProtocol.md#didsetautoofftime). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)setAutoOffTime:(int)time; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `time` - int - Auto off time (Second) Range: 0〜1800s 0 indicates that it will not shutdown automatically. ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setAutoOffTime:0]; if (status) { // Method executed successfully } else { // Method execution failed } ``` ## `getBarcodeTimeOut` Gets the barcode scanning timeout of AsReader. After calling this method, the execution result is returned via the callback [`didGetBarcodeTimeOutReceived`](./10_AsReaderBarcodeProtocol.md#didgetbarcodetimeoutreceived). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)getBarcodeTimeOut; ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice getBarcodeTimeOut]; if (status) { // Method executed successfully } else { // Method execution failed } ``` --- ## `setBarcodeTimeOut` Sets the barcode scanning timeout of AsReader. After calling this method, the execution result is returned via the callback [`didSetBarcodeTimeOut`](./10_AsReaderBarcodeProtocol.md#didsetbarcodetimeout). > ⚠️ **Note** > This method is supported only on **ASR-025S**. ```objectivec - (BOOL)setBarcodeTimeOut:(int)timeout; ``` ### Parameters ```{list-table} :align: left :class: list-table * - Name - Type - Description * - `timeout` - int - Scanning timeout (4~300s) ``` ### Return Value ```{list-table} :align: left :class: list-table * - Type - Description * - `BOOL` - YES: Success, NO: Failure ``` ### Sample Code ```objectivec BOOL status = [asReaderDevice setBarcodeTimeOut:4]; if (status) { // Method executed successfully } else { // Method execution failed } ``` ## Deprecated Methods List The following methods are currently deprecated. **They may be removed in the future, so please avoid using them in new development.** Use alternative methods if available. --- ### ⚠️ `startScan` [Deprecated] Starts barcode scanning. Alternative: [`startScan`](#startscan) ```objectivec - (void)setTriggerModeDefault:(BOOL)isDefault; ```