我正在读取秤的 ble 输出,但我怎么也找不到重量输出。
我预计22.2公斤
输出为:
[46, 162, 25, 97, 145, 160, 160, 44, 246, 24, 13, 167] 和/或 [2E,A2,19,61,91,A0,A0,2C,F6,18,0D,A7]
我还在st和lb中进行了测试,但我再次似乎无法匹配数据。我已经尝试调整这个,我已经阅读了其他答案,这些答案与问题相似但不相同。
void main() {
List<int> received = [[46, 162, 25, 97, 145, 160, 160, 44, 246, 24, 13, 167];
// Get the weight value from the list starting at index 1
print(getWeight(received, 1));
}
double getWeight(List<int> data, index) {
return (( 0xff & data[index + 1] ) << 8 | ( 0xff & data[index] ) << 0 ) / 100;
}
并尝试了不同的起始值。
有人能理解重量在哪里吗?
另一个例子,它应该有 24.1 公斤
[2E,A2,19,61,91,A0,20,2C,FE,A6,0D,BD]
I/flutter (17484): ScanResult{device: BluetoothDevice{remoteId: A0:91:61:19:A2:2E, localName: AAA002, type: BluetoothDeviceType.le, isDiscoveringServices: false, services: null}, advertisementData: AdvertisementData{localName: AAA002, txPowerLevel: null, connectable: false, manufacturerData: {41132: [46, 162, 25, 97, 145, 160, 32, 44, 254, 166, 13, 189]}, serviceData: {}, serviceUuids: [0000ffb0-0000-1000-8000-00805f9b34fb]}, rssi: -65, timeStamp: 2023-07-31 13:52:37.268116connectionState: BluetoothConnectionState.disconnected}
另外这个磅数应该是 58.4 46, 162, 25, 97, 145, 160, 160, 160, 160, 163, 6, 137
如有任何帮助,我们将不胜感激。