1,监视状态下新增音频数据

2,完善录像时段页面
This commit is contained in:
Daisy 2024-01-12 11:59:47 +08:00
parent 9231f3cef6
commit 3a1fb84381
7 changed files with 147 additions and 154 deletions

View File

@ -49,14 +49,21 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildSubTitleItem( Obx(() => _buildSubTitleItem(
'人体侦测距离', '有人出现在门前1.5米范围时启动录像', state.detectionRange.value, () { '人体侦测距离', '有人出现在门前1.5米范围时启动录像', state.detectionRange.value,
_openBottomItemSheet(state.detectionRangeList.value, 1); () {
}), _openBottomItemSheet(state.detectionRangeList.value, 1);
Expanded( })),
child: SizedBox( SizedBox(
height: 30.h, height: 30.h,
)), ),
CommonItem(
leftTitel: '实时画面',
rightTitle: "全天",
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: false,
)
], ],
)); ));
} }
@ -135,6 +142,10 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
if (clickIndex == 0) { if (clickIndex == 0) {
// //
state.showsUpVideo.value = state.showsUpVideoList.value[value]; state.showsUpVideo.value = state.showsUpVideoList.value[value];
} else if (clickIndex == 1) {
//
state.detectionRange.value =
state.detectionRangeList.value[value];
} }
setState(() {}); setState(() {});

View File

