Change Bluetooth Name¶
⚠️ Note: This document describes how to use the SDK's API to operate the scanner 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. Change Bluetooth Name¶
Change the Bluetooth name of the scanner device. Usage is as follows:
const char* result = inateck_scanner_ble_set_name(device_id, new_name);
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:
new_name
is the new Bluetooth name, with a maximum of 20 bytes.
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* new_name = "new name";
const char* result = inateck_scanner_ble_set_name(device_id, new_name);
printf("result: %s\n", result);
return 0;
}