Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
9f5d5b21a5
@ -101,6 +101,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
XSJPushProvider().initJPushService();
|
||||
XSJPushProvider().initLocalNotification(false);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
|
||||
import '../../mine/mine/starLockMine_logic.dart';
|
||||
import '../../network/api_repository.dart';
|
||||
@ -19,6 +22,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
Storage.saveLoginData(entity.data);
|
||||
// Get.back();
|
||||
// Get.toNamed(Routers.starLockMain);
|
||||
XSJPushProvider().initJPushService();
|
||||
Get.offNamedUntil(Routers.starLockMain, (route) => false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
import 'app.dart';
|
||||
@ -18,8 +17,6 @@ FutureOr<void> main() async {
|
||||
// 设置国际化信息
|
||||
await _initTranslation();
|
||||
|
||||
initLocalNotification();
|
||||
|
||||
runApp(MyApp());
|
||||
|
||||
if (AppPlatform.isAndroid) {
|
||||
@ -48,14 +45,3 @@ Future _setCommonServices() async {
|
||||
}
|
||||
// Get.log(PlatformInfoService.to.info.version);
|
||||
}
|
||||
|
||||
initLocalNotification() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||
AndroidInitializationSettings('app_icon');
|
||||
const InitializationSettings initializationSettings =
|
||||
InitializationSettings(android: initializationSettingsAndroid);
|
||||
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||
}
|
||||
|
||||
@ -13,5 +13,28 @@ class CatEyeSetState {
|
||||
CatEyeSetState() {
|
||||
Map map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
|
||||
if (lockSetInfoData.value != null &&
|
||||
lockSetInfoData.value.lockSettingInfo != null) {
|
||||
selectBrightDuration.value =
|
||||
'${lockSetInfoData.value.lockSettingInfo?.autoLightScreenTime} 秒';
|
||||
if (lockSetInfoData.value.lockSettingInfo?.autoLightScreen == 1) {
|
||||
isAutoBright.value = true;
|
||||
} else {
|
||||
isAutoBright.value = false;
|
||||
}
|
||||
|
||||
if (lockSetInfoData.value.lockSettingInfo?.stayWarn == 1) {
|
||||
isStayWarning.value = true;
|
||||
} else {
|
||||
isStayWarning.value = false;
|
||||
}
|
||||
|
||||
if (lockSetInfoData.value.lockSettingInfo?.abnormalWarn == 1) {
|
||||
isExceptionWarning.value = true;
|
||||
} else {
|
||||
isExceptionWarning.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ class CatEyeWorkModeLogic extends BaseGetXController {
|
||||
'recordMode': state.recordMode.value,
|
||||
'recordStartTime': state.recordStartTime.value,
|
||||
'recordEndTime': state.recordEndTime.value,
|
||||
'recordTime': state.recordTime.value,
|
||||
'detectionDistance': state.detectionDistance.value,
|
||||
'realTimeMode': state.realTimeMode.value,
|
||||
}
|
||||
|
||||
@ -33,12 +33,12 @@ class LockSetInfoData {
|
||||
LockBasicInfo? lockBasicInfo;
|
||||
LockSettingInfo? lockSettingInfo;
|
||||
|
||||
LockSetInfoData({
|
||||
this.lockId,
|
||||
this.lockStatus,
|
||||
this.lockFeature,
|
||||
this.lockBasicInfo,
|
||||
this.lockSettingInfo});
|
||||
LockSetInfoData(
|
||||
{this.lockId,
|
||||
this.lockStatus,
|
||||
this.lockFeature,
|
||||
this.lockBasicInfo,
|
||||
this.lockSettingInfo});
|
||||
|
||||
LockSetInfoData.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
@ -145,59 +145,60 @@ class LockFeature {
|
||||
int? stayWarn;
|
||||
int? abnormalWarn;
|
||||
|
||||
LockFeature(
|
||||
{this.password,
|
||||
this.icCard,
|
||||
this.fingerprint,
|
||||
this.fingerVein,
|
||||
this.palmVein,
|
||||
this.d3Face,
|
||||
this.qrCode,
|
||||
this.bluetoothRemoteControl,
|
||||
this.wirelessKey,
|
||||
this.gatewayUnlock,
|
||||
this.lockCommand,
|
||||
this.firmwareUpgrade,
|
||||
this.passwordIssue,
|
||||
this.cardIssue,
|
||||
this.fingerprintIssue,
|
||||
this.fingerVeinIssue,
|
||||
this.palmVeinIssue,
|
||||
this.d3FaceIssue,
|
||||
this.lockFreeze,
|
||||
this.readAdminPassword,
|
||||
this.passwordManagement,
|
||||
this.passwordWithDelete,
|
||||
this.remoteUnlock,
|
||||
this.autoLock,
|
||||
this.antiPrySwitch,
|
||||
this.resetSwitch,
|
||||
this.lockSwitch,
|
||||
this.lockSound,
|
||||
this.languageSetting,
|
||||
this.realTimeClock,
|
||||
this.wifi,
|
||||
this.videoIntercom,
|
||||
this.cyclePassword,
|
||||
this.cycleFingerprintCard,
|
||||
this.doubleAuthentication,
|
||||
this.openDirection,
|
||||
this.proximitySensing,
|
||||
this.doorStatus,
|
||||
this.wiredDoorMagnet,
|
||||
this.wirelessDoorMagnet,
|
||||
this.doorNotClosedAlarm,
|
||||
this.unlockReminder,
|
||||
this.wirelessKeyboard,
|
||||
this.lightingTime,
|
||||
this.passageMode,
|
||||
this.hotelLockCardSystem,
|
||||
this.appUnlockOnline,
|
||||
this.bluetoothBroadcast,
|
||||
this.attendance,
|
||||
this.motorTorsion,
|
||||
this.stayWarn,
|
||||
this.abnormalWarn,});
|
||||
LockFeature({
|
||||
this.password,
|
||||
this.icCard,
|
||||
this.fingerprint,
|
||||
this.fingerVein,
|
||||
this.palmVein,
|
||||
this.d3Face,
|
||||
this.qrCode,
|
||||
this.bluetoothRemoteControl,
|
||||
this.wirelessKey,
|
||||
this.gatewayUnlock,
|
||||
this.lockCommand,
|
||||
this.firmwareUpgrade,
|
||||
this.passwordIssue,
|
||||
this.cardIssue,
|
||||
this.fingerprintIssue,
|
||||
this.fingerVeinIssue,
|
||||
this.palmVeinIssue,
|
||||
this.d3FaceIssue,
|
||||
this.lockFreeze,
|
||||
this.readAdminPassword,
|
||||
this.passwordManagement,
|
||||
this.passwordWithDelete,
|
||||
this.remoteUnlock,
|
||||
this.autoLock,
|
||||
this.antiPrySwitch,
|
||||
this.resetSwitch,
|
||||
this.lockSwitch,
|
||||
this.lockSound,
|
||||
this.languageSetting,
|
||||
this.realTimeClock,
|
||||
this.wifi,
|
||||
this.videoIntercom,
|
||||
this.cyclePassword,
|
||||
this.cycleFingerprintCard,
|
||||
this.doubleAuthentication,
|
||||
this.openDirection,
|
||||
this.proximitySensing,
|
||||
this.doorStatus,
|
||||
this.wiredDoorMagnet,
|
||||
this.wirelessDoorMagnet,
|
||||
this.doorNotClosedAlarm,
|
||||
this.unlockReminder,
|
||||
this.wirelessKeyboard,
|
||||
this.lightingTime,
|
||||
this.passageMode,
|
||||
this.hotelLockCardSystem,
|
||||
this.appUnlockOnline,
|
||||
this.bluetoothBroadcast,
|
||||
this.attendance,
|
||||
this.motorTorsion,
|
||||
this.stayWarn,
|
||||
this.abnormalWarn,
|
||||
});
|
||||
|
||||
LockFeature.fromJson(Map<String, dynamic> json) {
|
||||
password = json['password'];
|
||||
@ -335,26 +336,25 @@ class LockBasicInfo {
|
||||
int? lockUserNo;
|
||||
|
||||
LockBasicInfo(
|
||||
{
|
||||
this.lockId,
|
||||
this.electricQuantityDate,
|
||||
this.keyId,
|
||||
this.model,
|
||||
this.electricQuantity,
|
||||
this.indate,
|
||||
this.isLockOwner,
|
||||
this.lockAlias,
|
||||
this.lockName,
|
||||
this.groupId,
|
||||
this.groupName,
|
||||
this.groupData,
|
||||
this.adminPwd,
|
||||
this.keyType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.mac,
|
||||
this.keyRight,
|
||||
this.senderUserId,
|
||||
{this.lockId,
|
||||
this.electricQuantityDate,
|
||||
this.keyId,
|
||||
this.model,
|
||||
this.electricQuantity,
|
||||
this.indate,
|
||||
this.isLockOwner,
|
||||
this.lockAlias,
|
||||
this.lockName,
|
||||
this.groupId,
|
||||
this.groupName,
|
||||
this.groupData,
|
||||
this.adminPwd,
|
||||
this.keyType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.mac,
|
||||
this.keyRight,
|
||||
this.senderUserId,
|
||||
this.lockUserNo});
|
||||
|
||||
LockBasicInfo.fromJson(Map<String, dynamic> json) {
|
||||
@ -458,33 +458,60 @@ class LockSettingInfo {
|
||||
int? motorTorsion;
|
||||
int? stayWarn;
|
||||
int? abnormalWarn;
|
||||
List<CatEyeModeConfig>? catEyeConfig;
|
||||
int? faceSwitch; //人脸开关 0:关闭 1:开启
|
||||
int? faceAutoLightScreen; //人脸自动亮屏开关 0:关闭 1:开启
|
||||
int? faceInductionDistance; //人脸感应距离
|
||||
int? faceAntiMistakeOpen; //人脸防误开门 0:关闭 1:开启
|
||||
int? autoLightScreen; //猫眼-自动亮屏开关 0:关闭 1:开启
|
||||
int? autoLightScreenTime; //猫眼-自动亮屏时间
|
||||
int? dayNotOpenDoorSwitch; //N天未开门开关 (启用/禁用)
|
||||
int? dayNotOpenDoorValue; //N天未开门值
|
||||
int? doorNotCloseSwitch; //门未关闭开关 (启用/禁用)
|
||||
int? lowElecNoticeSwitch; //低电量开关 (启用/禁用)
|
||||
int? doorbellNoticeSwitch; //有人按门铃开关 (启用/禁用)
|
||||
int? someoneAtDoorSwitch; //有人出现在门口开关 (启用/禁用)//
|
||||
|
||||
LockSettingInfo(
|
||||
{this.remoteUnlock,
|
||||
this.autoLock,
|
||||
this.autoLockSecond,
|
||||
this.antiPrySwitch,
|
||||
this.resetSwitch,
|
||||
this.lockSwitch,
|
||||
this.lockSound,
|
||||
this.lockSoundVolume,
|
||||
this.languageSettingLang,
|
||||
this.openDirectionValue,
|
||||
this.doorNotClosedAlarm,
|
||||
this.unlockReminder,
|
||||
this.lightingTime,
|
||||
this.lightingSecond,
|
||||
this.passageMode,
|
||||
this.passageModeConfig,
|
||||
this.attendance,
|
||||
this.appUnlockOnline,
|
||||
this.bluetoothBroadcast,
|
||||
this.adminPwd,
|
||||
this.unlockReminderPush,
|
||||
this.languageSettingLangText,
|
||||
this.motorTorsion,
|
||||
this.stayWarn,
|
||||
this.abnormalWarn,});
|
||||
LockSettingInfo({
|
||||
this.remoteUnlock,
|
||||
this.autoLock,
|
||||
this.autoLockSecond,
|
||||
this.antiPrySwitch,
|
||||
this.resetSwitch,
|
||||
this.lockSwitch,
|
||||
this.lockSound,
|
||||
this.lockSoundVolume,
|
||||
this.languageSettingLang,
|
||||
this.openDirectionValue,
|
||||
this.doorNotClosedAlarm,
|
||||
this.unlockReminder,
|
||||
this.lightingTime,
|
||||
this.lightingSecond,
|
||||
this.passageMode,
|
||||
this.passageModeConfig,
|
||||
this.attendance,
|
||||
this.appUnlockOnline,
|
||||
this.bluetoothBroadcast,
|
||||
this.adminPwd,
|
||||
this.unlockReminderPush,
|
||||
this.languageSettingLangText,
|
||||
this.motorTorsion,
|
||||
this.stayWarn,
|
||||
this.abnormalWarn,
|
||||
this.catEyeConfig,
|
||||
this.faceSwitch,
|
||||
this.faceAutoLightScreen,
|
||||
this.faceInductionDistance,
|
||||
this.faceAntiMistakeOpen,
|
||||
this.autoLightScreen,
|
||||
this.autoLightScreenTime,
|
||||
this.dayNotOpenDoorSwitch,
|
||||
this.dayNotOpenDoorValue,
|
||||
this.doorNotCloseSwitch,
|
||||
this.lowElecNoticeSwitch,
|
||||
this.doorbellNoticeSwitch,
|
||||
this.someoneAtDoorSwitch,
|
||||
});
|
||||
|
||||
LockSettingInfo.fromJson(Map<String, dynamic> json) {
|
||||
remoteUnlock = json['remoteUnlock'];
|
||||
@ -517,6 +544,24 @@ class LockSettingInfo {
|
||||
motorTorsion = json['motorTorsion'];
|
||||
stayWarn = json['stayWarn'];
|
||||
abnormalWarn = json['abnormalWarn'];
|
||||
if (json['catEyeConfig'] != null) {
|
||||
catEyeConfig = <CatEyeModeConfig>[];
|
||||
json['catEyeConfig'].forEach((v) {
|
||||
catEyeConfig!.add(CatEyeModeConfig.fromJson(v));
|
||||
});
|
||||
}
|
||||
faceSwitch = json['faceSwitch'];
|
||||
faceAutoLightScreen = json['faceAutoLightScreen'];
|
||||
faceInductionDistance = json['faceInductionDistance'];
|
||||
faceAntiMistakeOpen = json['faceAntiMistakeOpen'];
|
||||
autoLightScreen = json['autoLightScreen'];
|
||||
autoLightScreenTime = json['autoLightScreenTime'];
|
||||
dayNotOpenDoorSwitch = json['dayNotOpenDoorSwitch'];
|
||||
dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
|
||||
doorNotCloseSwitch = json['doorNotCloseSwitch'];
|
||||
lowElecNoticeSwitch = json['lowElecNoticeSwitch'];
|
||||
doorbellNoticeSwitch = json['doorbellNoticeSwitch'];
|
||||
someoneAtDoorSwitch = json['someoneAtDoorSwitch'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -549,6 +594,22 @@ class LockSettingInfo {
|
||||
data['motorTorsion'] = motorTorsion;
|
||||
data['stayWarn'] = stayWarn;
|
||||
data['abnormalWarn'] = abnormalWarn;
|
||||
if (catEyeConfig != null) {
|
||||
data['catEyeConfig'] = catEyeConfig!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['faceSwitch'] = faceSwitch;
|
||||
data['faceAutoLightScreen'] = faceAutoLightScreen;
|
||||
data['faceInductionDistance'] = faceInductionDistance;
|
||||
data['faceAntiMistakeOpen'] = faceAntiMistakeOpen;
|
||||
data['autoLightScreen'] = autoLightScreen;
|
||||
data['autoLightScreenTime'] = autoLightScreenTime;
|
||||
data['dayNotOpenDoorSwitch'] = dayNotOpenDoorSwitch;
|
||||
data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
|
||||
data['doorNotCloseSwitch'] = doorNotCloseSwitch;
|
||||
data['lowElecNoticeSwitch'] = lowElecNoticeSwitch;
|
||||
data['doorbellNoticeSwitch'] = doorbellNoticeSwitch;
|
||||
data['someoneAtDoorSwitch'] = someoneAtDoorSwitch;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -579,3 +640,62 @@ class PassageModeConfig {
|
||||
}
|
||||
}
|
||||
|
||||
class CatEyeConfig {
|
||||
int? catEyeMode;
|
||||
CatEyeModeConfig? catEyeModeConfig;
|
||||
|
||||
CatEyeConfig({this.catEyeMode, this.catEyeModeConfig});
|
||||
|
||||
CatEyeConfig.fromJson(Map<String, dynamic> json) {
|
||||
catEyeMode = json['catEyeMode'];
|
||||
catEyeModeConfig = json['catEyeModeConfig'] != null
|
||||
? CatEyeModeConfig.fromJson(json['catEyeModeConfig'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['catEyeMode'] = catEyeMode;
|
||||
if (catEyeModeConfig != null) {
|
||||
data['catEyeModeConfig'] = catEyeModeConfig!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CatEyeModeConfig {
|
||||
int? recordMode;
|
||||
String? recordTime;
|
||||
int? realTimeMode;
|
||||
int? recordEndTime;
|
||||
int? recordStartTime;
|
||||
double? detectionDistance;
|
||||
|
||||
CatEyeModeConfig(
|
||||
{this.recordMode,
|
||||
this.recordTime,
|
||||
this.realTimeMode,
|
||||
this.recordEndTime,
|
||||
this.recordStartTime,
|
||||
this.detectionDistance});
|
||||
|
||||
CatEyeModeConfig.fromJson(Map<String, dynamic> json) {
|
||||
recordMode = json['recordMode'];
|
||||
recordTime = json['recordTime'];
|
||||
realTimeMode = json['realTimeMode'];
|
||||
recordEndTime = json['recordEndTime'];
|
||||
recordStartTime = json['recordStartTime'];
|
||||
detectionDistance = json['detectionDistance'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['recordMode'] = recordMode;
|
||||
data['recordTime'] = recordTime;
|
||||
data['realTimeMode'] = realTimeMode;
|
||||
data['recordEndTime'] = recordEndTime;
|
||||
data['recordStartTime'] = recordStartTime;
|
||||
data['detectionDistance'] = detectionDistance;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
state.oneMinuteTime.value++;
|
||||
if (state.oneMinuteTime.value >= 60) {
|
||||
t.cancel(); // 取消定时器
|
||||
initiateUdpHangUpAction(); // 挂断操作
|
||||
initiateUdpHangUpAction(1); // 挂断操作
|
||||
print('通话时间超过60秒,自动挂断');
|
||||
state.oneMinuteTime.value = 0;
|
||||
}
|
||||
@ -86,8 +86,8 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
if (state.answerSeconds >= 6) {
|
||||
state.answerTimer.cancel();
|
||||
showToast("接听失败");
|
||||
initiateUdpHangUpAction();
|
||||
// UDPTalkClass().callNoAnswer();
|
||||
// initiateUdpHangUpAction(2);
|
||||
UDPTalkClass().callNoAnswer(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -107,28 +107,37 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
//发起挂断命令,每隔一秒钟发一次,六秒无应答则失败
|
||||
void initiateUdpHangUpAction() {
|
||||
void initiateUdpHangUpAction(int clickIndex) {
|
||||
// 每隔一秒调用一次 udpHangUpAction 方法
|
||||
state.hangUpTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
state.hangUpSeconds++;
|
||||
udpHangUpAction();
|
||||
state.hangUpSeconds++;
|
||||
|
||||
//如果已经挂断成功,则取消定时器
|
||||
if (UDPTalkClass().isEndCall == true) {
|
||||
state.hangUpTimer.cancel();
|
||||
return;
|
||||
}
|
||||
// //如果已经挂断成功,则取消定时器
|
||||
// if (UDPTalkClass().isEndCall == true) {
|
||||
// print('{$clickIndex}已经挂断成功');
|
||||
// state.hangUpTimer.cancel();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (UDPTalkClass().status == 6) {
|
||||
// print('{$clickIndex}被叫中,已经挂断成功');
|
||||
// state.hangUpTimer.cancel();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 检查条件,如果达到6秒且未得到应答,则认为失败
|
||||
if (state.hangUpSeconds >= 6) {
|
||||
state.hangUpTimer.cancel(); // 取消定时器
|
||||
UDPTalkClass().callNoAnswer();
|
||||
// showToast("挂断失败");
|
||||
UDPTalkClass().callNoAnswer(2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 挂断
|
||||
udpHangUpAction() async {
|
||||
print('点了挂断么');
|
||||
UDPSenderManage.sendMainProtocol(
|
||||
command: 150,
|
||||
commandTypeIsCalling: 1,
|
||||
@ -454,12 +463,27 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
// TODO: implement onClose
|
||||
print("锁详情界面销毁了");
|
||||
CallTalk().stopPcmSound();
|
||||
stopProcessing();
|
||||
_getTVDataRefreshUIEvent!.cancel();
|
||||
_getUDPStatusRefreshUIEvent!.cancel();
|
||||
if (state.oneMinuteTimeTimer != null) {
|
||||
state.oneMinuteTimeTimer.cancel();
|
||||
state.oneMinuteTime.value = 0;
|
||||
}
|
||||
stopProcessing();
|
||||
state.listPhotoData.value = Uint8List(0);
|
||||
if (state.answerTimer != null) {
|
||||
state.answerTimer.cancel();
|
||||
state.answerSeconds.value = 0;
|
||||
}
|
||||
|
||||
if (state.hangUpTimer != null) {
|
||||
state.hangUpTimer.cancel();
|
||||
state.hangUpSeconds.value = 0;
|
||||
}
|
||||
|
||||
if (state.openDoorTimer != null) {
|
||||
state.openDoorTimer.cancel();
|
||||
state.openDoorSeconds.value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
import 'package:star_lock/talk/udp/udp_talkClass.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../login/selectCountryRegion/common/index.dart';
|
||||
@ -35,83 +34,89 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (state.listPhotoData.value.isEmpty ||
|
||||
state.listPhotoData.value.length < 10) {
|
||||
return Container(color: Colors.transparent);
|
||||
} else {
|
||||
return Image.memory(
|
||||
state.listPhotoData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (state.listPhotoData.value.isEmpty ||
|
||||
state.listPhotoData.value.length < 10) {
|
||||
return Container(color: Colors.transparent);
|
||||
},
|
||||
);
|
||||
}
|
||||
}),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
width: 1.sw,
|
||||
child: Obx(() {
|
||||
var sec =
|
||||
(state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
||||
var min =
|
||||
(state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("$min:$sec",
|
||||
style: TextStyle(fontSize: 26.sp, color: Colors.white)),
|
||||
// SizedBox(width: 30.w),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(25.h)),
|
||||
// padding: EdgeInsets.all(10.w),
|
||||
// child: Image(
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// image: const AssetImage("images/icon_left_black.png"),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
]);
|
||||
}),
|
||||
} else {
|
||||
return Image.memory(
|
||||
state.listPhotoData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return Container(color: Colors.transparent);
|
||||
},
|
||||
);
|
||||
}
|
||||
}),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
width: 1.sw,
|
||||
child: Obx(() {
|
||||
var sec = (state.oneMinuteTime.value % 60)
|
||||
.toString()
|
||||
.padLeft(2, '0');
|
||||
var min = (state.oneMinuteTime.value ~/ 60)
|
||||
.toString()
|
||||
.padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("$min:$sec",
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: Colors.white)),
|
||||
// SizedBox(width: 30.w),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(25.h)),
|
||||
// padding: EdgeInsets.all(10.w),
|
||||
// child: Image(
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// image: const AssetImage("images/icon_left_black.png"),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
]);
|
||||
}),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10.w,
|
||||
child: Container(
|
||||
width: 1.sw - 30.w * 2,
|
||||
// height: 300.h,
|
||||
margin: EdgeInsets.all(30.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xC83C3F41),
|
||||
borderRadius: BorderRadius.circular(20.h)),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
bottomTopBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
bottomBottomBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10.w,
|
||||
child: Container(
|
||||
width: 1.sw - 30.w * 2,
|
||||
// height: 300.h,
|
||||
margin: EdgeInsets.all(30.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xC83C3F41),
|
||||
borderRadius: BorderRadius.circular(20.h)),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
bottomTopBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
bottomBottomBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
Widget bottomTopBtnWidget() {
|
||||
@ -207,14 +212,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
CallTalk().stopPcmSound();
|
||||
// 挂断
|
||||
if (state.isClickHangUp.value == false) {
|
||||
logic.initiateUdpHangUpAction();
|
||||
logic.initiateUdpHangUpAction(3);
|
||||
state.isClickHangUp.value = true;
|
||||
} else {
|
||||
print('点了这里?');
|
||||
state.isClickHangUp.value = false;
|
||||
UDPTalkClass().stopLocalAudio();
|
||||
logic.udpHangUpAction();
|
||||
}
|
||||
// else {
|
||||
// print('点了这里?');
|
||||
// state.isClickHangUp.value = true;
|
||||
// UDPTalkClass().stopLocalAudio();
|
||||
// logic.initiateUdpHangUpAction(4);
|
||||
// }
|
||||
}),
|
||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
||||
"开锁", AppColors.mainColor, () {
|
||||
|
||||
@ -5,8 +5,6 @@ import '../../../blue/blue_manage.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../talk/udp/udp_help.dart';
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../versionUndate/versionUndateTool.dart';
|
||||
import '../entity/lockListInfo_entity.dart';
|
||||
import 'lockMain_state.dart';
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
@ -55,6 +56,7 @@ class MineSetLogic extends BaseGetXController {
|
||||
UdpHelp().closeUDP();
|
||||
logOut();
|
||||
BlueManage().disconnect();
|
||||
XSJPushProvider().initLocalNotification(true);
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
}
|
||||
}
|
||||
@ -80,8 +82,8 @@ class MineSetLogic extends BaseGetXController {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getNumberEvent =
|
||||
eventBus.on<ChangeLanguageBlockLastLanguageEvent>().listen((event) {
|
||||
state.currentLanguage.value = event.languageTitle;
|
||||
});
|
||||
state.currentLanguage.value = event.languageTitle;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
@ -9,7 +8,6 @@ import '../io_udpType.dart';
|
||||
import '../udp_reply.dart';
|
||||
|
||||
class UDPSendHeartCommand extends UDPSenderProtocol {
|
||||
|
||||
String? userName;
|
||||
List<int>? ipList;
|
||||
String? tokenStr;
|
||||
|
||||
@ -48,6 +48,7 @@ class UdpHelp {
|
||||
ipList: serversList,
|
||||
tokenStr: "b989fa15f75c2ac02718b7c9bb64f80e",
|
||||
);
|
||||
// print('发送心跳了');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -58,9 +59,9 @@ class UdpHelp {
|
||||
}
|
||||
}
|
||||
|
||||
dispose() {
|
||||
udpHeartTimer!.cancel();
|
||||
}
|
||||
// dispose() {
|
||||
// udpHeartTimer!.cancel();
|
||||
// }
|
||||
}
|
||||
|
||||
class UdpData {
|
||||
|
||||
@ -2,8 +2,6 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
|
||||
import 'package:star_lock/talk/udp/udp_manage.dart';
|
||||
|
||||
import '../../blue/io_tool/io_tool.dart';
|
||||
@ -106,6 +104,7 @@ class CommandUDPReciverManager {
|
||||
break;
|
||||
case 30:
|
||||
{
|
||||
// print('收到挂断反馈了');
|
||||
// 挂断
|
||||
if ((data[7] & 0x3) == 1) {
|
||||
// 对方结束对讲
|
||||
@ -114,13 +113,15 @@ class CommandUDPReciverManager {
|
||||
//结束对讲反馈
|
||||
print("结束对讲反馈");
|
||||
}
|
||||
UDPTalkClass().status = 0;
|
||||
UDPTalkClass().isBeCall = false;
|
||||
UDPTalkClass().stopLocalAudio();
|
||||
CallTalk().stopPcmSound();
|
||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
Get.back();
|
||||
print('挂断反馈刷新UI1');
|
||||
// UDPTalkClass().status = 0;
|
||||
// UDPTalkClass().isBeCall = false;
|
||||
// UDPTalkClass().isEndCall = true;
|
||||
// UDPTalkClass().stopLocalAudio();
|
||||
// CallTalk().stopPcmSound();
|
||||
// eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
// Get.back();
|
||||
UDPTalkClass().callNoAnswer(3);
|
||||
// print('挂断反馈刷新UI1');
|
||||
}
|
||||
break;
|
||||
case 140:
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import 'dart:async';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:fast_gbk/fast_gbk.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
|
||||
import 'package:star_lock/talk/call/callTalk.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
import '../../appRouters.dart';
|
||||
import '../../tools/storage.dart';
|
||||
import 'udp_manage.dart';
|
||||
@ -26,7 +27,7 @@ class UDPTalkClass {
|
||||
int status = 0;
|
||||
|
||||
var remoteEquid; // 手机号
|
||||
late Timer timer;
|
||||
late Timer talkTimer;
|
||||
// 该字段是为了判断是否跳转到接听界面 挂断或者退出接听界面要记得变更状态
|
||||
var isBeCall = false;
|
||||
var isEndCall = false; //是否已经调用结束对讲
|
||||
@ -68,7 +69,7 @@ class UDPTalkClass {
|
||||
if (isBeCall == false) {
|
||||
isBeCall = true;
|
||||
// 保持连接
|
||||
timer = Timer.periodic(1.seconds, (timer) {
|
||||
talkTimer = Timer.periodic(1.seconds, (timer) {
|
||||
data[7] = 1;
|
||||
data[8] = 9;
|
||||
UDPManage().sendData(data);
|
||||
@ -83,7 +84,7 @@ class UDPTalkClass {
|
||||
playLocalAudio();
|
||||
|
||||
if (isEndCall == true) {
|
||||
print('已经结束对讲');
|
||||
print('已经结束对讲1');
|
||||
return;
|
||||
}
|
||||
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
@ -91,7 +92,8 @@ class UDPTalkClass {
|
||||
// 检查条件,如果达到60秒且未得到应答,则认为失败
|
||||
if (playLocalAudioSecond >= 60) {
|
||||
playLocalAudioTimer.cancel(); // 取消定时器
|
||||
LockMonitoringLogic().initiateUdpHangUpAction();
|
||||
// LockMonitoringLogic().initiateUdpHangUpAction(5);
|
||||
callNoAnswer(4);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -170,14 +172,48 @@ class UDPTalkClass {
|
||||
}
|
||||
|
||||
//呼叫有响铃无应答处理
|
||||
void callNoAnswer() {
|
||||
// print('无应答处理');
|
||||
void callNoAnswer(int clickIndex) {
|
||||
if (isEndCall == true) {
|
||||
print('已经结束对讲2');
|
||||
return;
|
||||
}
|
||||
print('$clickIndex****无应答处理');
|
||||
stopLocalAudio();
|
||||
status = 0;
|
||||
isBeCall = false;
|
||||
isEndCall = true;
|
||||
LockMonitoringState().isClickHangUp.value = false;
|
||||
// isEndCall = true;
|
||||
// LockMonitoringState().isClickHangUp.value = false;
|
||||
CallTalk().stopPcmSound();
|
||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
Get.back();
|
||||
|
||||
if (talkTimer != null) {
|
||||
talkTimer.cancel();
|
||||
}
|
||||
|
||||
if (playLocalAudioTimer != null) {
|
||||
playLocalAudioTimer.cancel();
|
||||
playLocalAudioSecond = 0;
|
||||
}
|
||||
|
||||
if (LockMonitoringState().oneMinuteTimeTimer != null) {
|
||||
LockMonitoringState().oneMinuteTimeTimer.cancel();
|
||||
LockMonitoringState().oneMinuteTime.value = 0;
|
||||
}
|
||||
LockMonitoringState().listPhotoData.value = Uint8List(0);
|
||||
if (LockMonitoringState().answerTimer != null) {
|
||||
LockMonitoringState().answerTimer.cancel();
|
||||
LockMonitoringState().answerSeconds.value = 0;
|
||||
}
|
||||
|
||||
if (LockMonitoringState().hangUpTimer != null) {
|
||||
LockMonitoringState().hangUpTimer.cancel();
|
||||
LockMonitoringState().hangUpSeconds.value = 0;
|
||||
}
|
||||
|
||||
if (LockMonitoringState().openDoorTimer != null) {
|
||||
LockMonitoringState().openDoorTimer.cancel();
|
||||
LockMonitoringState().openDoorSeconds.value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -48,6 +50,23 @@ class XSJPushProvider {
|
||||
|
||||
void pushBindDeviceID(String deviceID, int deviceType) async {
|
||||
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("绑定成功");
|
||||
}
|
||||
}
|
||||
|
||||
initLocalNotification(bool isCancelLocalPush) async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||
AndroidInitializationSettings('app_icon');
|
||||
const InitializationSettings initializationSettings =
|
||||
InitializationSettings(android: initializationSettingsAndroid);
|
||||
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||
|
||||
if (isCancelLocalPush) {
|
||||
await flutterLocalNotificationsPlugin.cancelAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user