This commit is contained in:
魏少阳 2024-03-29 18:32:39 +08:00
commit 9f5d5b21a5
15 changed files with 461 additions and 241 deletions

View File

@ -101,6 +101,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
XSJPushProvider().initJPushService(); XSJPushProvider().initJPushService();
XSJPushProvider().initLocalNotification(false);
} }
@override @override

View File

@ -1,7 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/xs_jPhush.dart';
import '../../mine/mine/starLockMine_logic.dart'; import '../../mine/mine/starLockMine_logic.dart';
import '../../network/api_repository.dart'; import '../../network/api_repository.dart';
@ -19,6 +22,7 @@ class StarLockLoginLogic extends BaseGetXController {
Storage.saveLoginData(entity.data); Storage.saveLoginData(entity.data);
// Get.back(); // Get.back();
// Get.toNamed(Routers.starLockMain); // Get.toNamed(Routers.starLockMain);
XSJPushProvider().initJPushService();
Get.offNamedUntil(Routers.starLockMain, (route) => false); Get.offNamedUntil(Routers.starLockMain, (route) => false);
} }
} }

View File

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/flavors.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
import 'app.dart'; import 'app.dart';
@ -18,8 +17,6 @@ FutureOr<void> main() async {
// //
await _initTranslation(); await _initTranslation();
initLocalNotification();
runApp(MyApp()); runApp(MyApp());
if (AppPlatform.isAndroid) { if (AppPlatform.isAndroid) {
@ -48,14 +45,3 @@ Future _setCommonServices() async {
} }
// Get.log(PlatformInfoService.to.info.version); // 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);
}

View File

@ -13,5 +13,28 @@ class CatEyeSetState {
CatEyeSetState() { CatEyeSetState() {
Map map = Get.arguments; Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; 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;
}
}
} }
} }

View File

@ -15,6 +15,7 @@ class CatEyeWorkModeLogic extends BaseGetXController {
'recordMode': state.recordMode.value, 'recordMode': state.recordMode.value,
'recordStartTime': state.recordStartTime.value, 'recordStartTime': state.recordStartTime.value,
'recordEndTime': state.recordEndTime.value, 'recordEndTime': state.recordEndTime.value,
'recordTime': state.recordTime.value,
'detectionDistance': state.detectionDistance.value, 'detectionDistance': state.detectionDistance.value,
'realTimeMode': state.realTimeMode.value, 'realTimeMode': state.realTimeMode.value,
} }

View File

