完善添加锁流程,添加长按闭锁功能
This commit is contained in:
parent
b8278db9ef
commit
8c2fdf6d8a
@ -61,7 +61,14 @@ class BlueManage {
|
||||
_sendStreamSubscription ??= EventBusManager().eventBus!.on<EventSendModel>().listen((EventSendModel model) {
|
||||
if (model.sendChannel == DataChannel.ble) {
|
||||
// managerAppWriteData(model.data);
|
||||
writeCharacteristicWithResponse(model.data);
|
||||
_flutterReactiveBle!.statusStream.listen((status) {
|
||||
if (status == BleStatus.ready) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
writeCharacteristicWithResponse(model.data);
|
||||
}else{
|
||||
Get.log("写入数据 蓝牙未开启,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -69,43 +76,57 @@ class BlueManage {
|
||||
/// 开始扫描蓝牙设备
|
||||
void startScan({List<Uuid>? idList}) {
|
||||
// List<Service>? list = _flutterReactiveBle!.getDiscoveredServices("deviceId").then((value));
|
||||
|
||||
scanDevices.clear();
|
||||
_scanSubscription = _flutterReactiveBle!.scanForDevices(withServices:[]).listen((device) {
|
||||
// 判断名字为空的直接剔除
|
||||
if (device.name.isEmpty) {
|
||||
return;
|
||||
_flutterReactiveBle!.statusStream.listen((status) {
|
||||
if (status == BleStatus.ready) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
scanDevices.clear();
|
||||
_scanSubscription = _flutterReactiveBle!.scanForDevices(withServices:[]).listen((device) {
|
||||
// 判断名字为空的直接剔除
|
||||
if (device.name.isEmpty) {
|
||||
return;
|
||||
}
|
||||
print("startScanDevice:$device");
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString().contains("758824")) && (device.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.id == device.id);
|
||||
// 不存在的时候返回-1
|
||||
if (knownDeviceIndex >= 0) {
|
||||
scanDevices[knownDeviceIndex] = device;
|
||||
} else {
|
||||
scanDevices.add(device);
|
||||
}
|
||||
EventBusManager().eventBusFir(scanDevices);
|
||||
}
|
||||
}, onError: (Object e) {
|
||||
print('Device scan fails with error: $e');
|
||||
});
|
||||
}else{
|
||||
Get.log("开始扫描 蓝牙未开启,不能进行蓝牙操作");
|
||||
}
|
||||
print("startScanDevice:$device");
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString().contains("758824")) && (device.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.id == device.id);
|
||||
// 不存在的时候返回-1
|
||||
if (knownDeviceIndex >= 0) {
|
||||
scanDevices[knownDeviceIndex] = device;
|
||||
} else {
|
||||
scanDevices.add(device);
|
||||
}
|
||||
EventBusManager().eventBusFir(scanDevices);
|
||||
}
|
||||
}, onError: (Object e) {
|
||||
print('Device scan fails with error: $e');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// 调用发送数据
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
|
||||
if(deviceConnectionState != DeviceConnectionState.connected){
|
||||
if(isAddEquipment == false){
|
||||
startScan();
|
||||
}
|
||||
_flutterReactiveBle!.statusStream.listen((status) {
|
||||
if (status == BleStatus.ready) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if(deviceConnectionState != DeviceConnectionState.connected){
|
||||
if(isAddEquipment == false){
|
||||
startScan();
|
||||
}
|
||||
|
||||
_connect(deviceName, (state){
|
||||
stateCallBack(deviceConnectionState!);
|
||||
});
|
||||
}else{
|
||||
stateCallBack(deviceConnectionState!);
|
||||
}
|
||||
_connect(deviceName, (state){
|
||||
stateCallBack(deviceConnectionState!);
|
||||
});
|
||||
}else{
|
||||
stateCallBack(deviceConnectionState!);
|
||||
}
|
||||
}else{
|
||||
Get.log("调用发送数据 蓝牙未开启,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 连接监听状态
|
||||
|
||||
@ -501,18 +501,18 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Get.back();
|
||||
|
||||
if(BlueManage().deviceConnectionState == DeviceConnectionState.connected){
|
||||
// 如果是已连接状态 直接调用协议
|
||||
// 已配对 表示这把锁未被初始化,还处于被添加状态
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// 如果是锁拥有者直接删除锁,调用初始化协议
|
||||
factoryDataResetAction();
|
||||
} else {
|
||||
// 不是锁拥有者,调用删除钥匙协议
|
||||
deletUserAction();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// if(BlueManage().deviceConnectionState == DeviceConnectionState.connected){
|
||||
// // 如果是已连接状态 直接调用协议
|
||||
// // 已配对 表示这把锁未被初始化,还处于被添加状态
|
||||
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// // 如果是锁拥有者直接删除锁,调用初始化协议
|
||||
// factoryDataResetAction();
|
||||
// } else {
|
||||
// // 不是锁拥有者,调用删除钥匙协议
|
||||
// deletUserAction();
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (state.currentDeviceUUid.value.isNotEmpty) {
|
||||
// 已经扫描到了当前设备 停止扫描,直接删除锁
|
||||
@ -539,6 +539,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
}else{
|
||||
// 每秒判断获取是否搜到了当前设备
|
||||
if (state.currentDeviceUUid.isNotEmpty) {
|
||||
BlueManage().stopScan();
|
||||
// 存在的时候销毁定时器,赋值
|
||||
if(state.deletWaitScanTimer != null){
|
||||
state.deletWaitScanTimer!.cancel();
|
||||
@ -546,7 +547,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
if(state.deletWaitScanCompleter != null){
|
||||
state.deletWaitScanCompleter!.complete();
|
||||
}
|
||||
BlueManage().stopScan();
|
||||
dismissEasyLoading();
|
||||
|
||||
deletLockLogic();
|
||||
|
||||
@ -306,7 +306,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// updateLockUserNo();
|
||||
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
openDoorAction();
|
||||
openDoorAction(1);
|
||||
} else {
|
||||
getLockNetToken();
|
||||
}
|
||||
@ -407,7 +407,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 点击开门事件
|
||||
Future<void> openDoorAction() async {
|
||||
Future<void> openDoorAction(int openMode) async {
|
||||
showBlueConnetctToastTimer(action:() {
|
||||
state.openLockBtnState.value = 0;
|
||||
// state.animationController.reset();
|
||||
@ -428,7 +428,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
openMode: openMode,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||
onlineToken: state.lockNetToken,
|
||||
token: getTokenList,
|
||||
@ -542,6 +542,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
if(state.openLockBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
state.iSOpenLock.value = true;
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController.forward();
|
||||
@ -552,7 +553,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
} else {
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
// 不需要联网
|
||||
openDoorAction();
|
||||
openDoorAction(1);
|
||||
} else {
|
||||
// 需要联网
|
||||
getLockNetToken();
|
||||
@ -560,6 +561,23 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
startUnLock() {
|
||||
if(state.openLockBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
state.iSOpenLock.value = false;
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController.forward();
|
||||
|
||||
if (state.lockUserNo == 0) {
|
||||
// 电子钥匙lockUserNo为0 要先添加用户
|
||||
addUserConnectBlue();
|
||||
} else {
|
||||
openDoorAction(32);
|
||||
}
|
||||
}
|
||||
|
||||
longPressCloseDoor(){
|
||||
|
||||
}
|
||||
@ -571,7 +589,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockNetToken = entity.data!.token!;
|
||||
print("state.lockNetToken:${state.lockNetToken}");
|
||||
openDoorAction();
|
||||
openDoorAction(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -582,7 +600,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
lockUserNo: state.lockUserNo.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
openDoorAction();
|
||||
openDoorAction(1);
|
||||
} else {
|
||||
getLockNetToken();
|
||||
}
|
||||
|
||||
@ -76,32 +76,37 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(children: [
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
topWidget(),
|
||||
Expanded(child: Obx(() => bottomWidget())),
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(() => Visibility(
|
||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
},
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
child: _unlockSuccessWidget()),
|
||||
return ListView(
|
||||
children: [
|
||||
Stack(children: [
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
topWidget(),
|
||||
Expanded(child: Obx(() => bottomWidget())),
|
||||
],
|
||||
),
|
||||
))
|
||||
]);
|
||||
),
|
||||
Obx(() => Visibility(
|
||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||
// visible: true,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
},
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
child: _unlockSuccessWidget()),
|
||||
),
|
||||
))
|
||||
]),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget topWidget() {
|
||||
@ -170,8 +175,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
logic.startOpenLock();
|
||||
},
|
||||
onLongPressStart: (details) {
|
||||
Get.log("长按开锁");
|
||||
// logic.startConnect();
|
||||
Get.log("长按闭锁");
|
||||
logic.startUnLock();
|
||||
},
|
||||
)),
|
||||
],
|
||||
@ -556,12 +561,12 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/main/unlocked_bg.png',
|
||||
state.iSOpenLock.value == true ? 'images/main/unlocked_bg.png' : 'images/main/locked_bg.png',
|
||||
width: 358.w,
|
||||
height: 348.h,
|
||||
),
|
||||
Positioned(
|
||||
top: 1.sh / 2 - 70.h,
|
||||
top: (1.sh - ScreenUtil().statusBarHeight * 2)/ 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
|
||||
@ -30,6 +30,7 @@ class LockDetailState {
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
var iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
Timer? closedUnlockSuccessfulTimer;
|
||||
|
||||
//过渡动画控制器
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../login/seletCountryRegion/common/index.dart';
|
||||
import '../../../../talk/udp/udp_manage.dart';
|
||||
import '../../../../talk/udp/udp_senderManage.dart';
|
||||
import '../../../../tools/showTFView.dart';
|
||||
@ -157,8 +158,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
Widget bottomBottomBtnWidget() {
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||
// 接听
|
||||
Obx(() => bottomBtnItemWidget(
|
||||
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
||||
Obx(() => bottomBtnItemWidget(getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
||||
//获取麦克风权限
|
||||
await logic.getPermissionStatus().then((value) async {
|
||||
if (!value) {
|
||||
@ -274,8 +274,17 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
List<int> numbers = state.passwordTF.text.split('').map((char) => int.parse(char)).toList();
|
||||
// List<int> numbers = state.passwordTF.text.split('').map((char) => int.parse(char)).toList();
|
||||
// 开锁
|
||||
// lockID
|
||||
List<int> numbers = [];
|
||||
List<int> lockIDData = utf8.encode(state.passwordTF.text);
|
||||
numbers.addAll(lockIDData);
|
||||
// topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length);
|
||||
for (int i = 0; i < 6 - lockIDData.length; i++) {
|
||||
numbers.add(0);
|
||||
}
|
||||
print("numbersnumbersnumbers:$numbers");
|
||||
logic.udpOpenDoorAction(numbers);
|
||||
},
|
||||
cancelClick: () {
|
||||
|
||||
@ -116,15 +116,17 @@ class LockMainLogic extends BaseGetXController {
|
||||
|
||||
if (connectResult == ConnectivityResult.mobile) {
|
||||
// _netType = "4G";
|
||||
print("4G 4G 4G 4G 4G");
|
||||
state.networkConnectionStatus.value = 1;
|
||||
// print("4G 4G 4G 4G 4G");
|
||||
} else if (connectResult == ConnectivityResult.wifi) {
|
||||
// _netType = "wifi";
|
||||
print("wifi wifi wifi wifi wifi");
|
||||
state.networkConnectionStatus.value = 1;
|
||||
// print("wifi wifi wifi wifi wifi");
|
||||
} else {
|
||||
// _netType = "未连接";
|
||||
print("未连接 未连接 未连接 未连接 未连接");
|
||||
state.networkConnectionStatus.value = 0;
|
||||
// print("未连接 未连接 未连接 未连接 未连接");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// 判断网络是否连接
|
||||
@ -137,6 +139,11 @@ class LockMainLogic extends BaseGetXController {
|
||||
connectListener() async {
|
||||
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
||||
print("设置网络切换监听:$result");
|
||||
if(state.networkConnectionStatus.value == 0 && result != ConnectivityResult.none){
|
||||
// 从无网络到有网络
|
||||
state.networkConnectionStatus.value = 1;
|
||||
getStarLockInfo();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -160,9 +167,9 @@ class LockMainLogic extends BaseGetXController {
|
||||
|
||||
// getLockInfo();
|
||||
// 设置网络变化监听
|
||||
// connectListener();
|
||||
connectListener();
|
||||
// 获取网络连接状态
|
||||
// getConnectType();
|
||||
getConnectType();
|
||||
|
||||
getStarLockInfo();
|
||||
}
|
||||
|
||||
@ -10,5 +10,8 @@ class LockMainState {
|
||||
var dataLength = 100.obs;
|
||||
var lockListInfoEntity = LockListInfoEntity().obs;
|
||||
|
||||
// 网络连接状态 0没有网络 1有网络
|
||||
var networkConnectionStatus = 0.obs;
|
||||
|
||||
// late Timer timer;
|
||||
}
|
||||
@ -38,7 +38,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
Text(
|
||||
"星锁 1.0.0.03(preRelease-20240108)",
|
||||
"星锁 1.0.0.04(preRelease-20240108-1)",
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
SizedBox(
|
||||
|
||||
@ -131,6 +131,7 @@ class _AddLockSeletCountryPageState extends State<AddLockSeletCountryPage> {
|
||||
"featureValue": state.featureValue,
|
||||
"featureSettingValue": state.featureSettingValue,
|
||||
"featureSettingParams": state.featureSettingParams,
|
||||
"isFromMap": 0,
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -152,6 +153,7 @@ class _AddLockSeletCountryPageState extends State<AddLockSeletCountryPage> {
|
||||
"featureValue": state.featureValue,
|
||||
"featureSettingValue": state.featureSettingValue,
|
||||
"featureSettingParams": state.featureSettingParams,
|
||||
"isFromMap": 0,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
|
||||
@ -50,6 +50,10 @@ class LockAddressGaoDeLogic extends BaseGetXController{
|
||||
// ..startLocation();
|
||||
// }
|
||||
|
||||
void pushAddAction(){
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
|
||||
@ -67,14 +67,18 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
final status = await Permission.location.request();
|
||||
print("Permission.location.request()=status:$status");
|
||||
permissionStatus = status;
|
||||
if(Platform.isIOS){
|
||||
_setLocationOption();
|
||||
requestIOSLocation();
|
||||
}
|
||||
switch (status) {
|
||||
case PermissionStatus.denied:
|
||||
print("拒绝");
|
||||
break;
|
||||
case PermissionStatus.granted:
|
||||
if(Platform.isIOS){
|
||||
_setLocationOption();
|
||||
requestIOSLocation();
|
||||
// _setLocationOption();
|
||||
// requestIOSLocation();
|
||||
}else{
|
||||
requestAndroidLocation();
|
||||
location.startLocation();
|
||||
@ -83,6 +87,12 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
case PermissionStatus.limited:
|
||||
print("限制");
|
||||
break;
|
||||
case PermissionStatus.permanentlyDenied:
|
||||
print("永久的否认");
|
||||
break;
|
||||
case PermissionStatus.provisional:
|
||||
print("临时");
|
||||
break;
|
||||
default:
|
||||
print("其他状态");
|
||||
// requestLocation();
|
||||
@ -264,6 +274,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
"featureValue": state.featureValue,
|
||||
"featureSettingValue": state.featureSettingValue,
|
||||
"featureSettingParams": state.featureSettingParams,
|
||||
"isFromMap": 1,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
|
||||
@ -373,13 +373,16 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
|
||||
_initReplySubscription();
|
||||
_scanListDiscoveredDeviceSubscriptionAction();
|
||||
|
||||
state.ifCurrentScreen.value = true;
|
||||
startScanBlueList();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("NearbyLockLogic onInit()");
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -145,14 +145,17 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
super.didPush();
|
||||
state.ifCurrentScreen.value = true;
|
||||
logic.startScanBlueList();
|
||||
Get.log("NearbyLockLogic didPush()");
|
||||
|
||||
// state.ifCurrentScreen.value = true;
|
||||
// logic.startScanBlueList();
|
||||
}
|
||||
|
||||
/// 返回上一个界面 当前界面即将消失
|
||||
@override
|
||||
void didPop() {
|
||||
super.didPop();
|
||||
Get.log("NearbyLockLogic didPop()");
|
||||
|
||||
state.ifCurrentScreen.value = false;
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
@ -163,6 +166,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
super.didPopNext();
|
||||
Get.log("NearbyLockLogic didPopNext()");
|
||||
|
||||
state.ifCurrentScreen.value = true;
|
||||
logic.startScanBlueList();
|
||||
@ -172,6 +176,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
||||
@override
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
Get.log("NearbyLockLogic didPushNext()");
|
||||
|
||||
state.ifCurrentScreen.value = false;
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
|
||||
@ -155,7 +155,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, isAddEquipment: true);
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().disconnect(BlueManage().connectDeviceMacAddress);
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
Get.close(5);
|
||||
Get.close(state.isFromMap == 1 ? 5 : 6);
|
||||
// Future.delayed(const Duration(milliseconds: 200), () {
|
||||
// Get.offAllNamed(Routers.starLockMain);
|
||||
// });
|
||||
@ -231,6 +231,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
BlueManage().stopScan();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ class SaveLockState {
|
||||
var featureValue = '';
|
||||
var featureSettingValue = '';
|
||||
var featureSettingParams = [];
|
||||
var isFromMap = 0; // 0:不是从地图界面进入 1:从地图界面进入
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var saveBtnIsUsable = true.obs; // 保存按钮是否可用
|
||||
@ -31,6 +32,7 @@ class SaveLockState {
|
||||
featureValue = map["featureValue"];
|
||||
featureSettingValue = map["featureSettingValue"];
|
||||
featureSettingParams = map["featureSettingParams"];
|
||||
isFromMap = map["isFromMap"];
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
abstract class Api {
|
||||
// static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境
|
||||
static String baseAddress = "http://192.168.56.101:8099"; //联调环境
|
||||
static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境
|
||||
// static String baseAddress = "http://192.168.56.101:8099"; //联调环境
|
||||
// static String baseAddress = "http://192.168.1.15:8022"; //谢总本地
|
||||
|
||||
final String baseUrl = "$baseAddress/api";
|
||||
|
||||
@ -71,7 +71,7 @@ class CallTalk {
|
||||
// 获取帧序号 63
|
||||
int getIframeIndex =
|
||||
bb[POS_iframe_index] + bb[POS_iframe_index + 1] * 256;
|
||||
print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||
// print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||
|
||||
// 获取帧长度 65
|
||||
// int alen = bb[POS_alen] & 0xff;
|
||||
@ -84,10 +84,10 @@ class CallTalk {
|
||||
|
||||
// 当前包号 71
|
||||
int getBagIndex = bb[POS_bag_index] & 0xff;
|
||||
print('当前包号 getBagIndex:$getBagIndex');
|
||||
// print('当前包号 getBagIndex:$getBagIndex');
|
||||
// 总包数 69
|
||||
int getBagNum = bb[POS_bag_num] & 0xff;
|
||||
print('总包数 getBagNum:$getBagNum');
|
||||
// print('总包数 getBagNum:$getBagNum');
|
||||
// 数据长度 73
|
||||
int blen = bb[POS_blen] + bb[POS_blen + 1] * 256;
|
||||
// print('数据长度 blen:$blen');
|
||||
|
||||
@ -63,7 +63,7 @@ class BaseGetXController extends GetxController{
|
||||
action();
|
||||
}
|
||||
cancelBlueConnetctToastTimer();
|
||||
if(isShowBlueConnetctToast == false){
|
||||
if(isShowBlueConnetctToast == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user