43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
import 'package:star_lock/tools/baseGetXController.dart';
|
|
|
|
import '../../../login/login/entity/LoginEntity.dart';
|
|
import '../../../network/api_repository.dart';
|
|
import 'gatewayConnectionLockList_entity.dart';
|
|
import 'gatewayConnectionLockList_state.dart';
|
|
|
|
class GatewayConnectionLockListLogic extends BaseGetXController {
|
|
GatewayConnectionLockListState state = GatewayConnectionLockListState();
|
|
|
|
// 网关-附近的锁
|
|
Future<GatewayConnectionLockListEntity>
|
|
gatewayConnectionLockListDataRequest() async {
|
|
final GatewayConnectionLockListEntity entity = await ApiRepository.to
|
|
.gatewayConnectionLockLoadData(
|
|
gatewayId: state.gatewayId.value, timeout: 60);
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
state.itemDataList.value = entity.data!.list!;
|
|
}
|
|
return entity;
|
|
}
|
|
|
|
Future<void> gatewayScanDevice() async {
|
|
if (state.searchBtnState == false) {
|
|
return;
|
|
}
|
|
state.searchBtnState = false;
|
|
final LoginEntity entity = await ApiRepository.to
|
|
.gatewayScanDevice(gatewayId: state.gatewayId.value, timeout: 60);
|
|
state.searchBtnState = true;
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
gatewayConnectionLockListDataRequest();
|
|
}
|
|
}
|
|
|
|
@override
|
|
void onReady() {
|
|
super.onReady();
|
|
|
|
gatewayConnectionLockListDataRequest();
|
|
}
|
|
}
|