Barcode Configuration


⚠️ Note: This document describes how to use the SDK's API to operate the scanning device and provides sample code in C language. Please note that the API is synchronous and may block the main thread when used.

⚠️ Note: Before using the API, you need to connect the device first. For detailed steps, please refer to Connect Device.

1. Enable All Barcodes

Enable all supported barcodes on the scanning device. Usage is as follows:

const char* result = inateck_scanner_ble_open_all_code(device_id);

The return result is in JSON format. If the call is successful, result will return:

{
    "status": 0,
    "error": "",
}

If the call fails, result will return:

{
    "status": 1,
    "error": "error message",
}

2. Disable All Barcodes

Disable all supported barcodes on the scanning device. Usage is as follows:

const char* result = inateck_scanner_ble_close_all_code(device_id);

The return result is in JSON format. If the call is successful, result will return:

{
    "status": 0,
    "error": "",
}

If the call fails, result will return:

{
    "status": 1,
    "error": "error message",
}

3. Reset to Default Barcode State

Reset the scanning device to its default barcode state. Usage is as follows:

const char* result = inateck_scanner_ble_reset_all_code(device_id);

The return result is in JSON format. If the call is successful, result will return:

{
    "status": 0,
    "error": "",
}

If the call fails, result will return:

{
    "status": 1,
    "error": "error message",
}

4. Sample Code

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include "inateck_scanner_ble.h"

int main() {
    const char* device_id = "device id";
    // Enable all barcodes
    const char* result = inateck_scanner_ble_open_all_code(device_id);
    printf("result: %s\n", result);
    // Disable all barcodes
    result = inateck_scanner_ble_close_all_code(device_id);
    printf("result: %s\n", result);
    // Reset to default barcode state
    result = inateck_scanner_ble_reset_all_code(device_id);
    printf("result: %s\n", result);
    return 0;
}

5. Sample Code in Other Languages