@ -37,7 +37,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView('自定义时间', '', 1, boolList[1]), _buildCustomTimeView('自定义时间', '', 1),
], ],
)); ));
} }
@ -49,9 +49,7 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
width: ScreenUtil().screenWidth - 40.w, width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isClick color: AppColors.greyBackgroundColor,
? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor,
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
child: Padding( child: Padding(
@ -59,19 +57,13 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: [
isClick SizedBox(
? Image.asset( width: 20.w,
'images/mine/icon_mine_blueSelect.png', height: 14.w,
width: 20.w, ),
height: 14.w,
)
: SizedBox(
width: 20.w,
height: 14.w,
),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: _buildRichText(titleStr, subTitle, isClick), child: _buildRichText(titleStr, subTitle, false),
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
@ -93,6 +85,91 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
); );
} }
//
Widget _buildCustomTimeView(String leftStr, String rightStr, int isEndTIme) {
return GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration(
color: AppColors.blueViewBgColor,
borderRadius: BorderRadius.circular(10.0),
),
child: Padding(
padding: EdgeInsets.only(
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Column(
children: [
Row(
children: [
Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
),
SizedBox(width: 10.w),
Expanded(
child: _buildRichText('自定义时间', '', true),
),
SizedBox(
width: 10.w,
),
],
),
Container(
height: 1,
margin: EdgeInsets.only(
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
color: AppColors.blueTextTipsColor,
),
startAndEndTimeRow(false),
SizedBox(
height: 30.h,
),
startAndEndTimeRow(true),
],
)),
),
onTap: () {},
);
}
//
Widget startAndEndTimeRow(bool isEndTime) {
return GestureDetector(
child: Row(
children: [
SizedBox(
width: 20.w,
),
Text(
isEndTime == false ? '开始时间' : '结束时间',
style:
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
),
Expanded(
child: SizedBox(
width: 20.w,
)),
Text(
isEndTime == false ? '当日22:00' : '次日08:00',
style:
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
),
SizedBox(
width: 10.w,
),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
)
],
),
onTap: () {},
);
}
Widget _buildRichText(String titleStr, String subTitle, bool isClick) { Widget _buildRichText(String titleStr, String subTitle, bool isClick) {
// //
final TextStyle titleStyle = TextStyle( final TextStyle titleStyle = TextStyle(

View File

@ -279,8 +279,8 @@ class LockMonitoringLogic extends BaseGetXController {
topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF); topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF);
topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8); topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8);
print( // print(
"udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); // "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
topBytes.addAll(bytes); topBytes.addAll(bytes);
Get.log("setVoiceBytes:$topBytes"); Get.log("setVoiceBytes:$topBytes");

View File

@ -41,51 +41,11 @@ class RealTimePictureLogic extends BaseGetXController {
StreamSubscription? _getUDPStatusRefreshUIEvent; StreamSubscription? _getUDPStatusRefreshUIEvent;
void _getUDPStatusRefreshUIAction() { void _getUDPStatusRefreshUIAction() {
_getUDPStatusRefreshUIEvent = _getUDPStatusRefreshUIEvent =
eventBus.on<GetUDPStatusRefreshUI>().listen((event) { eventBus.on<GetUDPStatusMonitorUI>().listen((event) {
state.udpStatus.value = event.udpStatus; state.udpStatus.value = event.udpStatus;
if (state.udpStatus.value == 8) {
// 60
state.oneMinuteTimeTimer =
Timer.periodic(const Duration(seconds: 1), (Timer t) async {
state.oneMinuteTime.value++;
// Get.log('state.oneMinuteTime.value:${state.oneMinuteTime.value}');
if (state.oneMinuteTime.value >= 60) {
// 60
state.oneMinuteTimeTimer.cancel();
state.oneMinuteTime.value = 0;
//
UDPSenderManage.sendMainProtocol(
command: 150,
commandTypeIsCalling: 1,
subCommand: 30,
lockID: state.getLockName.value,
lockIP: UDPManage().host,
userMobile: await state.userMobile,
userMobileIP: await state.userMobileIP,
endData: []);
CallTalk().stopPcmSound();
//
Get.back();
}
});
}
}); });
} }
//
udpQueryMonitoringStatusAction() async {
UDPSenderManage.sendMainProtocol(
command: 152,
commandTypeIsCalling: 1,
subCommand: 20,
lockID: state.getLockName.value,
lockIP: UDPManage().host,
userMobile: await state.userMobile,
userMobileIP: await state.userMobileIP,
endData: []);
}
/// ///
udpMonitorAction() async { udpMonitorAction() async {
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
@ -100,19 +60,6 @@ class RealTimePictureLogic extends BaseGetXController {
// print('得到lockName------${state.getLockName.value}'); // print('得到lockName------${state.getLockName.value}');
} }
///
udpAnswerAction() async {
UDPSenderManage.sendMainProtocol(
command: 150,
commandTypeIsCalling: 1,
subCommand: 6,
lockID: UDPManage().lockId,
lockIP: UDPManage().host,
userMobile: await state.userMobile,
userMobileIP: await state.userMobileIP,
endData: []);
}
/// ///
udpHangUpAction() async { udpHangUpAction() async {
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
@ -232,67 +179,11 @@ class RealTimePictureLogic extends BaseGetXController {
String? lockIP = args["lockIP"]; String? lockIP = args["lockIP"];
String? userMobile = args["userMobile"]; String? userMobile = args["userMobile"];
String? userMobileIP = args["userMobileIP"]; String? userMobileIP = args["userMobileIP"];
// int length = 320; // List的长度
// List<int> list = state.listAudioData.value.sublist(0, 320);
// for (int i = 0; i < bytes.length; i += length) {
// int end = (i + length < bytes.length) ? i + length : bytes.length;
// bytes.sublist(i, end);
// // _sendRecordData(bytes.sublist(i, end));
// // //
// }
// while(list.isNotEmpty) {
state.udpSendDataFrameNumber++; state.udpSendDataFrameNumber++;
if (state.udpSendDataFrameNumber >= 65536) state.udpSendDataFrameNumber = 1; if (state.udpSendDataFrameNumber >= 65536) state.udpSendDataFrameNumber = 1;
// 57 // 57
List<int> topBytes = []; List<int> topBytes = [];
// var cID = "XXXCID";
// List<int> cIDData = utf8.encode(cID!);
// topBytes.addAll(cIDData);
// // topBytes = getFixedLengthList(cIDData, 20 - cIDData.length);
// for (int i = 0; i < 6 - cIDData.length; i++) {
// topBytes.add(0);
// }
//
// //
// topBytes.add(150);
//
// //
// topBytes.add(1);
//
// //
// topBytes.add(8);
//
// // lockID
// List<int> lockIDData = utf8.encode(lockID!);
// topBytes.addAll(lockIDData);
// // topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length);
// for (int i = 0; i < 20 - lockIDData.length; i++) {
// topBytes.add(0);
// }
//
// // lockIP
// var lockIPList = lockIP!.split(".");
// lockIPList.forEach((element) {
// topBytes.add(int.parse(element));
// });
//
// // userMobile
// List<int> userMobileData = utf8.encode(userMobile!);
// topBytes.addAll(userMobileData);
// // topBytes = getFixedLengthList(topBytes, 20 - userMobileData.length);
// for (int i = 0; i < 20 - userMobileData.length; i++) {
// topBytes.add(0);
// }
//
// // userMobileIP
// var userMobileIPList = userMobileIP!.split(".");
// userMobileIPList.forEach((element) {
// topBytes.add(int.parse(element));
// });
topBytes.addAll([ topBytes.addAll([
1, 1, 1, 1, // 1, 1, 1, 1, //
1, 0, // 1, 0, //
@ -307,13 +198,13 @@ class RealTimePictureLogic extends BaseGetXController {
topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF); topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF);
topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8); topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8);
print( // print(
"udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}"); // "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
topBytes.addAll(bytes); topBytes.addAll(bytes);
Get.log("setVoiceBytes:$topBytes"); Get.log("setVoiceBytes:$topBytes");
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
command: 150, command: 152,
commandTypeIsCalling: 1, commandTypeIsCalling: 1,
subCommand: 8, subCommand: 8,
lockID: lockID, lockID: lockID,
@ -427,6 +318,7 @@ class RealTimePictureLogic extends BaseGetXController {
void onClose() { void onClose() {
// TODO: implement onClose // TODO: implement onClose
print("锁详情界面销毁了"); print("锁详情界面销毁了");
CallTalk().stopPcmSound();
_getTVDataRefreshUIEvent!.cancel(); _getTVDataRefreshUIEvent!.cancel();
_getUDPStatusRefreshUIEvent!.cancel(); _getUDPStatusRefreshUIEvent!.cancel();
if (state.oneMinuteTimeTimer != null) { if (state.oneMinuteTimeTimer != null) {
@ -434,8 +326,5 @@ class RealTimePictureLogic extends BaseGetXController {
} }
stopProcessing(); stopProcessing();
state.listData.value = Uint8List(0); state.listData.value = Uint8List(0);
if (state.realTimePicTimer != null) {
state.realTimePicTimer.cancel();
}
} }
} }

View File

@ -5,6 +5,7 @@ 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';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/talk/call/callTalk.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/showTFView.dart'; import '../../../../tools/showTFView.dart';
@ -32,8 +33,11 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
Get.back(); Get.back();
}); });
state.animationController = state.animationController = AnimationController(
AnimationController(duration: const Duration(seconds: 1), vsync: this); vsync: this, // 使TickerProvider是当前Widget
duration: const Duration(seconds: 1),
);
;
state.animationController.repeat(); state.animationController.repeat();
//StatusListener //StatusListener
state.animationController.addStatusListener((status) { state.animationController.addStatusListener((status) {
@ -200,8 +204,12 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
// //
Obx(() => bottomBtnItemWidget( Obx(() => bottomBtnItemWidget(
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async { getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
Toast.show(msg: "监视中无音频"); //
Toast.show(msg: '监视状态下不能发送录音');
}, longPress: () async {
/* /*
//
print("onLongPress");
// //
await logic.getPermissionStatus().then((value) async { await logic.getPermissionStatus().then((value) async {
if (!value) { if (!value) {
@ -209,15 +217,8 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
} }
// state.isSenderAudioData.value = false; // state.isSenderAudioData.value = false;
print("发送接听了");
//
logic.udpAnswerAction();
}); });
*/
}, longPress: () {
/*
//
print("onLongPress");
state.listAudioData.value = <int>[]; state.listAudioData.value = <int>[];
if (state.udpStatus.value == 8) { if (state.udpStatus.value == 8) {
state.udpStatus.value = 9; state.udpStatus.value = 9;
@ -238,6 +239,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async { "images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
// //
logic.udpHangUpAction(); logic.udpHangUpAction();
CallTalk().stopPcmSound();
Get.back(); Get.back();
}), }),
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
@ -257,7 +259,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
case 9: case 9:
return "images/main/icon_lockDetail_monitoringTalkback.png"; return "images/main/icon_lockDetail_monitoringTalkback.png";
default: default:
return "images/main/icon_lockDetail_monitoringAnswerCalls.png"; return "images/main/icon_lockDetail_monitoringUnTalkback.png";
} }
} }
@ -268,7 +270,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
case 9: case 9:
return "松开发送"; return "松开发送";
default: default:
return "接听"; return "长按说话";
} }
} }
@ -377,8 +379,11 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
void _handleFailure() { void _handleFailure() {
// //
state.animationController.stop(); CallTalk().stopPcmSound();
state.realTimePicTimer.cancel(); state.realTimePicTimer.cancel();
if (state.animationController != null) {
state.animationController.stop();
}
} }
@override @override

View File

@ -155,6 +155,8 @@ class CommandUDPReciverManager {
{ {
// //
print("监视成功"); print("监视成功");
UDPTalkClass().status = 8;
eventBus.fire(GetUDPStatusMonitorUI(UDPTalkClass().status));
} }
break; break;
case 7: case 7:
@ -192,6 +194,8 @@ class CommandUDPReciverManager {
break; break;
case 30: case 30:
{ {
CallTalk().stopPcmSound();
// //
if ((data[7] & 0x3) == 1) { if ((data[7] & 0x3) == 1) {
// //
@ -200,6 +204,7 @@ class CommandUDPReciverManager {
// //
print("结束监视反馈"); print("结束监视反馈");
} }
// Toast.show(msg: "对方已结束监视"); // Toast.show(msg: "对方已结束监视");
// UDPTalkClass().status = 0; // UDPTalkClass().status = 0;
// UDPTalkClass().isBeCall = false; // UDPTalkClass().isBeCall = false;

View File

@ -62,6 +62,12 @@ class GetUDPStatusRefreshUI {
GetUDPStatusRefreshUI(this.udpStatus); GetUDPStatusRefreshUI(this.udpStatus);
} }
/// UDP接收状态然后刷新监控界面
class GetUDPStatusMonitorUI {
int udpStatus;
GetUDPStatusMonitorUI(this.udpStatus);
}
/// ///
class GetFirstFrameGoPush { class GetFirstFrameGoPush {
bool isFirstFrame; bool isFirstFrame;