@ -33,12 +33,12 @@ class LockSetInfoData {
LockBasicInfo? lockBasicInfo; LockBasicInfo? lockBasicInfo;
LockSettingInfo? lockSettingInfo; LockSettingInfo? lockSettingInfo;
LockSetInfoData({ LockSetInfoData(
this.lockId, {this.lockId,
this.lockStatus, this.lockStatus,
this.lockFeature, this.lockFeature,
this.lockBasicInfo, this.lockBasicInfo,
this.lockSettingInfo}); this.lockSettingInfo});
LockSetInfoData.fromJson(Map<String, dynamic> json) { LockSetInfoData.fromJson(Map<String, dynamic> json) {
lockId = json['lockId']; lockId = json['lockId'];
@ -145,59 +145,60 @@ class LockFeature {
int? stayWarn; int? stayWarn;
int? abnormalWarn; int? abnormalWarn;
LockFeature( LockFeature({
{this.password, this.password,
this.icCard, this.icCard,
this.fingerprint, this.fingerprint,
this.fingerVein, this.fingerVein,
this.palmVein, this.palmVein,
this.d3Face, this.d3Face,
this.qrCode, this.qrCode,
this.bluetoothRemoteControl, this.bluetoothRemoteControl,
this.wirelessKey, this.wirelessKey,
this.gatewayUnlock, this.gatewayUnlock,
this.lockCommand, this.lockCommand,
this.firmwareUpgrade, this.firmwareUpgrade,
this.passwordIssue, this.passwordIssue,
this.cardIssue, this.cardIssue,
this.fingerprintIssue, this.fingerprintIssue,
this.fingerVeinIssue, this.fingerVeinIssue,
this.palmVeinIssue, this.palmVeinIssue,
this.d3FaceIssue, this.d3FaceIssue,
this.lockFreeze, this.lockFreeze,
this.readAdminPassword, this.readAdminPassword,
this.passwordManagement, this.passwordManagement,
this.passwordWithDelete, this.passwordWithDelete,
this.remoteUnlock, this.remoteUnlock,
this.autoLock, this.autoLock,
this.antiPrySwitch, this.antiPrySwitch,
this.resetSwitch, this.resetSwitch,
this.lockSwitch, this.lockSwitch,
this.lockSound, this.lockSound,
this.languageSetting, this.languageSetting,
this.realTimeClock, this.realTimeClock,
this.wifi, this.wifi,
this.videoIntercom, this.videoIntercom,
this.cyclePassword, this.cyclePassword,
this.cycleFingerprintCard, this.cycleFingerprintCard,
this.doubleAuthentication, this.doubleAuthentication,
this.openDirection, this.openDirection,
this.proximitySensing, this.proximitySensing,
this.doorStatus, this.doorStatus,
this.wiredDoorMagnet, this.wiredDoorMagnet,
this.wirelessDoorMagnet, this.wirelessDoorMagnet,
this.doorNotClosedAlarm, this.doorNotClosedAlarm,
this.unlockReminder, this.unlockReminder,
this.wirelessKeyboard, this.wirelessKeyboard,
this.lightingTime, this.lightingTime,
this.passageMode, this.passageMode,
this.hotelLockCardSystem, this.hotelLockCardSystem,
this.appUnlockOnline, this.appUnlockOnline,
this.bluetoothBroadcast, this.bluetoothBroadcast,
this.attendance, this.attendance,
this.motorTorsion, this.motorTorsion,
this.stayWarn, this.stayWarn,
this.abnormalWarn,}); this.abnormalWarn,
});
LockFeature.fromJson(Map<String, dynamic> json) { LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password']; password = json['password'];
@ -335,26 +336,25 @@ class LockBasicInfo {
int? lockUserNo; int? lockUserNo;
LockBasicInfo( LockBasicInfo(
{ {this.lockId,
this.lockId, this.electricQuantityDate,
this.electricQuantityDate, this.keyId,
this.keyId, this.model,
this.model, this.electricQuantity,
this.electricQuantity, this.indate,
this.indate, this.isLockOwner,
this.isLockOwner, this.lockAlias,
this.lockAlias, this.lockName,
this.lockName, this.groupId,
this.groupId, this.groupName,
this.groupName, this.groupData,
this.groupData, this.adminPwd,
this.adminPwd, this.keyType,
this.keyType, this.startDate,
this.startDate, this.endDate,
this.endDate, this.mac,
this.mac, this.keyRight,
this.keyRight, this.senderUserId,
this.senderUserId,
this.lockUserNo}); this.lockUserNo});
LockBasicInfo.fromJson(Map<String, dynamic> json) { LockBasicInfo.fromJson(Map<String, dynamic> json) {
@ -458,33 +458,60 @@ class LockSettingInfo {
int? motorTorsion; int? motorTorsion;
int? stayWarn; int? stayWarn;
int? abnormalWarn; 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( LockSettingInfo({
{this.remoteUnlock, this.remoteUnlock,
this.autoLock, this.autoLock,
this.autoLockSecond, this.autoLockSecond,
this.antiPrySwitch, this.antiPrySwitch,
this.resetSwitch, this.resetSwitch,
this.lockSwitch, this.lockSwitch,
this.lockSound, this.lockSound,
this.lockSoundVolume, this.lockSoundVolume,
this.languageSettingLang, this.languageSettingLang,
this.openDirectionValue, this.openDirectionValue,
this.doorNotClosedAlarm, this.doorNotClosedAlarm,
this.unlockReminder, this.unlockReminder,
this.lightingTime, this.lightingTime,
this.lightingSecond, this.lightingSecond,
this.passageMode, this.passageMode,
this.passageModeConfig, this.passageModeConfig,
this.attendance, this.attendance,
this.appUnlockOnline, this.appUnlockOnline,
this.bluetoothBroadcast, this.bluetoothBroadcast,
this.adminPwd, this.adminPwd,
this.unlockReminderPush, this.unlockReminderPush,
this.languageSettingLangText, this.languageSettingLangText,
this.motorTorsion, this.motorTorsion,
this.stayWarn, this.stayWarn,
this.abnormalWarn,}); 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) { LockSettingInfo.fromJson(Map<String, dynamic> json) {
remoteUnlock = json['remoteUnlock']; remoteUnlock = json['remoteUnlock'];
@ -517,6 +544,24 @@ class LockSettingInfo {
motorTorsion = json['motorTorsion']; motorTorsion = json['motorTorsion'];
stayWarn = json['stayWarn']; stayWarn = json['stayWarn'];
abnormalWarn = json['abnormalWarn']; 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() { Map<String, dynamic> toJson() {
@ -549,6 +594,22 @@ class LockSettingInfo {
data['motorTorsion'] = motorTorsion; data['motorTorsion'] = motorTorsion;
data['stayWarn'] = stayWarn; data['stayWarn'] = stayWarn;
data['abnormalWarn'] = abnormalWarn; 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; 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;
}
}

View File

@ -61,7 +61,7 @@ class LockMonitoringLogic extends BaseGetXController {
state.oneMinuteTime.value++; state.oneMinuteTime.value++;
if (state.oneMinuteTime.value >= 60) { if (state.oneMinuteTime.value >= 60) {
t.cancel(); // t.cancel(); //
initiateUdpHangUpAction(); // initiateUdpHangUpAction(1); //
print('通话时间超过60秒自动挂断'); print('通话时间超过60秒自动挂断');
state.oneMinuteTime.value = 0; state.oneMinuteTime.value = 0;
} }
@ -86,8 +86,8 @@ class LockMonitoringLogic extends BaseGetXController {
if (state.answerSeconds >= 6) { if (state.answerSeconds >= 6) {
state.answerTimer.cancel(); state.answerTimer.cancel();
showToast("接听失败"); showToast("接听失败");
initiateUdpHangUpAction(); // initiateUdpHangUpAction(2);
// UDPTalkClass().callNoAnswer(); UDPTalkClass().callNoAnswer(1);
} }
}); });
} }
@ -107,28 +107,37 @@ class LockMonitoringLogic extends BaseGetXController {
} }
// //
void initiateUdpHangUpAction() { void initiateUdpHangUpAction(int clickIndex) {
// udpHangUpAction // udpHangUpAction
state.hangUpTimer = Timer.periodic(const Duration(seconds: 1), (timer) { state.hangUpTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
state.hangUpSeconds++;
udpHangUpAction(); udpHangUpAction();
state.hangUpSeconds++;
// // //
if (UDPTalkClass().isEndCall == true) { // if (UDPTalkClass().isEndCall == true) {
state.hangUpTimer.cancel(); // print('{$clickIndex}已经挂断成功');
return; // state.hangUpTimer.cancel();
} // return;
// }
// if (UDPTalkClass().status == 6) {
// print('{$clickIndex}被叫中,已经挂断成功');
// state.hangUpTimer.cancel();
// return;
// }
// 6 // 6
if (state.hangUpSeconds >= 6) { if (state.hangUpSeconds >= 6) {
state.hangUpTimer.cancel(); // state.hangUpTimer.cancel(); //
UDPTalkClass().callNoAnswer(); // showToast("挂断失败");
UDPTalkClass().callNoAnswer(2);
} }
}); });
} }
/// ///
udpHangUpAction() async { udpHangUpAction() async {
print('点了挂断么');
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
command: 150, command: 150,
commandTypeIsCalling: 1, commandTypeIsCalling: 1,
@ -454,12 +463,27 @@ class LockMonitoringLogic extends BaseGetXController {
// TODO: implement onClose // TODO: implement onClose
print("锁详情界面销毁了"); print("锁详情界面销毁了");
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
stopProcessing();
_getTVDataRefreshUIEvent!.cancel(); _getTVDataRefreshUIEvent!.cancel();
_getUDPStatusRefreshUIEvent!.cancel(); _getUDPStatusRefreshUIEvent!.cancel();
if (state.oneMinuteTimeTimer != null) { if (state.oneMinuteTimeTimer != null) {
state.oneMinuteTimeTimer.cancel(); state.oneMinuteTimeTimer.cancel();
state.oneMinuteTime.value = 0;
} }
stopProcessing();
state.listPhotoData.value = Uint8List(0); 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;
}
} }
} }

View File

@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/talk/call/callTalk.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 '../../../../app_settings/app_colors.dart';
import '../../../../login/selectCountryRegion/common/index.dart'; import '../../../../login/selectCountryRegion/common/index.dart';
@ -35,83 +34,89 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return PopScope(
width: 1.sw, canPop: false,
height: 1.sh, child: Container(
child: Stack( width: 1.sw,
children: [ height: 1.sh,
Obx(() { color: Colors.white,
if (state.listPhotoData.value.isEmpty || child: Stack(
state.listPhotoData.value.length < 10) { children: [
return Container(color: Colors.transparent); Obx(() {
} else { if (state.listPhotoData.value.isEmpty ||
return Image.memory( state.listPhotoData.value.length < 10) {
state.listPhotoData.value,
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(color: Colors.transparent); return Container(color: Colors.transparent);
}, } else {
); return Image.memory(
} state.listPhotoData.value,
}), gaplessPlayback: true,
Positioned( width: 1.sw,
top: ScreenUtil().statusBarHeight + 30.h, height: 1.sh,
width: 1.sw, fit: BoxFit.cover,
child: Obx(() { errorBuilder: (context, error, stackTrace) {
var sec = return Container(color: Colors.transparent);
(state.oneMinuteTime.value % 60).toString().padLeft(2, '0'); },
var min = );
(state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0'); }
return Row( }),
mainAxisAlignment: MainAxisAlignment.center, Positioned(
children: [ top: ScreenUtil().statusBarHeight + 30.h,
Text("$min:$sec", width: 1.sw,
style: TextStyle(fontSize: 26.sp, color: Colors.white)), child: Obx(() {
// SizedBox(width: 30.w), var sec = (state.oneMinuteTime.value % 60)
// GestureDetector( .toString()
// onTap: () { .padLeft(2, '0');
// Get.back(); var min = (state.oneMinuteTime.value ~/ 60)
// }, .toString()
// child: Container( .padLeft(2, '0');
// decoration: BoxDecoration( return Row(
// color: Colors.white, mainAxisAlignment: MainAxisAlignment.center,
// borderRadius: BorderRadius.circular(25.h)), children: [
// padding: EdgeInsets.all(10.w), Text("$min:$sec",
// child: Image( style: TextStyle(
// width: 40.w, fontSize: 26.sp, color: Colors.white)),
// height: 40.w, // SizedBox(width: 30.w),
// image: const AssetImage("images/icon_left_black.png"), // 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() { Widget bottomTopBtnWidget() {
@ -207,14 +212,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
// //
if (state.isClickHangUp.value == false) { if (state.isClickHangUp.value == false) {
logic.initiateUdpHangUpAction(); logic.initiateUdpHangUpAction(3);
state.isClickHangUp.value = true; 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", bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
"开锁", AppColors.mainColor, () { "开锁", AppColors.mainColor, () {

View File

@ -5,8 +5,6 @@ import '../../../blue/blue_manage.dart';
import '../../../network/api_repository.dart'; import '../../../network/api_repository.dart';
import '../../../talk/udp/udp_help.dart'; import '../../../talk/udp/udp_help.dart';
import '../../../tools/baseGetXController.dart'; import '../../../tools/baseGetXController.dart';
import '../../../tools/eventBusEventManage.dart';
import '../../../versionUndate/versionUndateTool.dart';
import '../entity/lockListInfo_entity.dart'; import '../entity/lockListInfo_entity.dart';
import 'lockMain_state.dart'; import 'lockMain_state.dart';

View File

@ -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/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart'; import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/xs_jPhush.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
import '../../../blue/blue_manage.dart'; import '../../../blue/blue_manage.dart';
@ -55,6 +56,7 @@ class MineSetLogic extends BaseGetXController {
UdpHelp().closeUDP(); UdpHelp().closeUDP();
logOut(); logOut();
BlueManage().disconnect(); BlueManage().disconnect();
XSJPushProvider().initLocalNotification(true);
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
} }
} }
@ -80,8 +82,8 @@ class MineSetLogic extends BaseGetXController {
// eventBus // eventBus
_getNumberEvent = _getNumberEvent =
eventBus.on<ChangeLanguageBlockLastLanguageEvent>().listen((event) { eventBus.on<ChangeLanguageBlockLastLanguageEvent>().listen((event) {
state.currentLanguage.value = event.languageTitle; state.currentLanguage.value = event.languageTitle;
}); });
} }
@override @override

View File

@ -1,4 +1,3 @@
import 'dart:convert'; import 'dart:convert';
import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/io_tool.dart';
@ -9,7 +8,6 @@ import '../io_udpType.dart';
import '../udp_reply.dart'; import '../udp_reply.dart';
class UDPSendHeartCommand extends UDPSenderProtocol { class UDPSendHeartCommand extends UDPSenderProtocol {
String? userName; String? userName;
List<int>? ipList; List<int>? ipList;
String? tokenStr; String? tokenStr;

View File

@ -48,6 +48,7 @@ class UdpHelp {
ipList: serversList, ipList: serversList,
tokenStr: "b989fa15f75c2ac02718b7c9bb64f80e", tokenStr: "b989fa15f75c2ac02718b7c9bb64f80e",
); );
// print('发送心跳了');
}); });
} }
} }
@ -58,9 +59,9 @@ class UdpHelp {
} }
} }
dispose() { // dispose() {
udpHeartTimer!.cancel(); // udpHeartTimer!.cancel();
} // }
} }
class UdpData { class UdpData {

View File

@ -2,8 +2,6 @@ import 'dart:typed_data';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.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 'package:star_lock/talk/udp/udp_manage.dart';
import '../../blue/io_tool/io_tool.dart'; import '../../blue/io_tool/io_tool.dart';
@ -106,6 +104,7 @@ class CommandUDPReciverManager {
break; break;
case 30: case 30:
{ {
// print('收到挂断反馈了');
// //
if ((data[7] & 0x3) == 1) { if ((data[7] & 0x3) == 1) {
// //
@ -114,13 +113,15 @@ class CommandUDPReciverManager {
// //
print("结束对讲反馈"); print("结束对讲反馈");
} }
UDPTalkClass().status = 0; // UDPTalkClass().status = 0;
UDPTalkClass().isBeCall = false; // UDPTalkClass().isBeCall = false;
UDPTalkClass().stopLocalAudio(); // UDPTalkClass().isEndCall = true;
CallTalk().stopPcmSound(); // UDPTalkClass().stopLocalAudio();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status)); // CallTalk().stopPcmSound();
Get.back(); // eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
print('挂断反馈刷新UI1'); // Get.back();
UDPTalkClass().callNoAnswer(3);
// print('挂断反馈刷新UI1');
} }
break; break;
case 140: case 140:

View File

@ -1,11 +1,12 @@
import 'dart:async'; import 'dart:async';
import 'package:audioplayers/audioplayers.dart'; import 'package:audioplayers/audioplayers.dart';
import 'package:fast_gbk/fast_gbk.dart'; import 'package:fast_gbk/fast_gbk.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:get/get.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/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
import 'package:star_lock/talk/call/callTalk.dart'; import 'package:star_lock/talk/call/callTalk.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../tools/storage.dart'; import '../../tools/storage.dart';
import 'udp_manage.dart'; import 'udp_manage.dart';
@ -26,7 +27,7 @@ class UDPTalkClass {
int status = 0; int status = 0;
var remoteEquid; // var remoteEquid; //
late Timer timer; late Timer talkTimer;
// 退 // 退
var isBeCall = false; var isBeCall = false;
var isEndCall = false; // var isEndCall = false; //
@ -68,7 +69,7 @@ class UDPTalkClass {
if (isBeCall == false) { if (isBeCall == false) {
isBeCall = true; isBeCall = true;
// //
timer = Timer.periodic(1.seconds, (timer) { talkTimer = Timer.periodic(1.seconds, (timer) {
data[7] = 1; data[7] = 1;
data[8] = 9; data[8] = 9;
UDPManage().sendData(data); UDPManage().sendData(data);
@ -83,7 +84,7 @@ class UDPTalkClass {
playLocalAudio(); playLocalAudio();
if (isEndCall == true) { if (isEndCall == true) {
print('已经结束对讲'); print('已经结束对讲1');
return; return;
} }
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) { playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
@ -91,7 +92,8 @@ class UDPTalkClass {
// 60 // 60
if (playLocalAudioSecond >= 60) { if (playLocalAudioSecond >= 60) {
playLocalAudioTimer.cancel(); // playLocalAudioTimer.cancel(); //
LockMonitoringLogic().initiateUdpHangUpAction(); // LockMonitoringLogic().initiateUdpHangUpAction(5);
callNoAnswer(4);
} }
}); });
} else { } else {
@ -170,14 +172,48 @@ class UDPTalkClass {
} }
// //
void callNoAnswer() { void callNoAnswer(int clickIndex) {
// print('无应答处理'); if (isEndCall == true) {
print('已经结束对讲2');
return;
}
print('$clickIndex****无应答处理');
stopLocalAudio(); stopLocalAudio();
status = 0; status = 0;
isBeCall = false; isBeCall = false;
isEndCall = true; // isEndCall = true;
LockMonitoringState().isClickHangUp.value = false; // LockMonitoringState().isClickHangUp.value = false;
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
Get.back(); 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;
}
} }
} }

View File

@ -1,5 +1,7 @@
import 'dart:io'; 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:jpush_flutter/jpush_flutter.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -48,6 +50,23 @@ class XSJPushProvider {
void pushBindDeviceID(String deviceID, int deviceType) async { void pushBindDeviceID(String deviceID, int deviceType) async {
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType); 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();
}
} }
} }