Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
a0ea5285fe
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
|
import 'package:star_lock/talk/udp/udp_manage.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
@ -15,23 +16,29 @@ import '../../../../tools/eventBusEventManage.dart';
|
|||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'remoteUnlocking_state.dart';
|
import 'remoteUnlocking_state.dart';
|
||||||
|
|
||||||
class RemoteUnlockingLogic extends BaseGetXController{
|
class RemoteUnlockingLogic extends BaseGetXController {
|
||||||
RemoteUnlockingState state = RemoteUnlockingState();
|
RemoteUnlockingState state = RemoteUnlockingState();
|
||||||
|
|
||||||
void _remoteUnlockingOpenOrClose() async{
|
void remoteUnlockingOpenOrClose() async {
|
||||||
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
|
var entity = await ApiRepository.to.remoteUnlockingOpenOrClose(
|
||||||
lockId: state.lockSetInfoData.value.lockId!,
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
remoteUnlock:state.remoteEnable.value == 1 ? 0 : 1
|
remoteUnlock: state.remoteEnable.value == 1 ? 0 : 1);
|
||||||
);
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
showToast("操作成功", something: () {
|
||||||
showToast("操作成功", something: (){
|
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
|
state.remoteEnable.value = state.remoteEnable.value == 1 ? 0 : 1;
|
||||||
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock = state.remoteEnable.value;
|
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock =
|
||||||
print("state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
|
state.remoteEnable.value;
|
||||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
print(
|
||||||
|
"state.remoteEnable.value:${state.remoteEnable.value} state.getKeyInfosData.value.remoteEnable:${state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock}");
|
||||||
|
eventBus
|
||||||
|
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(5, state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock!.toString()));
|
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
|
||||||
|
5,
|
||||||
|
state.lockSetInfoData.value.lockSettingInfo!.remoteUnlock!
|
||||||
|
.toString()));
|
||||||
|
UDPManage().remoteUnlock = state.remoteEnable.value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,8 +46,9 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
if(reply is SetSupportFunctionsNoParametersReply) {
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
|
if (reply is SetSupportFunctionsNoParametersReply) {
|
||||||
_replySetSupportFunctionsWithParameters(reply);
|
_replySetSupportFunctionsWithParameters(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,32 +90,32 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
|||||||
// 设置自动落锁数据解析
|
// 设置自动落锁数据解析
|
||||||
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
|
Future<void> _replySetSupportFunctionsWithParameters(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType}数据解析成功");
|
print("${reply.commandType}数据解析成功");
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
_remoteUnlockingOpenOrClose();
|
remoteUnlockingOpenOrClose();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType}需要鉴权");
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType}用户无权限");
|
print("${reply.commandType}用户无权限");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
print("${reply.commandType}权限校验错误");
|
print("${reply.commandType}权限校验错误");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
print("${reply.commandType}失败");
|
print("${reply.commandType}失败");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -116,17 +124,18 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 设置支持功能(带参数) 远程开锁
|
// 设置支持功能(带参数) 远程开锁
|
||||||
Future<void> sendBurglarAlarm() async {
|
Future<void> sendBurglarAlarm() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -150,7 +159,7 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,5 +190,4 @@ class RemoteUnlockingLogic extends BaseGetXController{
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
_replySubscription.cancel();
|
_replySubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,8 @@ class RemoteUnlockingPage extends StatefulWidget {
|
|||||||
State<RemoteUnlockingPage> createState() => _RemoteUnlockingPageState();
|
State<RemoteUnlockingPage> createState() => _RemoteUnlockingPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAware {
|
class _RemoteUnlockingPageState extends State<RemoteUnlockingPage>
|
||||||
|
with RouteAware {
|
||||||
final logic = Get.put(RemoteUnlockingLogic());
|
final logic = Get.put(RemoteUnlockingLogic());
|
||||||
final state = Get.find<RemoteUnlockingLogic>().state;
|
final state = Get.find<RemoteUnlockingLogic>().state;
|
||||||
|
|
||||||
@ -48,17 +49,17 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Obx((){
|
Obx(() {
|
||||||
// print("state.remoteEnable:${state.remoteEnable}");
|
// print("state.remoteEnable:${state.remoteEnable}");
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${state.remoteEnable.value == 1 ?TranslationLoader.lanKeys!.opened!.tr: TranslationLoader.lanKeys!.closed!.tr}",
|
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${state.remoteEnable.value == 1 ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr}",
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(fontWeight: FontWeight.w600, fontSize: 22.sp),
|
fontWeight: FontWeight.w600, fontSize: 22.sp),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -66,14 +67,22 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
|
|||||||
height: 40.h,
|
height: 40.h,
|
||||||
),
|
),
|
||||||
Obx(() => SubmitBtn(
|
Obx(() => SubmitBtn(
|
||||||
btnName: state.remoteEnable.value == 1 ?TranslationLoader.lanKeys!.close!.tr: TranslationLoader.lanKeys!.open!.tr,
|
btnName: state.remoteEnable.value == 1
|
||||||
|
? TranslationLoader.lanKeys!.close!.tr
|
||||||
|
: TranslationLoader.lanKeys!.open!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
logic.sendBurglarAlarm();
|
//全自动锁只判断是否开启远程开锁
|
||||||
|
bool isContains =
|
||||||
|
BlueManage().connectDeviceName.contains("T9A");
|
||||||
|
if (isContains) {
|
||||||
|
logic.remoteUnlockingOpenOrClose();
|
||||||
|
} else {
|
||||||
|
logic.sendBurglarAlarm();
|
||||||
|
}
|
||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -132,5 +141,4 @@ class _RemoteUnlockingPageState extends State<RemoteUnlockingPage> with RouteAwa
|
|||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_voice_processor/flutter_voice_processor.dart';
|
import 'package:flutter_voice_processor/flutter_voice_processor.dart';
|
||||||
@ -29,7 +28,7 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
_getTVDataRefreshUIEvent =
|
_getTVDataRefreshUIEvent =
|
||||||
eventBus.on<GetTVDataRefreshUI>().listen((event) async {
|
eventBus.on<GetTVDataRefreshUI>().listen((event) async {
|
||||||
if (event.tvList.isNotEmpty) {
|
if (event.tvList.isNotEmpty) {
|
||||||
print('收到图片了啦啦啦啦啦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊');
|
// print('收到图片了啦啦啦啦啦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊');
|
||||||
// 预加载图片数据
|
// 预加载图片数据
|
||||||
Uint8List imageData = Uint8List.fromList(event.tvList);
|
Uint8List imageData = Uint8List.fromList(event.tvList);
|
||||||
// 更新状态
|
// 更新状态
|
||||||
@ -184,31 +183,13 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double _calculateVolumeLevel(List<int> frame) {
|
|
||||||
double rms = 0.0;
|
|
||||||
for (int sample in frame) {
|
|
||||||
rms += pow(sample, 2);
|
|
||||||
}
|
|
||||||
rms = sqrt(rms / frame.length);
|
|
||||||
|
|
||||||
double dbfs = 20 * log(rms / 32767.0) / log(10);
|
|
||||||
double normalizedValue = (dbfs + state.dbOffset) / state.dbOffset;
|
|
||||||
return normalizedValue.clamp(0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onFrame(List<int> frame) async {
|
Future<void> _onFrame(List<int> frame) async {
|
||||||
double volumeLevel = _calculateVolumeLevel(frame);
|
state.allFrames.add(frame); // 将帧添加到状态变量中
|
||||||
if (state.volumeHistory.value.length == state.volumeHistoryCapacity) {
|
List<int> concatenatedFrames = concatenateFrames(state.allFrames); // 连接所有帧
|
||||||
state.volumeHistory.value.removeAt(0);
|
Get.log("pcm数据:$concatenatedFrames");
|
||||||
}
|
|
||||||
state.volumeHistory.value.add(volumeLevel);
|
|
||||||
|
|
||||||
state.smoothedVolumeValue.value =
|
|
||||||
state.volumeHistory.value.reduce((a, b) => a + b) /
|
|
||||||
state.volumeHistory.value.length;
|
|
||||||
|
|
||||||
List<int> pcmBytes = listLinearToULaw(frame);
|
List<int> pcmBytes = listLinearToULaw(frame);
|
||||||
await Future.delayed(const Duration(milliseconds: 100));
|
// await Future.delayed(const Duration(milliseconds: 100));
|
||||||
sendRecordData({
|
sendRecordData({
|
||||||
"bytes": pcmBytes,
|
"bytes": pcmBytes,
|
||||||
// "udpSendDataFrameNumber": 0,
|
// "udpSendDataFrameNumber": 0,
|
||||||
@ -223,6 +204,15 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
state.errorMessage.value = error.message!;
|
state.errorMessage.value = error.message!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将所有帧连接起来
|
||||||
|
List<int> concatenateFrames(List<List<int>> frames) {
|
||||||
|
List<int> concatenated = [];
|
||||||
|
for (List<int> frame in frames) {
|
||||||
|
concatenated.addAll(frame);
|
||||||
|
}
|
||||||
|
return concatenated;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> stopProcessing() async {
|
Future<void> stopProcessing() async {
|
||||||
state.isButtonDisabled.value = true;
|
state.isButtonDisabled.value = true;
|
||||||
try {
|
try {
|
||||||
@ -319,9 +309,9 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
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("G711编码后为:$topBytes");
|
||||||
|
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
command: 150,
|
command: 150,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
|
import 'package:star_lock/talk/udp/udp_manage.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';
|
||||||
@ -207,9 +208,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
state.udpStatus.value = 9;
|
state.udpStatus.value = 9;
|
||||||
}
|
}
|
||||||
// logic.readG711Data();
|
// logic.readG711Data();
|
||||||
if (state.isProcessing.value == false) {
|
logic.startProcessing();
|
||||||
logic.startProcessing();
|
|
||||||
}
|
|
||||||
}, longPressUp: () async {
|
}, longPressUp: () async {
|
||||||
// 长按结束
|
// 长按结束
|
||||||
print("onLongPressUp");
|
print("onLongPressUp");
|
||||||
@ -236,7 +235,11 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
}),
|
}),
|
||||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
||||||
"开锁", AppColors.mainColor, () {
|
"开锁", AppColors.mainColor, () {
|
||||||
showDeletPasswordAlertDialog(context);
|
if (UDPManage().remoteUnlock == 1) {
|
||||||
|
showDeletPasswordAlertDialog(context);
|
||||||
|
} else {
|
||||||
|
logic.showToast("请在锁设置中开启远程开锁");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import '../../../../tools/storage.dart';
|
|||||||
|
|
||||||
class LockMonitoringState {
|
class LockMonitoringState {
|
||||||
var isOpenVoice = false.obs;
|
var isOpenVoice = false.obs;
|
||||||
var udpSendDataFrameNumber = 0; // 帧序号
|
int udpSendDataFrameNumber = 0; // 帧序号
|
||||||
// var isSenderAudioData = false.obs;// 是否要发送音频数据
|
// var isSenderAudioData = false.obs;// 是否要发送音频数据
|
||||||
|
|
||||||
var userMobileIP = NetworkInfo().getWifiIP();
|
var userMobileIP = NetworkInfo().getWifiIP();
|
||||||
@ -29,11 +29,12 @@ class LockMonitoringState {
|
|||||||
var isButtonDisabled = false.obs; //是否禁用按钮
|
var isButtonDisabled = false.obs; //是否禁用按钮
|
||||||
final int frameLength = 320; //音视频帧长度为320
|
final int frameLength = 320; //音视频帧长度为320
|
||||||
final int sampleRate = 8000; //音频采样率为8000
|
final int sampleRate = 8000; //音频采样率为8000
|
||||||
final int volumeHistoryCapacity = 5; //音量历史记录的容量
|
// final int volumeHistoryCapacity = 5; //音量历史记录的容量
|
||||||
final double dbOffset = 50.0; //用于音量计算的偏移量
|
// final double dbOffset = 50.0; //用于音量计算的偏移量
|
||||||
var volumeHistory = <double>[].obs; //用于存储音量历史记录的列表
|
// var volumeHistory = <double>[].obs; //用于存储音量历史记录的列表
|
||||||
var smoothedVolumeValue = 0.0.obs; //存储平滑后的音量值
|
// var smoothedVolumeValue = 0.0.obs; //存储平滑后的音量值
|
||||||
var errorMessage = ''.obs;
|
var errorMessage = ''.obs;
|
||||||
|
List<List<int>> allFrames = [];
|
||||||
|
|
||||||
GlobalKey globalKey = GlobalKey();
|
GlobalKey globalKey = GlobalKey();
|
||||||
|
|
||||||
|
|||||||
@ -109,8 +109,8 @@ class CallTalk {
|
|||||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||||
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
|
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
String formattedTime = "${now.hour}:${now.minute}:${now.second}";
|
// String formattedTime = "${now.hour}:${now.minute}:${now.second}";
|
||||||
print('$formattedTime得到了一张图片共${iframe!.bagReceive}个数据包');
|
// print('$formattedTime得到了一张图片共${iframe!.bagReceive}个数据包');
|
||||||
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
||||||
} else {
|
} else {
|
||||||
// print('接收到的包数不等于总包数');
|
// print('接收到的包数不等于总包数');
|
||||||
@ -120,7 +120,7 @@ class CallTalk {
|
|||||||
|
|
||||||
//音频相关处理
|
//音频相关处理
|
||||||
Future<void> _initializeAudioPlayer(List<int> audioData) async {
|
Future<void> _initializeAudioPlayer(List<int> audioData) async {
|
||||||
Get.log('_initializeAudioPlayer audioData:$audioData');
|
// Get.log('_initializeAudioPlayer audioData:$audioData');
|
||||||
|
|
||||||
PcmArrayInt16 fromList = PcmArrayInt16.fromList(audioData);
|
PcmArrayInt16 fromList = PcmArrayInt16.fromList(audioData);
|
||||||
// FlutterPcmSound.setFeedCallback(onFeed);
|
// FlutterPcmSound.setFeedCallback(onFeed);
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class UDPManage {
|
|||||||
String host = '';
|
String host = '';
|
||||||
int port = 0;
|
int port = 0;
|
||||||
String lockId = ''; // 锁id 通过锁id来判断是哪把锁发对讲过来
|
String lockId = ''; // 锁id 通过锁id来判断是哪把锁发对讲过来
|
||||||
|
int remoteUnlock = 0; // 是否远程开锁 1:开启 0:关闭
|
||||||
|
|
||||||
void initUdp() async {
|
void initUdp() async {
|
||||||
var listAddress = InternetAddress.lookup(host!);
|
var listAddress = InternetAddress.lookup(host!);
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class UDPTalkClass {
|
|||||||
}
|
}
|
||||||
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
playLocalAudioSecond++;
|
playLocalAudioSecond++;
|
||||||
print('还在工作么这个定时器$playLocalAudioSecond');
|
// print('还在工作么这个定时器$playLocalAudioSecond');
|
||||||
// 检查条件,如果达到60秒且未得到应答,则认为失败
|
// 检查条件,如果达到60秒且未得到应答,则认为失败
|
||||||
if (playLocalAudioSecond >= 60) {
|
if (playLocalAudioSecond >= 60) {
|
||||||
timer.cancel(); // 取消定时器
|
timer.cancel(); // 取消定时器
|
||||||
@ -179,10 +179,10 @@ class UDPTalkClass {
|
|||||||
//呼叫有响铃无应答处理
|
//呼叫有响铃无应答处理
|
||||||
void callNoAnswer(int clickIndex) {
|
void callNoAnswer(int clickIndex) {
|
||||||
if (isEndCall == true) {
|
if (isEndCall == true) {
|
||||||
print('已经结束对讲2');
|
// print('已经结束对讲2');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
print('$clickIndex****无应答处理');
|
// print('$clickIndex****无应答处理');
|
||||||
stopLocalAudio();
|
stopLocalAudio();
|
||||||
status = 0;
|
status = 0;
|
||||||
isBeCall = false;
|
isBeCall = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user