Bluetooth network configuration and data acquisition integrated solution for terminal developers. The SDK covers native Android, native iOS, Flutter, and UniApp platforms, providing 0x18/0x19 instruction-based secure BLE communication and standard register mechanism for device parameter management.
AECC Smart Data Logger is a hardware device used for data acquisition and remote monitoring in industrial/commercial scenarios. To help end users quickly integrate the data logger into their own App, we provide SDK solutions covering native Android, native iOS, Flutter, and UniApp platforms.
This solution adopts a layered architecture with the following data flow:
Complete BLE capabilities including auto device discovery, encrypted transmission, and 0x18/0x19 protocol packaging/parsing.
Configure data loggers' WiFi via Bluetooth: scan nearby routers, pass SSID and password, get real-time provisioning progress.
Standardized register mechanism for remote parameter configuration: 0x18 command to write registers, 0x19 command to read registers.
Two key status registers for monitoring network connection: Register 55 (Router status), Register 60 (Server status).
Step 1: Import SDK
libs directory and add dependencies in build.gradle.
Step 2: Packaging — Send 0x18 Set Command
// 调用 ProtocolTool 类的 setDatalogerByP0x18() 方法 JSONObject params = new JSONObject(); // 构造参数(具体格式参见数据定义章节) params.put("commandId", "18"); // ... 构造 param18Obj 数组 byte[] result = ProtocolTool.setDatalogerByP0x18(params, new byte[]{}); // 将 result 强转为 Object 后通过蓝牙发送
{"code": 0, "data": "XXXXX"}
Step 3: Unpacking — Parse 0x18 Response
// 调用 ProtocolTool 类的 parserPro0x18() 方法 boolean success = ProtocolTool.parserPro0x18(bluetoothData, new boolean()); // 返回 true 表示设置成功
Step 4: Packaging — Send 0x19 Read Command
// 调用 ProtocolTool 类的 getDatalogerByP0x19() 方法 byte[] result = ProtocolTool.getDatalogerByP0x19(params, new Object()); // 通过蓝牙发送读取请求
Step 5: Unpacking — Parse 0x19 Response
// 调用 ProtocolTool 类的 parserPro0x19() 方法 List<Param> paramList = ProtocolTool.parserPro0x19(bluetoothData, new Object()); // 遍历结果 for (Param param : paramList) { String value = param.readParamValueText(); // 读取到的值 }
{
"code": 0,
"data": [{
"paramNo": 75,
"value": "[{\"signalStrength\":217,\"ssid\":\"TPshuoxd\"},{\"signalStrength\":217,\"ssid\":\"shuoxd\"},...]"
}]
}
// 采集器与路由器状态 {"code": 0, "data": [{"paramNo": 55, "value": "4"}]} // 采集器与 Server 状态 {"code": 0, "data": [{"paramNo": 60, "value": "4"}]}
Step 1: Import SDK
Setnet_SDK.framework to your Xcode project and link it in Build Phases.
Step 2: Import Header File
#import <Setnet_SDK/SetnetManager.h>
Step 3: Packaging — 0x18 Set Command
NSDictionary *params = @{
@"commandId": @"18",
@"param18Obj": @[
@{@"paramId": @"寄存器地址", @"param": @"传输的数据"},
// ... 更多参数
]
};
[[SetnetManager sharedInstance] enCodeWithParams:params block:^(NSDictionary * _Nonnull encryptionDataDic) {
// encryptionDataDic[@"result"] => @"0" 成功, @"1" 失败
// encryptionDataDic[@"data"] => 打包好的 NSData
}];
Step 4: Packaging — 0x19 Read Command
NSDictionary *params = @{
@"commandId": @"19",
@"param19Obj": @[@"寄存器地址 1", @"寄存器地址 2"]
};
[[SetnetManager sharedInstance] enCodeWithParams:params block:^(NSDictionary * _Nonnull encryptionDataDic) {
// 同上处理
}];
Step 5: Unpacking — Parse Bluetooth Response
[[SetnetManager sharedInstance] DeCodeWithInputData:bluetoothData block:^(NSDictionary * _Nonnull decryptDataDic) {
// decryptDataDic[@"result"] => @"0" 成功
// decryptDataDic[@"msg"] => @"Set successfully" / @"Read successful"
// decryptDataDic[@"data"] => @{@"57": xxxxx, @"58": xxxxx}
// decryptDataDic[@"commandId"] => @"18" 或 @"19"
}];
Step 1: Get Plugin
Step 2: Integrate Plugin
dependencies in pubspec.yaml.
Step 3: Call SDK
Step 1: Project Configuration
manifest.json (note: id must match the file name):
{
"app-plus": {
"distribute": {
"sdkConfigs": {
// SDK 插件配置
}
}
}
}
Step 2: Build Custom Base
Step 3: Android Usage
// 1. 引入 SDK 模块 const aeccSdk = uni.requireNativePlugin('AECC-SDK-PluginName'); // 2. 组包 — 0x18 设置 let setResult = aeccSdk.setDatalogerByP0x18(params); // 返回: {"code": 0, "data": "0018000600100119dea56a1b17c8bb99..."} // 3. 组包 — 0x19 读取 let readResult = aeccSdk.getDatalogerByP0x19(params); // 返回: {"code": 0, "data": "00280006001501187168c19339b8afd61d..."} // 4. 解析 — 0x18 响应 let parseSetResult = aeccSdk.parserPro0x18(bluetoothResponse); // 返回: {"code": 0, "data": true} // 5. 解析 — 0x19 响应 let parseReadResult = aeccSdk.parserPro0x19(bluetoothResponse); // 返回: {"code": 0, "data": [{"paramNo": 60, "value": "4"}]}
Step 4: iOS Usage
Setnet_SDK.framework.
The provisioning process consists of 6 steps, executed sequentially:
Step 1: Bluetooth Connect
App scans and connects to AECC data logger via BLE. Requires user authorization for Bluetooth and location (Android).
Step 2: Scan Surrounding WiFi
Read Register 75 via 0x19 command, request the data logger to scan available WiFi routers. Result includes SSID and signal strength.
{
"commandId": "19",
"param19Obj": [75]
}
Response example:
{
"code": 0,
"data": [{
"paramNo": 75,
"value": "[{\"signalStrength\":217,\"ssid\":\"MyRouter\"},{\"signalStrength\":200,\"ssid\":\"OfficeWiFi\"}]"
}]
}
Step 3: Send WiFi Configuration
Write the selected WiFi SSID and password to the data logger via 0x18 command. The data logger will automatically attempt to connect to the router.
Step 4: Verify Router Connection Status
Read Register 55 via 0x19 to query the data logger's router connection status. Return value 0 means success; other values refer to the status code table for troubleshooting.
Step 5: Verify Server Connection Status
Read Register 60 via 0x19 to query the data logger's cloud Server connection status. Return value 3, 4 or 16 indicates success.
Step 6: Provisioning Complete
After both statuses are successfully verified, the data logger has connected to the LAN and the cloud Server via WiFi, the data upload channel is established, and the provisioning flow ends.
| Command | Function | Direction |
|---|---|---|
| 0x18 | Set Parameters - write to device registers | App → Device |
| 0x19 | Read Parameters - read from device registers | App → Device |
Used to write parameters to the data logger, supports setting multiple registers simultaneously.
{
"commandId": "18",
"param18Obj": [
{
"paramId": "寄存器地址",
"param": "传输的数据"
}
]
}
To set multiple parameters, append more objects in the param18Obj array.
{"code": 0, "data": "XXXXX"}
{"code": 0, "data": true}
Used to read parameters from the data logger, supports reading multiple registers simultaneously.
{
"commandId": "19",
"param19Obj": ["寄存器地址 1", "寄存器地址 2"]
}
{"code": 0, "data": "XXXXX"}
{"code": 0, "data": [{"paramNo": 55, "value": "4"}]}
{
"code": 0,
"data": [{
"paramNo": 75,
"value": "[{\"signalStrength\":217,\"ssid\":\"TPshuoxd\"},...]"
}]
}
| Register Address | Function | R/W | Description |
|---|---|---|---|
| 55 | Router Connection Status | Read | 0 = connected successfully, other values refer to status code table |
| 60 | Server Connection Status | Read | 3, 4, 16 indicate connected successfully |
| 75 | Surrounding WiFi Router List | Read | Returns WiFi list with SSID and signalStrength |
| Code | Meaning | Suggestion |
|---|---|---|
| 0 | Connected Successfully | Proceed to next step |
| 199 | Acquiring IP | Normal mid-state, wait 3-5 seconds and re-query |
| Other | Connection Failed | Check WiFi password, signal strength, distance to router (<10m recommended) |
| Code | Meaning | Suggestion |
|---|---|---|
| 3 | Connected Successfully | Provisioning complete |
| 4 | Connected Successfully | Provisioning complete |
| 16 | Connected Successfully | Provisioning complete |
| Other | Connection Failed / Pending | Check: (1) Router internet connection; (2) Cloud Server status; (3) Data logger firmware version |
BLUETOOTH / BLUETOOTH_ADMINACCESS_FINE_LOCATION (Bluetooth scan needs location, Android 6.0+)ACCESS_WIFI_STATE / CHANGE_WIFI_STATENSBluetoothAlwaysUsageDescriptionNSBluetoothPeripheralUsageDescription{paramId, param} objects to the param18Obj array.