General Configuration


⚠️ Note: This document describes how to use the SDK's API to operate scanning devices and provides sample code in C language. Please note that the API performs synchronous operations, which may block the main thread during use.

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

1. Configuration

Configure the general settings of the scanning device. The usage is as follows:

const char* result = inateck_scanner_ble_set_setting_info(device_id, cmd, device_type);

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

{
    "status": 0,
    "error": "",
    "info": [
        {
            "name": "volume",
            "flag": 1001,
            "value": 0
        },
        {
            "name": "vibration",
            "flag": 1002,
            "value": 0
        }
    ]
}

If the call fails, result will return:

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

Input parameters:

For example, if you need to set the volume of the BCST-21 device to 0 and the vibration to 0, then cmd is [{"flag":1001,"value":0},{"flag":1002,"value":0}], and device_type is 12.

Return parameters:

2. Get Configuration

Get the general settings of the scanning device. The usage is as follows:

const char* result = inateck_scanner_ble_get_setting_info(device_id, device_type);

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

{
    "status": 0,
    "error": "",
    "info": [
        {
            "name": "volume",
            "flag": 1001,
            "value": 0
        },
        {
            "name": "vibration",
            "flag": 1002,
            "value": 0
        }
    ]
}

If the call fails, result will return:

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

Input parameters:

Return result:

3. 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";
    const char* cmd = "[{\"flag\":1001,\"value\":0},{\"flag\":1002,\"value\":0}]";
    // BCST-21
    const char* device_type = 12;
    const char* result = inateck_scanner_ble_set_setting_info(device_id, cmd, device_type);
    printf("result: %s\n", result);

    result = inateck_scanner_ble_get_setting_info(device_id, device_type);
    printf("result: %s\n", result);
    return 0;
}

4. Sample Code in Other Languages