0

我正在使用 flutter_bluetooth_serial 从 HC-05 模块中检索数据。它仅适用于安卓。我收到的数据有点像这样,如果我把它们放在文本中查看

  -: LUMINOUS Power Tech. Pvt. Ltd.  :-
__________________________________
Time stamped logged parameter :
Charger identification No  :
->00000151
Blt Mac Address :
->0:19:10:08:83:26
                  Battery Sl no. : 
->00000000020151 
                      Battery AH : 
->100.00
  Final volt after 1st charge(V) : 
->016.07
             Open circuit VBAT(V) : 
->014.41
 1st charging duration(hh.mm) : 
->000.02
                    Charging AH : 
->000.28
15/01/21 18:56:51
    VBAT at Discharge Mode(V) : 
->013.65
    IBAT at Discharge Mode(A) : 
->-000.00
15/01/21 19:06:51
    VBAT at Discharge Mode(V) : 
->013.54
    IBAT at Discharge Mode(A) : 
->-000.00
15/01/21 19:16:51
    VBAT at Discharge Mode(V) : 
->013.54
    IBAT at Discharge Mode(A) : 
->-000.00
15/01/21 19:26:51
    VBAT at Discharge Mode(V) : 
->012.50
    IBAT at Discharge Mode(A) : 
->-018.12
15/01/21 19:36:51
    VBAT at Discharge Mode(V) : 
->012.41
    IBAT at Discharge Mode(A) : 
->-018.19
15/01/21 19:46:51
    VBAT at Discharge Mode(V) : 
->012.35
    IBAT at Discharge Mode(A) : 
->-018.19
15/01/21 19:56:52
    VBAT at Discharge Mode(V) : 
->012.34
    IBAT at Discharge Mode(A) : 
->-018.03
15/01/21 20:06:52
    VBAT at Discharge Mode(V) : 
->012.24
    IBAT at Discharge Mode(A) : 
->-018.03
15/01/21 20:16:52
    VBAT at Discharge Mode(V) : 
->012.24
    IBAT at Discharge Mode(A) : 
->-018.05
15/01/21 20:26:52
    VBAT at Discharge Mode(V) : 
->012.13
    IBAT at Discharge Mode(A) : 
->-018.20
15/01/21 20:36:52
    VBAT at Discharge Mode(V) : 
->012.13
    IBAT at Discharge Mode(A) : 
->-018.20
15/01/21 20:46:52
    VBAT at Discharge Mode(V) : 
->012.03
    IBAT at Discharge Mode(A) : 
->-018.01
15/01/21 20:56:52
    VBAT at Discharge Mode(V) : 
->012.02
    IBAT at Discharge Mode(A) : 
->-018.00
15/01/21 21:06:52
    VBAT at Discharge Mode(V) : 
->011.91
    IBAT at Discharge Mode(A) : 
->-018.03
15/01/21 21:16:52
    VBAT at Discharge Mode(V) : 
->011.81
    IBAT at Discharge Mode(A) : 
->-018.03
15/01/21 21:26:52
    VBAT at Discharge Mode(V) : 
->011.70
    IBAT at Discharge Mode(A) : 
->-017.99
15/01/21 21:36:52
    VBAT at Discharge Mode(V) : 
->011.59
    IBAT at Discharge Mode(A) : 
->-017.95
15/01/21 21:46:52
    VBAT at Discharge Mode(V) : 
->011.37
    IBAT at Discharge Mode(A) : 
->-017.95
15/01/21 21:56:52
    VBAT at Discharge Mode(V) : 
->011.15
    IBAT at Discharge Mode(A) : 
->-017.97
15/01/21 21:59:40
    VBAT at Discharge Mode(V) : 
->010.99
    IBAT at Discharge Mode(A) : 
->-018.11
15/01/21 22:00:52
    VBAT at Discharge Mode(V) : 
->010.94
    IBAT at Discharge Mode(A) : 
->-018.11
15/01/21 22:02:51
    VBAT at Discharge Mode(V) : 
->010.80
    IBAT at Discharge Mode(A) : 
->-018.01
15/01/21 22:04:52
    VBAT at Discharge Mode(V) : 
->010.61
    IBAT at Discharge Mode(A) : 
->-018.13
15/01/21 22:06:52
    VBAT at Discharge Mode(V) : 
->010.39
    IBAT at Discharge Mode(A) : 
->-018.13
   Final VBAT after discharge(V) : 
->010.34
    Discharge duration(hh.mm) : 
->002.49
                Discharging AH : 
->050.85
   Final VBAT after Recharge(V) : 
->016.10
                 Recharging AH : 
->061.45
 2nd charging duration(hh.mm) : 
->008.32

我想将这些数据排列成适当的键值格式,以便我可以相应地使用它。可以帮忙吗?我在想某种正则表达式和拆分可以解决这个问题..但我不确定..

4

0 回答 0