Sound and Vibration Control¶
⚠️ Note: This document describes how to use the SDK's API to operate the scanning device and provides sample code in C. 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 Connecting the Device.
1. Sound and Vibration Prompt¶
When the sound or vibration function is enabled, the scanning device will emit a sound or vibration once. Usage is as follows:
const char* result = inateck_scanner_ble_bee_or_shake(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. Sound Control¶
Control the sound function of the scanning device. Usage is as follows:
const char* result = inateck_scanner_set_bee(device_id, voice_time, silent_time, count);
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",
}
Input parameters:
voice_time
is the duration of the sound, in units of 20 milliseconds.silent_time
is the interval time between sounds, in units of 20 milliseconds.count
is the number of sound cycles.
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";
// Prompt
const char* result = inateck_scanner_ble_bee_or_shake(device_id);
printf("result: %s\n", result);
result = inateck_scanner_set_bee(device_id, 100, 100, 3);
printf("result: %s\n", result);
return 0;
}