|
|
@@ -51,7 +51,6 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
int _locationId = 0;
|
|
|
String _locationCode = '';
|
|
|
String _boostSessionId = '';
|
|
|
- int _peekTimeInterval = 0;
|
|
|
|
|
|
/// 内部构造方法,供 BaseCoreApi 工厂使用
|
|
|
factory WindowsCoreApi.create() => WindowsCoreApi._();
|
|
|
@@ -168,9 +167,13 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
log(_tag, 'stat: $stat');
|
|
|
try {
|
|
|
final ts = DateTime.now().millisecondsSinceEpoch;
|
|
|
- final connectionHistory = (stat?['connectionHistory'] as List?)?.last;
|
|
|
+ final connectionHistory = List<ConnectionHistory>.from(
|
|
|
+ (stat?['connectionHistory'] ?? []).map(
|
|
|
+ (x) => ConnectionHistory.fromJson(x),
|
|
|
+ ),
|
|
|
+ );
|
|
|
|
|
|
- final param = statLogEntryToJson(
|
|
|
+ final param = jsonEncode([
|
|
|
StatLogEntry(
|
|
|
id: Uuid().v4(),
|
|
|
time: ts,
|
|
|
@@ -187,12 +190,17 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
connectionHistory: connectionHistory,
|
|
|
),
|
|
|
),
|
|
|
- );
|
|
|
-
|
|
|
- final nodeId = connectionHistory['nodeId'] ?? 0;
|
|
|
- final msg =
|
|
|
- '{"type":"boost_result","locationCode":"$_locationCode","nodeId":"$nodeId","success":true, "param": "$param"}';
|
|
|
-
|
|
|
+ ]);
|
|
|
+
|
|
|
+ final nodeId = connectionHistory.last.nodeId ?? '';
|
|
|
+ final msg = jsonEncode({
|
|
|
+ "type": "boost_result",
|
|
|
+ "locationCode": _locationCode,
|
|
|
+ "nodeId": nodeId,
|
|
|
+ "success": true,
|
|
|
+ "param": param,
|
|
|
+ });
|
|
|
+ log(_tag, msg);
|
|
|
_eventController.add(msg);
|
|
|
} catch (e) {
|
|
|
log(_tag, 'parse stat json error: $e');
|
|
|
@@ -209,9 +217,13 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
log(_tag, 'stat: $stat');
|
|
|
try {
|
|
|
final ts = DateTime.now().millisecondsSinceEpoch;
|
|
|
- final connectionHistory = (stat?['connectionHistory'] as List?)?.last;
|
|
|
+ final connectionHistory = List<ConnectionHistory>.from(
|
|
|
+ (stat?['connectionHistory'] ?? []).map(
|
|
|
+ (x) => ConnectionHistory.fromJson(x),
|
|
|
+ ),
|
|
|
+ );
|
|
|
|
|
|
- final param = statLogEntryToJson(
|
|
|
+ final param = jsonEncode([
|
|
|
StatLogEntry(
|
|
|
id: Uuid().v4(),
|
|
|
time: ts,
|
|
|
@@ -228,11 +240,11 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
connectionHistory: connectionHistory,
|
|
|
),
|
|
|
),
|
|
|
- );
|
|
|
+ ]);
|
|
|
|
|
|
- final nodeId = connectionHistory['nodeId'] ?? 0;
|
|
|
+ final nodeId = connectionHistory.last.nodeId ?? '';
|
|
|
final msg =
|
|
|
- '{"type":"boost_result","locationCode":"$_locationCode","nodeId":"$nodeId","success":false, "param": "$param"}';
|
|
|
+ '{"type":"boost_result","locationCode":"$_locationCode","nodeId":"$nodeId","success":false, "param": $param}';
|
|
|
|
|
|
_eventController.add(msg);
|
|
|
} catch (e) {
|
|
|
@@ -342,7 +354,6 @@ class WindowsCoreApi implements BaseCoreApi {
|
|
|
_locationId = locationId;
|
|
|
_locationCode = locationCode;
|
|
|
_boostSessionId = sessionId;
|
|
|
- _peekTimeInterval = peekTimeInterval;
|
|
|
|
|
|
String geoPath = await _getGeoDirectory();
|
|
|
|