Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
b8278db9ef
@ -27,7 +27,8 @@ class LockDetailPage extends StatefulWidget {
|
|||||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStateMixin, RouteAware {
|
class _LockDetailPageState extends State<LockDetailPage>
|
||||||
|
with TickerProviderStateMixin, RouteAware {
|
||||||
// with RouteAware
|
// with RouteAware
|
||||||
final logic = Get.put(LockDetailLogic());
|
final logic = Get.put(LockDetailLogic());
|
||||||
final state = Get.find<LockDetailLogic>().state;
|
final state = Get.find<LockDetailLogic>().state;
|
||||||
@ -42,22 +43,27 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
state.lockUserNo = state.keyInfos.value.lockUserNo!;
|
||||||
state.senderUserId = state.keyInfos.value.senderUserId!;
|
state.senderUserId = state.keyInfos.value.senderUserId!;
|
||||||
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!;
|
||||||
state.isOpenLockNeedOnline.value = state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
state.isOpenLockNeedOnline.value =
|
||||||
|
state.keyInfos.value.lockSetting!.appUnlockOnline!;
|
||||||
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
||||||
|
|
||||||
BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
BlueManage().connectDeviceName =
|
||||||
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
|
|
||||||
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
List<int> publicKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
Storage.setStringList(saveBluePublicKey, saveStrList);
|
Storage.setStringList(saveBluePublicKey, saveStrList);
|
||||||
|
|
||||||
// 私钥
|
// 私钥
|
||||||
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
List<int> privateKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
|
||||||
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
|
||||||
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
|
||||||
|
|
||||||
// signKey
|
// signKey
|
||||||
List<int> signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
List<int> signKeyData =
|
||||||
|
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
|
||||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||||
|
|
||||||
@ -70,34 +76,32 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Stack(children: [
|
||||||
children: [
|
Container(
|
||||||
Container(
|
width: 1.sw,
|
||||||
width: 1.sw,
|
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
color: Colors.white,
|
||||||
color: Colors.white,
|
child: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
topWidget(),
|
||||||
topWidget(),
|
Expanded(child: Obx(() => bottomWidget())),
|
||||||
Expanded(child: Obx(() => bottomWidget())),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Obx(() => Visibility(
|
),
|
||||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
Obx(() => Visibility(
|
||||||
child: GestureDetector(
|
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||||
onTap: (){
|
child: GestureDetector(
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
onTap: () {
|
||||||
},
|
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||||
child: Container(
|
},
|
||||||
width: 1.sw,
|
child: Container(
|
||||||
height: 1.sh,
|
width: 1.sw,
|
||||||
color: Colors.black.withOpacity(0.3),
|
height: 1.sh,
|
||||||
child: _unlockSuccessWidget()),
|
color: Colors.black.withOpacity(0.3),
|
||||||
),
|
child: _unlockSuccessWidget()),
|
||||||
))
|
),
|
||||||
]
|
))
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget topWidget() {
|
Widget topWidget() {
|
||||||
@ -111,20 +115,27 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 1.sw - 120.w * 2,
|
width: 1.sw - 120.w * 2,
|
||||||
child: Center(
|
child: Center(
|
||||||
child:
|
child: Text(
|
||||||
Text(widget.lockListInfoItemEntity.lockAlias!, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
widget.lockListInfoItemEntity.lockAlias!,
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
||||||
))),
|
))),
|
||||||
Positioned(
|
Positioned(
|
||||||
child: Obx(() => Row(
|
child: Obx(() => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text("${state.electricQuantity.value}%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
|
Text("${state.electricQuantity.value}%",
|
||||||
SizedBox(width: 2.w),
|
style: TextStyle(
|
||||||
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
|
fontSize: 18.sp,
|
||||||
SizedBox(width: 30.w),
|
color: AppColors.darkGrayTextColor)),
|
||||||
],
|
SizedBox(width: 2.w),
|
||||||
))
|
Image.asset(
|
||||||
)
|
showElectricIcon(state.electricQuantity.value),
|
||||||
|
width: 30.w,
|
||||||
|
height: 24.w),
|
||||||
|
SizedBox(width: 30.w),
|
||||||
|
],
|
||||||
|
)))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 30.h),
|
SizedBox(height: 30.h),
|
||||||
@ -136,7 +147,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: Obx(() => Stack(
|
child: Obx(() => Stack(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
// state.connectState.value == 0 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
|
// state.connectState.value == 0 ? 'images/main/icon_main_openLockBtn_grey.png' : 'images/main/icon_main_openLockBtn_center.png',
|
||||||
@ -154,14 +165,14 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Get.log("点击开锁");
|
// Get.log("点击开锁");
|
||||||
logic.startOpenLock();
|
logic.startOpenLock();
|
||||||
},
|
},
|
||||||
onLongPressStart: (details) {
|
onLongPressStart: (details) {
|
||||||
Get.log("长按开锁");
|
Get.log("长按开锁");
|
||||||
// logic.startConnect();
|
// logic.startConnect();
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -214,7 +225,9 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
Text(
|
Text(
|
||||||
state.keyInfos.value.isLockOwner == 1
|
state.keyInfos.value.isLockOwner == 1
|
||||||
? TranslationLoader.lanKeys!.superAdmin!.tr
|
? TranslationLoader.lanKeys!.superAdmin!.tr
|
||||||
: (state.keyInfos.value.keyRight == 1 ? TranslationLoader.lanKeys!.authorizedAdmin!.tr: TranslationLoader.lanKeys!.normalUser!.tr),
|
: (state.keyInfos.value.keyRight == 1
|
||||||
|
? TranslationLoader.lanKeys!.authorizedAdmin!.tr
|
||||||
|
: TranslationLoader.lanKeys!.normalUser!.tr),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||||
),
|
),
|
||||||
@ -290,11 +303,12 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据权限显示不同的底部按钮
|
// 根据权限显示不同的底部按钮
|
||||||
List<Widget> getBottomWidget(){
|
List<Widget> getBottomWidget() {
|
||||||
if(state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1){
|
if (state.keyInfos.value.isLockOwner == 1 ||
|
||||||
|
state.keyInfos.value.keyRight == 1) {
|
||||||
// 超级管理员、授权管理员
|
// 超级管理员、授权管理员
|
||||||
return getAllWidget();
|
return getAllWidget();
|
||||||
}else{
|
} else {
|
||||||
return getNormalWidget();
|
return getNormalWidget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -305,12 +319,14 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
// 操作记录
|
// 操作记录
|
||||||
bottomItem('images/main/icon_main_operatingRecord.png',
|
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||||
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||||
Get.toNamed(Routers.lockOperatingRecordPage,
|
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||||
arguments: {"keyInfo": widget.lockListInfoItemEntity});
|
arguments: {"keyInfo": widget.lockListInfoItemEntity});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// 设置
|
// 设置
|
||||||
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
|
bottomItem(
|
||||||
|
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
|
||||||
|
() {
|
||||||
// BlueManage().stopScan();
|
// BlueManage().stopScan();
|
||||||
Get.toNamed(Routers.lockSetPage,
|
Get.toNamed(Routers.lockSetPage,
|
||||||
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
|
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
|
||||||
@ -376,7 +392,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
//可视对讲门锁新增->人脸
|
//可视对讲门锁新增->人脸
|
||||||
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
|
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
|
||||||
showWidgetArr.add(
|
showWidgetArr.add(
|
||||||
bottomItem('images/main/icon_face.png', TranslationLoader.lanKeys!.humanFace!.tr, () {
|
bottomItem('images/main/icon_face.png',
|
||||||
|
TranslationLoader.lanKeys!.humanFace!.tr, () {
|
||||||
Get.toNamed(Routers.faceList, arguments: {
|
Get.toNamed(Routers.faceList, arguments: {
|
||||||
"lockId": widget.lockListInfoItemEntity.lockId,
|
"lockId": widget.lockListInfoItemEntity.lockId,
|
||||||
}); // Toast.show(msg: "功能暂未开放");
|
}); // Toast.show(msg: "功能暂未开放");
|
||||||
@ -395,7 +412,7 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
bottomItem('images/main/icon_catEyes.png',
|
bottomItem('images/main/icon_catEyes.png',
|
||||||
TranslationLoader.lanKeys!.monitoring!.tr, () {
|
TranslationLoader.lanKeys!.monitoring!.tr, () {
|
||||||
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
Get.toNamed(Routers.realTimePicturePage, arguments: {
|
||||||
"lockId": widget.lockListInfoItemEntity.lockId,
|
"lockName": widget.lockListInfoItemEntity.lockName,
|
||||||
"isMonitoring": true
|
"isMonitoring": true
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -416,16 +433,20 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
arguments: {"keyInfo": widget.lockListInfoItemEntity});
|
arguments: {"keyInfo": widget.lockListInfoItemEntity});
|
||||||
}),
|
}),
|
||||||
// 视频日志
|
// 视频日志
|
||||||
bottomItem('images/main/icon_lockDetail_videoLog.png', TranslationLoader.lanKeys!.videoLog!.tr, () {
|
bottomItem('images/main/icon_lockDetail_videoLog.png',
|
||||||
|
TranslationLoader.lanKeys!.videoLog!.tr, () {
|
||||||
//视频日志
|
//视频日志
|
||||||
Get.toNamed(Routers.videoLogPage);
|
Get.toNamed(Routers.videoLogPage);
|
||||||
}),
|
}),
|
||||||
// 消息提醒
|
// 消息提醒
|
||||||
bottomItem('images/main/icon_lockDetail_messageReminding.png', TranslationLoader.lanKeys!.messageReminding!.tr, () {
|
bottomItem('images/main/icon_lockDetail_messageReminding.png',
|
||||||
|
TranslationLoader.lanKeys!.messageReminding!.tr, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage);
|
Get.toNamed(Routers.msgNotificationPage);
|
||||||
}),
|
}),
|
||||||
// 设置
|
// 设置
|
||||||
bottomItem('images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
|
bottomItem(
|
||||||
|
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
|
||||||
|
() {
|
||||||
// BlueManage().stopScan();
|
// BlueManage().stopScan();
|
||||||
Get.toNamed(Routers.lockSetPage,
|
Get.toNamed(Routers.lockSetPage,
|
||||||
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
|
arguments: {"lockId": widget.lockListInfoItemEntity.lockId});
|
||||||
@ -484,16 +505,16 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
// logic.connectBlueAndAnimationController();
|
// logic.connectBlueAndAnimationController();
|
||||||
}
|
}
|
||||||
|
|
||||||
String showElectricIcon (int electricnumber){
|
String showElectricIcon(int electricnumber) {
|
||||||
if(electricnumber >= 100){
|
if (electricnumber >= 100) {
|
||||||
return 'images/main/icon_lockElectricLevel_5.png';
|
return 'images/main/icon_lockElectricLevel_5.png';
|
||||||
}else if((electricnumber > 50) && (electricnumber < 100)){
|
} else if ((electricnumber > 50) && (electricnumber < 100)) {
|
||||||
return 'images/main/icon_lockElectricLevel_4.png';
|
return 'images/main/icon_lockElectricLevel_4.png';
|
||||||
}else if((electricnumber > 25) && (electricnumber <= 50)){
|
} else if ((electricnumber > 25) && (electricnumber <= 50)) {
|
||||||
return 'images/main/icon_lockElectricLevel_3.png';
|
return 'images/main/icon_lockElectricLevel_3.png';
|
||||||
}else if((electricnumber > 5) && (electricnumber <= 25)){
|
} else if ((electricnumber > 5) && (electricnumber <= 25)) {
|
||||||
return 'images/main/icon_lockElectricLevel_2.png';
|
return 'images/main/icon_lockElectricLevel_2.png';
|
||||||
}else if(electricnumber <= 5){
|
} else if (electricnumber <= 5) {
|
||||||
return 'images/main/icon_lockElectricLevel_1.png';
|
return 'images/main/icon_lockElectricLevel_1.png';
|
||||||
}
|
}
|
||||||
return 'images/main/icon_lockElectricLevel_5.png';
|
return 'images/main/icon_lockElectricLevel_5.png';
|
||||||
@ -631,6 +652,4 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
state.animationController.reset();
|
state.animationController.reset();
|
||||||
state.animationController.forward();
|
state.animationController.forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
command: 150,
|
command: 150,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
subCommand: 30,
|
subCommand: 30,
|
||||||
lockID: state.getLockID.value,
|
lockID: state.getLockName.value,
|
||||||
lockIP: UDPManage().host,
|
lockIP: UDPManage().host,
|
||||||
userMobile: await state.userMobile,
|
userMobile: await state.userMobile,
|
||||||
userMobileIP: await state.userMobileIP,
|
userMobileIP: await state.userMobileIP,
|
||||||
@ -79,7 +79,7 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
command: 152,
|
command: 152,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
subCommand: 20,
|
subCommand: 20,
|
||||||
lockID: state.getLockID.value,
|
lockID: state.getLockName.value,
|
||||||
lockIP: UDPManage().host,
|
lockIP: UDPManage().host,
|
||||||
userMobile: await state.userMobile,
|
userMobile: await state.userMobile,
|
||||||
userMobileIP: await state.userMobileIP,
|
userMobileIP: await state.userMobileIP,
|
||||||
@ -92,11 +92,12 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
command: 152,
|
command: 152,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
subCommand: 1,
|
subCommand: 1,
|
||||||
lockID: state.getLockID.value,
|
lockID: state.getLockName.value,
|
||||||
lockIP: UDPManage().host,
|
lockIP: UDPManage().host,
|
||||||
userMobile: await state.userMobile,
|
userMobile: await state.userMobile,
|
||||||
userMobileIP: await state.userMobileIP,
|
userMobileIP: await state.userMobileIP,
|
||||||
endData: []);
|
endData: []);
|
||||||
|
// print('得到lockName------${state.getLockName.value}');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 接听
|
/// 接听
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
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_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -40,12 +42,24 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 延迟10秒后自动暂停动画
|
initiateUdpMonitorAction();
|
||||||
Future.delayed(const Duration(seconds: 10), () {
|
}
|
||||||
state.animationController.stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
logic.udpMonitorAction();
|
//发起监视命令,每隔一秒钟发一次,三十秒无应答则失败
|
||||||
|
void initiateUdpMonitorAction() {
|
||||||
|
// 每隔一秒调用一次 udpMonitorAction 方法
|
||||||
|
state.realTimePicTimer =
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
state.elapsedSeconds++;
|
||||||
|
logic.udpMonitorAction();
|
||||||
|
|
||||||
|
// 检查条件,如果达到30秒且未得到应答,则认为失败
|
||||||
|
if (state.elapsedSeconds >= 30) {
|
||||||
|
state.realTimePicTimer.cancel(); // 取消定时器
|
||||||
|
|
||||||
|
_handleFailure();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -70,12 +84,14 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
height: 1.sh,
|
height: 1.sh,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)),
|
)),
|
||||||
Positioned(
|
Obx(() => state.listData.value.isEmpty
|
||||||
bottom: 300.h,
|
? Positioned(
|
||||||
child: Text(
|
bottom: 300.h,
|
||||||
'正在创建安全连接...',
|
child: Text(
|
||||||
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
'正在创建安全连接...',
|
||||||
)),
|
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
||||||
|
))
|
||||||
|
: Container()),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 10.w,
|
bottom: 10.w,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -95,7 +111,9 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
buildRotationTransition()
|
Obx(() => state.listData.value.isEmpty
|
||||||
|
? buildRotationTransition()
|
||||||
|
: Container())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -193,10 +211,9 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
})),
|
})),
|
||||||
bottomBtnItemWidget(
|
bottomBtnItemWidget(
|
||||||
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
|
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
|
||||||
logic.stopProcessing();
|
|
||||||
CallTalk().stopPcmSound();
|
|
||||||
// 挂断
|
// 挂断
|
||||||
logic.udpHangUpAction();
|
logic.udpHangUpAction();
|
||||||
|
Get.back();
|
||||||
}),
|
}),
|
||||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
||||||
"开锁", AppColors.mainColor, () {
|
"开锁", AppColors.mainColor, () {
|
||||||
@ -314,11 +331,18 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
state.animationController.forward();
|
state.animationController.forward();
|
||||||
|
initiateUdpMonitorAction();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleFailure() {
|
||||||
|
// 在这里处理失败的逻辑
|
||||||
|
print('Failed to get response within 30 seconds.');
|
||||||
|
state.animationController.stop();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
state.animationController.dispose();
|
state.animationController.dispose();
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class RealTimePictureState {
|
|||||||
Timer(const Duration(seconds: 1), () {}); // 定时器超过60秒关闭当前界面
|
Timer(const Duration(seconds: 1), () {}); // 定时器超过60秒关闭当前界面
|
||||||
var oneMinuteTime = 0.obs; // 定时器秒数
|
var oneMinuteTime = 0.obs; // 定时器秒数
|
||||||
|
|
||||||
var getLockID = ''.obs; //lockID
|
var getLockName = ''.obs; //lockName
|
||||||
|
|
||||||
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
||||||
late Timer answerTimer;
|
late Timer answerTimer;
|
||||||
@ -37,7 +37,11 @@ class RealTimePictureState {
|
|||||||
late Timer openDoorTimer;
|
late Timer openDoorTimer;
|
||||||
late AnimationController animationController;
|
late AnimationController animationController;
|
||||||
|
|
||||||
|
late Timer realTimePicTimer =
|
||||||
|
Timer(const Duration(seconds: 1), () {}); //监视命令定时器
|
||||||
|
var elapsedSeconds = 0.obs;
|
||||||
|
|
||||||
RealTimePictureState() {
|
RealTimePictureState() {
|
||||||
getLockID.value = Get.arguments["lockId"].toString();
|
getLockName.value = Get.arguments["lockName"].toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -406,5 +406,6 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
state.oneMinuteTimeTimer.cancel();
|
state.oneMinuteTimeTimer.cancel();
|
||||||
}
|
}
|
||||||
stopProcessing();
|
stopProcessing();
|
||||||
|
state.listData.value = Uint8List(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,9 @@ class LockMonitoringState {
|
|||||||
|
|
||||||
late final VoiceProcessor? voiceProcessor;
|
late final VoiceProcessor? voiceProcessor;
|
||||||
|
|
||||||
|
late Timer oneMinuteTimeTimer =
|
||||||
late Timer oneMinuteTimeTimer;// 定时器超过60秒关闭当前界面
|
Timer(const Duration(seconds: 1), () {}); // 定时器超过60秒关闭当前界面
|
||||||
var oneMinuteTime = 0.obs;// 定时器秒数
|
var oneMinuteTime = 0.obs; // 定时器秒数
|
||||||
|
|
||||||
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
||||||
late Timer answerTimer;
|
late Timer answerTimer;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
abstract class Api {
|
abstract class Api {
|
||||||
static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境
|
// 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.56.101:8099"; //联调环境
|
||||||
// static String baseAddress = "http://192.168.1.15:8022"; //谢总本地
|
// static String baseAddress = "http://192.168.1.15:8022"; //谢总本地
|
||||||
|
|
||||||
final String baseUrl = "$baseAddress/api";
|
final String baseUrl = "$baseAddress/api";
|
||||||
@ -27,7 +27,8 @@ abstract class Api {
|
|||||||
'/room/uploadElectricQuantity'; //锁电量更新
|
'/room/uploadElectricQuantity'; //锁电量更新
|
||||||
|
|
||||||
final String lockRecordUploadURL = '/lockRecords/fromLock'; //操作上传
|
final String lockRecordUploadURL = '/lockRecords/fromLock'; //操作上传
|
||||||
final String getLockRecordLastUploadDataTimeURL = '/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
final String getLockRecordLastUploadDataTimeURL =
|
||||||
|
'/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
||||||
|
|
||||||
final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token
|
final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token
|
||||||
final String updateLockUserNoURL = '/key/updateLockUserNo'; //更新锁用户NO
|
final String updateLockUserNoURL = '/key/updateLockUserNo'; //更新锁用户NO
|
||||||
@ -60,12 +61,14 @@ abstract class Api {
|
|||||||
final String lockGroupAddLockURL = '/keyGroup/addLockGroup'; //锁分组里面添加锁
|
final String lockGroupAddLockURL = '/keyGroup/addLockGroup'; //锁分组里面添加锁
|
||||||
final String lockGroupDeletLockURL = '/keyGroup/deleteLockGroup'; //锁分组里面删除锁
|
final String lockGroupDeletLockURL = '/keyGroup/deleteLockGroup'; //锁分组里面删除锁
|
||||||
|
|
||||||
final String listLockByGroupURL = '/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表
|
final String listLockByGroupURL =
|
||||||
|
'/authorizedAdmin/listLockByGroup'; //获取分组下的锁列表
|
||||||
final String setRoomStatusURL = '/lock/updateLockStatus'; //标记房态
|
final String setRoomStatusURL = '/lock/updateLockStatus'; //标记房态
|
||||||
// final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
// final String keyGroupListURL = '/keyGroup/list'; //分组列表
|
||||||
// final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
// final String lockListByGroupURL = '/room/listByGroup'; //分组下的锁
|
||||||
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器
|
final String getWifiServiceIpURL = '/wifiLock/getWifiServiceIp'; // 获取Wifi锁服务器
|
||||||
final String updateLockSettingUrl = '/lockSetting/updateLockSetting'; // 锁设置里面所有的设置
|
final String updateLockSettingUrl =
|
||||||
|
'/lockSetting/updateLockSetting'; // 锁设置里面所有的设置
|
||||||
|
|
||||||
final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间
|
final String roomQueryDateUrl = '/room/queryDate'; // 获取网关时间
|
||||||
final String lockDiagnoseUrl = '/room/uploadLockInfo'; // 锁诊断
|
final String lockDiagnoseUrl = '/room/uploadLockInfo'; // 锁诊断
|
||||||
@ -76,12 +79,18 @@ abstract class Api {
|
|||||||
final String setCheckInCreateCompanyURL =
|
final String setCheckInCreateCompanyURL =
|
||||||
'/attendanceCompany/add'; // 设置考勤时创建公司
|
'/attendanceCompany/add'; // 设置考勤时创建公司
|
||||||
|
|
||||||
final String getAttendanceRecordListByDateURL = '/attendanceRecord/listByDate'; // 获取考勤列表-早到榜日榜
|
final String getAttendanceRecordListByDateURL =
|
||||||
final String getAttendanceRecordListByMonthURL = '/attendanceRecord/earlyListByMonth'; // 获取考勤列表-早到榜月榜
|
'/attendanceRecord/listByDate'; // 获取考勤列表-早到榜日榜
|
||||||
final String getAttendanceRecordListLateTimesByDateURL = '/attendanceRecord/lateListByDate'; // 获取考勤列表-迟到榜日榜
|
final String getAttendanceRecordListByMonthURL =
|
||||||
final String getAttendanceRecordListLateTimesByMonthURL = '/attendanceRecord/lateEarlyListByMonth'; // 获取考勤列表-迟到榜月榜
|
'/attendanceRecord/earlyListByMonth'; // 获取考勤列表-早到榜月榜
|
||||||
final String getAttendanceRecordHardworkingListURL = '/attendanceRecord/listForHardworking'; // 获取考勤列表-
|
final String getAttendanceRecordListLateTimesByDateURL =
|
||||||
final String getAttendanceRecordDtailURL = '/attendanceRecord/listByMonth'; // 获取考勤详情
|
'/attendanceRecord/lateListByDate'; // 获取考勤列表-迟到榜日榜
|
||||||
|
final String getAttendanceRecordListLateTimesByMonthURL =
|
||||||
|
'/attendanceRecord/lateEarlyListByMonth'; // 获取考勤列表-迟到榜月榜
|
||||||
|
final String getAttendanceRecordHardworkingListURL =
|
||||||
|
'/attendanceRecord/listForHardworking'; // 获取考勤列表-
|
||||||
|
final String getAttendanceRecordDtailURL =
|
||||||
|
'/attendanceRecord/listByMonth'; // 获取考勤详情
|
||||||
final String getStaffListURL = '/staff/list'; // 获取员工列表
|
final String getStaffListURL = '/staff/list'; // 获取员工列表
|
||||||
final String addStaffURL = '/staff/add'; // 添加员工
|
final String addStaffURL = '/staff/add'; // 添加员工
|
||||||
final String editStaffURL = '/staff/update'; // 编辑员工
|
final String editStaffURL = '/staff/update'; // 编辑员工
|
||||||
@ -96,20 +105,23 @@ abstract class Api {
|
|||||||
final String addFingerprintURL = '/fingerprint/add'; // 添加指纹
|
final String addFingerprintURL = '/fingerprint/add'; // 添加指纹
|
||||||
final String editFingerprintURL = '/fingerprint/changePeriod'; // 编辑指纹
|
final String editFingerprintURL = '/fingerprint/changePeriod'; // 编辑指纹
|
||||||
final String deleteFingerprintURL = '/fingerprint/delete'; // 删除指纹
|
final String deleteFingerprintURL = '/fingerprint/delete'; // 删除指纹
|
||||||
final String updateFingerprintUserNoURL = '/fingerprint/updateFingerprintUserNo'; // 更新指纹用户序号
|
final String updateFingerprintUserNoURL =
|
||||||
|
'/fingerprint/updateFingerprintUserNo'; // 更新指纹用户序号
|
||||||
|
|
||||||
final String getICCardListURL = '/identityCard/list'; // IC卡列表
|
final String getICCardListURL = '/identityCard/list'; // IC卡列表
|
||||||
final String addICCardURL = '/identityCard/add'; // 添加IC卡
|
final String addICCardURL = '/identityCard/add'; // 添加IC卡
|
||||||
final String editICCardURL = '/identityCard/update'; // 编辑IC卡
|
final String editICCardURL = '/identityCard/update'; // 编辑IC卡
|
||||||
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
final String deleteICCardURL = '/identityCard/delete'; // 删除IC卡
|
||||||
final String updateICCardUserNoURL = '/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
final String updateICCardUserNoURL =
|
||||||
|
'/identityCard/updateCardUserNo'; // 更新ic卡用户序号
|
||||||
|
|
||||||
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
final String transferLockListURL = '/room/listForTransfer'; // 转移锁锁列表
|
||||||
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
final String transferLockConfirmURL = '/room/transferLockConfirm'; // 转移智能锁确认
|
||||||
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
final String transferLockURL = '/room/transfer'; // 转移智能锁
|
||||||
|
|
||||||
final String gatewaykListURL = '/plug/list'; // 转网关列表
|
final String gatewaykListURL = '/plug/list'; // 转网关列表
|
||||||
final String transferGatewayConfirmURL = '/plug/transferPlugConfirm'; // 转移网关确认
|
final String transferGatewayConfirmURL =
|
||||||
|
'/plug/transferPlugConfirm'; // 转移网关确认
|
||||||
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
||||||
|
|
||||||
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class CallTalk {
|
|||||||
Future<void> getAVData(Uint8List bb, int len) async {
|
Future<void> getAVData(Uint8List bb, int len) async {
|
||||||
// 音频数据
|
// 音频数据
|
||||||
if (bb[61] == 1) {
|
if (bb[61] == 1) {
|
||||||
|
// print('音频数据来了');
|
||||||
Uint8List g711Data = bb.sublist(77, bb.length);
|
Uint8List g711Data = bb.sublist(77, bb.length);
|
||||||
|
|
||||||
List<int> pcmBytes;
|
List<int> pcmBytes;
|
||||||
@ -62,6 +63,7 @@ class CallTalk {
|
|||||||
}
|
}
|
||||||
// 视频数据
|
// 视频数据
|
||||||
else {
|
else {
|
||||||
|
// print('********视频数据来了');
|
||||||
// 音视频数据开始下标
|
// 音视频数据开始下标
|
||||||
var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256;
|
var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256;
|
||||||
// print('音视频数据开始下标 bagLen:$bagLen');
|
// print('音视频数据开始下标 bagLen:$bagLen');
|
||||||
@ -69,7 +71,7 @@ class CallTalk {
|
|||||||
// 获取帧序号 63
|
// 获取帧序号 63
|
||||||
int getIframeIndex =
|
int getIframeIndex =
|
||||||
bb[POS_iframe_index] + bb[POS_iframe_index + 1] * 256;
|
bb[POS_iframe_index] + bb[POS_iframe_index + 1] * 256;
|
||||||
// print('获取帧序号 getIframeIndex:$getIframeIndex');
|
print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||||
|
|
||||||
// 获取帧长度 65
|
// 获取帧长度 65
|
||||||
// int alen = bb[POS_alen] & 0xff;
|
// int alen = bb[POS_alen] & 0xff;
|
||||||
@ -82,10 +84,10 @@ class CallTalk {
|
|||||||
|
|
||||||
// 当前包号 71
|
// 当前包号 71
|
||||||
int getBagIndex = bb[POS_bag_index] & 0xff;
|
int getBagIndex = bb[POS_bag_index] & 0xff;
|
||||||
// print('当前包号 getBagIndex:$getBagIndex');
|
print('当前包号 getBagIndex:$getBagIndex');
|
||||||
// 总包数 69
|
// 总包数 69
|
||||||
int getBagNum = bb[POS_bag_num] & 0xff;
|
int getBagNum = bb[POS_bag_num] & 0xff;
|
||||||
// print('总包数 getBagNum:$getBagNum');
|
print('总包数 getBagNum:$getBagNum');
|
||||||
// 数据长度 73
|
// 数据长度 73
|
||||||
int blen = bb[POS_blen] + bb[POS_blen + 1] * 256;
|
int blen = bb[POS_blen] + bb[POS_blen + 1] * 256;
|
||||||
// print('数据长度 blen:$blen');
|
// print('数据长度 blen:$blen');
|
||||||
@ -114,10 +116,11 @@ class CallTalk {
|
|||||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||||
|
|
||||||
//判断第一帧是否接收到
|
//判断第一帧是否接收到
|
||||||
if (iframe!.iframeIndex == 0) {
|
// if (iframe!.iframeIndex == 0) {
|
||||||
getFirstFrame = true;
|
// print('得到第一帧了么');
|
||||||
eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
|
// getFirstFrame = true;
|
||||||
}
|
// eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
|
||||||
|
// }
|
||||||
|
|
||||||
eventBus.fire(GetTVDataRefreshUI(growableList));
|
eventBus.fire(GetTVDataRefreshUI(growableList));
|
||||||
}
|
}
|
||||||
@ -157,5 +160,11 @@ class CallTalk {
|
|||||||
FlutterPcmSound.pause();
|
FlutterPcmSound.pause();
|
||||||
FlutterPcmSound.clear();
|
FlutterPcmSound.clear();
|
||||||
FlutterPcmSound.stop();
|
FlutterPcmSound.stop();
|
||||||
|
|
||||||
|
iframe = IframeInfo();
|
||||||
|
iframe!.iframeIndex = 0;
|
||||||
|
iframe!.bagNum = 0;
|
||||||
|
iframe!.bagReceive = 0;
|
||||||
|
growableList = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,6 @@ import '../call/callTalk.dart';
|
|||||||
import 'udp_talkClass.dart';
|
import 'udp_talkClass.dart';
|
||||||
|
|
||||||
class CommandUDPReciverManager {
|
class CommandUDPReciverManager {
|
||||||
|
|
||||||
|
|
||||||
static void appDataReceive(List<int> data) async {
|
static void appDataReceive(List<int> data) async {
|
||||||
///解析数据
|
///解析数据
|
||||||
if (data.isEmpty) {
|
if (data.isEmpty) {
|
||||||
@ -33,7 +31,6 @@ class CommandUDPReciverManager {
|
|||||||
if (data[6] == 4) {
|
if (data[6] == 4) {
|
||||||
if (data[7] == 2) {
|
if (data[7] == 2) {
|
||||||
// print("心跳包反馈 在线状态");
|
// print("心跳包反馈 在线状态");
|
||||||
|
|
||||||
} else if (data[7] == 3) {
|
} else if (data[7] == 3) {
|
||||||
[Toast.show(msg: "您已在其他设备登录")];
|
[Toast.show(msg: "您已在其他设备登录")];
|
||||||
}
|
}
|
||||||
@ -52,7 +49,7 @@ class CommandUDPReciverManager {
|
|||||||
//被叫
|
//被叫
|
||||||
// lockId
|
// lockId
|
||||||
var lockId = data.sublist(9, 29);
|
var lockId = data.sublist(9, 29);
|
||||||
var lockIdStr = utf8String(lockId);
|
var lockIdStr = utf8String(lockId);
|
||||||
UDPManage().lockId = lockIdStr;
|
UDPManage().lockId = lockIdStr;
|
||||||
UDPTalkClass().status = 0;
|
UDPTalkClass().status = 0;
|
||||||
UDPTalkClass().beCallW(data: data);
|
UDPTalkClass().beCallW(data: data);
|
||||||
@ -115,10 +112,10 @@ class CommandUDPReciverManager {
|
|||||||
}
|
}
|
||||||
UDPTalkClass().status = 0;
|
UDPTalkClass().status = 0;
|
||||||
UDPTalkClass().isBeCall = false;
|
UDPTalkClass().isBeCall = false;
|
||||||
Get.back();
|
|
||||||
UDPTalkClass().stopLocalAudio();
|
UDPTalkClass().stopLocalAudio();
|
||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||||
|
Get.back();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 140:
|
case 140:
|
||||||
@ -164,7 +161,9 @@ class CommandUDPReciverManager {
|
|||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
//音视频数据
|
//音视频数据
|
||||||
//print("音视频数据");
|
// print("音视频数据");
|
||||||
|
CallTalk cllTalk = CallTalk();
|
||||||
|
cllTalk.getAVData(data1, data1.length);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user