LED Control¶
⚠️ 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 a synchronous operation and may block the main thread when used.
⚠️ Note: Before using the API, you need to connect the device first. For specific steps, please refer to Connect Device.
1. LED Control¶
Control the LED light of the scanning device. The usage is as follows:
const char* result = inateck_scanner_set_led(device_id, led_color, light_time, dark_time, led_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:
led_color
is the LED light color, green is 2, blue is 3, yellow is 4.light_time
is the LED light-on time, in units of 20 milliseconds.dark_time
is the LED light-off time, in units of 20 milliseconds.led_count
is the number of LED light cycles.
2. 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* result = inateck_scanner_set_led(device_id, 2, 100, 100, 5);
printf("result: %s\n", result);
return 0;
}