51 lines
1.6 KiB
Dart
51 lines
1.6 KiB
Dart
import 'package:star_lock/tools/baseGetXController.dart';
|
|
import 'package:star_lock/tools/toast.dart';
|
|
|
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
|
import '../../../../network/api_repository.dart';
|
|
import '../../../../tools/eventBusEventManage.dart';
|
|
import 'remoteUnlocking_state.dart';
|
|
|
|
class RemoteUnlockingLogic extends BaseGetXController{
|
|
RemoteUnlockingState state = RemoteUnlockingState();
|
|
|
|
void remoteUnlockingOpenOrClose() async{
|
|
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
|
|
lockId: state.getKeyInfosData.value.lockId.toString(),
|
|
// featureValue:state.getKeyInfosData.value.featureValue.toString()
|
|
featureValue:"1234"
|
|
);
|
|
if(entity.errorCode!.codeIsSuccessful){
|
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
|
if(state.remoteEnable.value == 1){
|
|
state.remoteEnable.value = 2;
|
|
}else if(state.remoteEnable.value == 2){
|
|
state.remoteEnable.value = 1;
|
|
}
|
|
state.getKeyInfosData.value.remoteEnable = state.remoteEnable.value;
|
|
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.getKeyInfosData.value.remoteEnable}");
|
|
eventBus.fire(PassCurrentLockInformationEvent(state.getKeyInfosData.value));
|
|
Toast.show(msg: "操作成功");
|
|
}
|
|
}
|
|
|
|
@override
|
|
void onReady() {
|
|
// TODO: implement onReady
|
|
super.onReady();
|
|
print("onReady()");
|
|
}
|
|
|
|
@override
|
|
void onInit() {
|
|
// TODO: implement onInit
|
|
super.onInit();
|
|
print("onInit()");
|
|
}
|
|
|
|
@override
|
|
void onClose() {
|
|
// TODO: implement onClose
|
|
}
|
|
|
|
} |