2024-08-21 18:31:19 +08:00
|
|
|
|
|
2024-01-03 15:24:42 +08:00
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter_voice_processor/flutter_voice_processor.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import 'package:network_info_plus/network_info_plus.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../tools/storage.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class RealTimePictureState {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
|
|
|
|
|
|
RealTimePictureState() {
|
|
|
|
|
|
getLockName.value = Get.arguments['lockName'].toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
RxBool isOpenVoice = false.obs;
|
|
|
|
|
|
int udpSendDataFrameNumber = 0; // 帧序号
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// var isSenderAudioData = false.obs;// 是否要发送音频数据
|
|
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Future<String?> userMobileIP = NetworkInfo().getWifiIP();
|
|
|
|
|
|
Future<String?> userUid = Storage.getUid();
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
RxInt udpStatus =
|
2024-01-03 15:24:42 +08:00
|
|
|
|
0.obs; //0:初始状态 1:等待监视 2: 3:监视中 4:呼叫成功 5:主角通话中 6:被叫通话 8:被叫通话中 9:长按说话
|
2024-08-21 18:31:19 +08:00
|
|
|
|
TextEditingController passwordTF = TextEditingController();
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Rx<Uint8List> listData = Uint8List(0).obs; //得到的视频流字节数据
|
|
|
|
|
|
RxList<int> listAudioData = <int>[].obs; //得到的音频流字节数据
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
|
|
|
|
|
late final VoiceProcessor? voiceProcessor;
|
|
|
|
|
|
|
2024-01-05 09:26:12 +08:00
|
|
|
|
late Timer oneMinuteTimeTimer =
|
|
|
|
|
|
Timer(const Duration(seconds: 1), () {}); // 定时器超过60秒关闭当前界面
|
2024-08-21 18:31:19 +08:00
|
|
|
|
RxInt oneMinuteTime = 0.obs; // 定时器秒数
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
RxString getLockName = ''.obs; //lockName
|
2024-01-05 09:26:12 +08:00
|
|
|
|
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
|
|
|
|
|
late Timer answerTimer;
|
|
|
|
|
|
late Timer hangUpTimer;
|
|
|
|
|
|
late Timer openDoorTimer;
|
|
|
|
|
|
late AnimationController animationController;
|
2024-01-05 09:26:12 +08:00
|
|
|
|
|
2024-01-24 18:51:18 +08:00
|
|
|
|
late Timer autoBackTimer =
|
|
|
|
|
|
Timer(const Duration(seconds: 1), () {}); //发送30秒监视后自动返回
|
2024-01-08 11:28:22 +08:00
|
|
|
|
late Timer realTimePicTimer =
|
|
|
|
|
|
Timer(const Duration(seconds: 1), () {}); //监视命令定时器
|
2024-08-21 18:31:19 +08:00
|
|
|
|
RxInt elapsedSeconds = 0.obs;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}
|