Merge branch 'talk_flutter' of gitee.com:starlock-cn/app-starlock into talk_flutter
# Conflicts: # star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart # star_lock/lib/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart # star_lock/lib/talk/udp/udp_help.dart # star_lock/lib/talk/udp/udp_talkClass.dart # star_lock/lib/tools/eventBusEventManage.dart
This commit is contained in:
commit
5f9e061ee3
@ -27,6 +27,10 @@ PODS:
|
||||
- AMapFoundation (1.8.2)
|
||||
- AMapLocation (2.10.0):
|
||||
- AMapFoundation (>= 1.8.0)
|
||||
- audio_session (0.0.1):
|
||||
- Flutter
|
||||
- audioplayers_darwin (0.0.1):
|
||||
- Flutter
|
||||
- auto_orientation (0.0.1):
|
||||
- Flutter
|
||||
- camera_avfoundation (0.0.1):
|
||||
@ -37,12 +41,18 @@ PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_native_contact_picker (0.0.1):
|
||||
- Flutter
|
||||
- flutter_sound (9.2.13):
|
||||
- Flutter
|
||||
- flutter_sound_core (= 9.2.13)
|
||||
- flutter_sound_core (9.2.13)
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- g711_flutter (0.0.1):
|
||||
- Flutter
|
||||
- google_maps_flutter_ios (0.0.1):
|
||||
- Flutter
|
||||
- GoogleMaps (< 8.0)
|
||||
@ -51,8 +61,12 @@ PODS:
|
||||
- GoogleMaps/Base (5.2.0)
|
||||
- GoogleMaps/Maps (5.2.0):
|
||||
- GoogleMaps/Base
|
||||
- image_gallery_saver (2.0.2):
|
||||
- Flutter
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- just_audio (0.0.1):
|
||||
- Flutter
|
||||
- network_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
@ -62,7 +76,7 @@ PODS:
|
||||
- FlutterMacOS
|
||||
- permission_handler_apple (9.1.1):
|
||||
- Flutter
|
||||
- Protobuf (3.25.1)
|
||||
- Protobuf (3.25.0)
|
||||
- reactive_ble_mobile (0.0.1):
|
||||
- Flutter
|
||||
- Protobuf (~> 3.5)
|
||||
@ -88,14 +102,20 @@ DEPENDENCIES:
|
||||
- aliyun_push (from `.symlinks/plugins/aliyun_push/ios`)
|
||||
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
|
||||
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
|
||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||
- flutter_sound (from `.symlinks/plugins/flutter_sound/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- g711_flutter (from `.symlinks/plugins/g711_flutter/ios`)
|
||||
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
||||
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- just_audio (from `.symlinks/plugins/just_audio/ios`)
|
||||
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
@ -119,6 +139,7 @@ SPEC REPOS:
|
||||
- AMap3DMap
|
||||
- AMapFoundation
|
||||
- AMapLocation
|
||||
- flutter_sound_core
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
- Protobuf
|
||||
@ -134,6 +155,10 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/amap_flutter_location/ios"
|
||||
amap_flutter_map:
|
||||
:path: ".symlinks/plugins/amap_flutter_map/ios"
|
||||
audio_session:
|
||||
:path: ".symlinks/plugins/audio_session/ios"
|
||||
audioplayers_darwin:
|
||||
:path: ".symlinks/plugins/audioplayers_darwin/ios"
|
||||
auto_orientation:
|
||||
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||
camera_avfoundation:
|
||||
@ -144,12 +169,20 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter
|
||||
flutter_native_contact_picker:
|
||||
:path: ".symlinks/plugins/flutter_native_contact_picker/ios"
|
||||
flutter_sound:
|
||||
:path: ".symlinks/plugins/flutter_sound/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
g711_flutter:
|
||||
:path: ".symlinks/plugins/g711_flutter/ios"
|
||||
google_maps_flutter_ios:
|
||||
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
||||
image_gallery_saver:
|
||||
:path: ".symlinks/plugins/image_gallery_saver/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
just_audio:
|
||||
:path: ".symlinks/plugins/just_audio/ios"
|
||||
network_info_plus:
|
||||
:path: ".symlinks/plugins/network_info_plus/ios"
|
||||
package_info_plus:
|
||||
@ -184,31 +217,38 @@ SPEC CHECKSUMS:
|
||||
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
|
||||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
|
||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
|
||||
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
|
||||
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
g711_flutter: 8f2769052d2cf3549f83d11e1c42d81d94441123
|
||||
google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
|
||||
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
|
||||
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
|
||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
||||
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
|
||||
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
|
||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||
Protobuf: d94761c33f1239c0a43a0817ca1a5f7f7c900241
|
||||
Protobuf: 6a4183ec1d51649eb2be7b86ccc286e5c539219c
|
||||
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
||||
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
|
||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||
SwiftProtobuf: 69f02cd54fb03201c5e6bf8b76f687c5ef7541a3
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
||||
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
|
||||
PODFILE CHECKSUM: adf6d8caf5faa9ea4ee2a2ea37f5aea37a6520d7
|
||||
|
||||
COCOAPODS: 1.14.3
|
||||
COCOAPODS: 1.12.1
|
||||
|
||||
@ -666,7 +666,7 @@
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1300;
|
||||
LastUpgradeCheck = 1430;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1430"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/eventBusEventManage.dart';
|
||||
import 'lockMonitoring_state.dart';
|
||||
@ -12,8 +13,14 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
StreamSubscription? _getTVDataRefreshUIEvent;
|
||||
void _getTVDataRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getTVDataRefreshUIEvent = eventBus.on<GetTVDataRefreshUI>().listen((event) {
|
||||
state.listData.value = event.tvList;
|
||||
_getTVDataRefreshUIEvent =
|
||||
eventBus.on<GetTVDataRefreshUI>().listen((event) {
|
||||
if (event.tvList.isNotEmpty) {
|
||||
// 预加载图片数据
|
||||
Uint8List imageData = Uint8List.fromList(event.tvList);
|
||||
// 更新状态
|
||||
state.listData.value = imageData;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -40,7 +47,6 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -50,5 +56,4 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
_getTVDataRefreshUIEvent!.cancel();
|
||||
_getUDPStatusRefreshUIEvent!.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:network_info_plus/network_info_plus.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../talk/udp/udp_manage.dart';
|
||||
import '../../../../talk/udp/udp_senderManage.dart';
|
||||
@ -24,68 +24,77 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
final logic = Get.put(LockMonitoringLogic());
|
||||
final state = Get.find<LockMonitoringLogic>().state;
|
||||
|
||||
late FlutterSoundRecorder recorder;
|
||||
late FlutterSoundPlayer player;
|
||||
late String filePath;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_initRecorder();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
// color: Colors.transparent,
|
||||
child: Stack(
|
||||
// alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
// state.listData.value.isEmpty ? Image.asset("images/icon_test20231113.png", width: 1.sw, height: 1.sh, fit: BoxFit.cover) :
|
||||
Obx(() =>
|
||||
state.listData.value.isEmpty
|
||||
? Container(color: Colors.red)
|
||||
:Image.memory(
|
||||
Uint8List.fromList(state.listData.value),
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
)),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
child: Row(children: [
|
||||
SizedBox(width: 30.w),
|
||||
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"),
|
||||
),
|
||||
),
|
||||
children: [
|
||||
Obx(() => state.listData.value.isEmpty
|
||||
? Container(color: Colors.transparent)
|
||||
: Image.memory(
|
||||
state.listData.value,
|
||||
// key: ValueKey<int>(state.listData.value.hashCode),
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
)),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
child: Row(children: [
|
||||
SizedBox(width: 30.w),
|
||||
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),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -148,10 +157,9 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
}
|
||||
|
||||
Widget bottomBottomBtnWidget() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Obx(() => bottomBtnItemWidget(getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
||||
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||
Obx(() => bottomBtnItemWidget(
|
||||
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
||||
var userMobileIP = await NetworkInfo().getWifiIP();
|
||||
var userMobile = await Storage.getMobile();
|
||||
|
||||
@ -166,29 +174,30 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
userMobileIP: userMobileIP,
|
||||
endData: []);
|
||||
})),
|
||||
bottomBtnItemWidget("images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
|
||||
var userMobileIP = await NetworkInfo().getWifiIP();
|
||||
var userMobile = await Storage.getMobile();
|
||||
|
||||
// 挂断
|
||||
UDPSenderManage.sendMainProtocol(
|
||||
command: 150,
|
||||
commandTypeIsCalling: 1,
|
||||
subCommand: 30,
|
||||
lockID: UDPManage().lockId,
|
||||
lockIP: UDPManage().host,
|
||||
userMobile: userMobile,
|
||||
userMobileIP: userMobileIP,
|
||||
endData: []);
|
||||
}),
|
||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", "开锁", AppColors.mainColor, () {
|
||||
showDeletPasswordAlertDialog(context);
|
||||
})
|
||||
bottomBtnItemWidget(
|
||||
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
|
||||
var userMobileIP = await NetworkInfo().getWifiIP();
|
||||
var userMobile = await Storage.getMobile();
|
||||
|
||||
// 挂断
|
||||
UDPSenderManage.sendMainProtocol(
|
||||
command: 150,
|
||||
commandTypeIsCalling: 1,
|
||||
subCommand: 30,
|
||||
lockID: UDPManage().lockId,
|
||||
lockIP: UDPManage().host,
|
||||
userMobile: userMobile,
|
||||
userMobileIP: userMobileIP,
|
||||
endData: []);
|
||||
}),
|
||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
||||
"开锁", AppColors.mainColor, () {
|
||||
showDeletPasswordAlertDialog(context);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
String getAnswerBtnImg(){
|
||||
String getAnswerBtnImg() {
|
||||
switch (state.udpStatus.value) {
|
||||
case 8:
|
||||
{
|
||||
@ -205,7 +214,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
}
|
||||
}
|
||||
|
||||
String getAnswerBtnName(){
|
||||
String getAnswerBtnName() {
|
||||
switch (state.udpStatus.value) {
|
||||
case 8:
|
||||
{
|
||||
@ -227,15 +236,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
var wh = 80.w;
|
||||
return GestureDetector(
|
||||
onTap: onClick,
|
||||
onLongPress: (){
|
||||
onLongPress: () {
|
||||
print("onLongPress");
|
||||
if(state.udpStatus.value == 8){
|
||||
if (state.udpStatus.value == 8) {
|
||||
state.udpStatus.value = 9;
|
||||
}
|
||||
},
|
||||
onLongPressUp: () {
|
||||
print("onLongPressUp");
|
||||
if(state.udpStatus.value == 9){
|
||||
if (state.udpStatus.value == 9) {
|
||||
state.udpStatus.value = 8;
|
||||
}
|
||||
},
|
||||
@ -265,7 +274,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
|
||||
void showDeletPasswordAlertDialog(BuildContext context) {
|
||||
showDialog(
|
||||
barrierDismissible:false,
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
@ -301,4 +310,37 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//录音处理
|
||||
_initRecorder() {
|
||||
recorder = FlutterSoundRecorder();
|
||||
}
|
||||
|
||||
//开始录音
|
||||
_startRecording() async {
|
||||
filePath = 'your_output_file.wav';
|
||||
await recorder.startRecorder(
|
||||
toFile: filePath,
|
||||
codec: Codec.pcm16WAV,
|
||||
);
|
||||
}
|
||||
|
||||
//停止录音
|
||||
_stopRecording() async {
|
||||
await recorder.stopRecorder();
|
||||
}
|
||||
|
||||
//播放录音
|
||||
_playRecording() async {
|
||||
player = FlutterSoundPlayer();
|
||||
await player.startPlayer(
|
||||
fromURI: filePath,
|
||||
codec: Codec.pcm16WAV,
|
||||
);
|
||||
}
|
||||
|
||||
//停止播放
|
||||
_stopPlaying() async {
|
||||
await player.stopPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:flutter_sound/flutter_sound.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
// import 'package:just_audio/just_audio.dart';
|
||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||
import 'package:star_lock/talk/call/g711Decoder.dart';
|
||||
import 'package:star_lock/talk/call/iFrameInfo.dart';
|
||||
@ -25,8 +24,8 @@ class CallTalk {
|
||||
int status = 0; // 假设有这个成员变量
|
||||
IframeInfo? iframe; // 假设有这个成员变量
|
||||
var growableList;
|
||||
LockMonitoringPage callOut = const LockMonitoringPage();
|
||||
FlutterSoundPlayer _audioPlayer = FlutterSoundPlayer();
|
||||
bool getFirstFrame = false; //是否得到了第一帧
|
||||
final FlutterSoundPlayer _audioPlayer = FlutterSoundPlayer();
|
||||
|
||||
CallTalk._init() {
|
||||
iframe = IframeInfo();
|
||||
@ -53,7 +52,7 @@ class CallTalk {
|
||||
|
||||
// 音频数据
|
||||
if (bb[61] == 1) {
|
||||
// 如果是音频数据且状态符合条件
|
||||
print('dinglingling音频数据来啦啦啦啦啦啦啦啦啦');
|
||||
// 用你的711音频数据替换这里的Uint8List
|
||||
Uint8List rawData = G711Decoder().decodeG711uLaw(bb);
|
||||
_playRawData(rawData);
|
||||
@ -91,8 +90,6 @@ class CallTalk {
|
||||
// 这里判断是否是同一帧,如果不是同一帧就重新创建一个 IframeInfo
|
||||
if (getIframeIndex != iframe!.iframeIndex) {
|
||||
iframe = IframeInfo();
|
||||
// print('11111111change getIframeIndex:$getIframeIndex ');
|
||||
// print('11111111change iframe.iframeIndex: ${iframe!.iframeIndex}');
|
||||
iframe!.iframeIndex = getIframeIndex;
|
||||
iframe!.bagNum = getBagNum;
|
||||
// iframe!.cur_len = alen;
|
||||
@ -101,56 +98,32 @@ class CallTalk {
|
||||
}
|
||||
|
||||
iframe!.bagReceive++;
|
||||
// int start = bagLen * (getBagIndex - FIRSTINDEX);
|
||||
// int end = start + blen;
|
||||
|
||||
// 确保 iframe!.bb 不为 null,并且足够长
|
||||
// if (iframe.bb == null || iframe.bb!.length < end) {
|
||||
// iframe.bb = Uint8List(end);
|
||||
// }
|
||||
|
||||
// print('22222222change getIframeIndex:$getIframeIndex ');
|
||||
|
||||
// 如果是同一帧就添加起来
|
||||
if (getIframeIndex == iframe!.iframeIndex) {
|
||||
// print('33333333change iframe.iframeIndex: ${iframe!.iframeIndex}');
|
||||
var getList = bb.sublist(77, bb.length);
|
||||
print('getList:${getList}');
|
||||
growableList.addAll(getList);
|
||||
// print('growableList: $growableList');
|
||||
}
|
||||
|
||||
// copyBytes(iframe!.bb!, start, bb, POS_data, blen);
|
||||
// 打印输出看看字节数组的内容
|
||||
|
||||
print(
|
||||
'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
||||
|
||||
// 如果收到的包数等于总包数,说明这一帧数据已经接收完毕
|
||||
if (iframe!.bagNum == iframe!.bagReceive) {
|
||||
// List<int> data = iframe!.bb!.sublist(0, iframe!.cur_len);
|
||||
print('播放第${iframe!.iframeIndex}帧 一帧图片的Data: $growableList');
|
||||
String hexString =
|
||||
uint8ListToHexString(Uint8List.fromList(growableList));
|
||||
// print('播放第${iframe!.iframeIndex}帧 hexStringLength:${hexString.length} 一帧图片的hexStringData: $hexString'); // 输出: 0a141e28
|
||||
print(
|
||||
'播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||
|
||||
//判断第一帧是否接收到
|
||||
if (iframe!.iframeIndex == 0) {
|
||||
getFirstFrame = true;
|
||||
eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
|
||||
}
|
||||
|
||||
// if (iframe!.iframeIndex == 1) {
|
||||
print('下面就是你要的');
|
||||
printByteArray('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ',
|
||||
Uint8List.fromList(growableList));
|
||||
eventBus.fire(GetTVDataRefreshUI(growableList));
|
||||
// }
|
||||
// eventBus.fire(GetTVDataRefreshUI(growableList));
|
||||
}
|
||||
|
||||
// Get.toNamed(Routers.lockMonitoringPage, arguments: {
|
||||
// "lockId": "111"
|
||||
// });
|
||||
// 打印拷贝后的目标数据
|
||||
// print(iframe.bb);
|
||||
}
|
||||
}
|
||||
|
||||
//视频相关处理
|
||||
void printByteArray(String printTitle, Uint8List byteArray) {
|
||||
final int chunkSize = byteArray.length; // 每行显示的字节数
|
||||
int length = byteArray.length;
|
||||
@ -165,29 +138,7 @@ class CallTalk {
|
||||
}
|
||||
}
|
||||
|
||||
String uint8ListToHexString(Uint8List uint8List) {
|
||||
return hex.encode(uint8List);
|
||||
}
|
||||
|
||||
int getShortFromByte(Uint8List bb, int pos) {
|
||||
ByteData byteData = ByteData.sublistView(bb, pos, pos + 2);
|
||||
return byteData.getInt16(0, Endian.little);
|
||||
}
|
||||
|
||||
void copyBytes(Uint8List destination, int destStart, Uint8List source,
|
||||
int sourceStart, int length) {
|
||||
if (destination.length < destStart + length ||
|
||||
source.length < sourceStart + length) {
|
||||
// 处理越界的情况,这里你可以抛出异常或者进行其他处理
|
||||
print('Error: Index out of range');
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
destination[destStart + i] = source[sourceStart + i];
|
||||
}
|
||||
}
|
||||
|
||||
//音频相关处理
|
||||
Future<void> _initializeAudioPlayer() async {
|
||||
await _audioPlayer.openPlayer();
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
@ -10,34 +8,36 @@ import '../../tools/storage.dart';
|
||||
import 'udp_manage.dart';
|
||||
import 'udp_senderManage.dart';
|
||||
|
||||
class UdpHelp{
|
||||
|
||||
class UdpHelp {
|
||||
Timer? timer;
|
||||
|
||||
openUDP() async {
|
||||
// 从服务器获取ip跟端口
|
||||
var entity = await ApiRepository.to.getWifiLockServiceIpAndPort();
|
||||
if(entity.errorCode! == 0){
|
||||
if (entity.errorCode! == 0) {
|
||||
UDPManage();
|
||||
// UDPManage().initUdp();
|
||||
UDPManage().port = int.parse(entity.data!.serviceList![0].port!);
|
||||
|
||||
var serversList = <int>[];
|
||||
for(int i = 0; i<entity.data!.serviceList!.length; i++){
|
||||
for (int i = 0; i < entity.data!.serviceList!.length; i++) {
|
||||
var item = entity.data!.serviceList![i];
|
||||
if(item.serviceIp!.contains("192")){
|
||||
if (item.serviceIp!.contains("192")) {
|
||||
UDPManage().host = entity.data!.serviceList![0].serviceIp!;
|
||||
var itemList = item.serviceIp!.split(".");
|
||||
for (var element in itemList) {
|
||||
serversList.add(int.parse(element));
|
||||
}
|
||||
}else{
|
||||
List<InternetAddress> addresses = await InternetAddress.lookup(item.serviceIp!);
|
||||
} else {
|
||||
List<InternetAddress> addresses =
|
||||
await InternetAddress.lookup(item.serviceIp!);
|
||||
UDPManage().host = addresses.first.address;
|
||||
var itemList = addresses.first.address.split(".");
|
||||
for (var element in itemList) {
|
||||
serversList.add(int.parse(element));
|
||||
}
|
||||
print('Resolved google.com to address: ${addresses.first.address} serversList:$serversList');
|
||||
print(
|
||||
'Resolved google.com to address: ${addresses.first.address} serversList:$serversList');
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ class UdpHelp{
|
||||
// }
|
||||
// }
|
||||
|
||||
dispose(){
|
||||
dispose() {
|
||||
timer!.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +1,30 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:fast_gbk/fast_gbk.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||
import '../../tools/storage.dart';
|
||||
import 'udp_manage.dart';
|
||||
|
||||
class UDPTalkClass{
|
||||
class UDPTalkClass {
|
||||
static UDPTalkClass? _manager;
|
||||
static UDPTalkClass _share(){
|
||||
static UDPTalkClass _share() {
|
||||
_manager ??= UDPTalkClass._init();
|
||||
return _manager!;
|
||||
}
|
||||
|
||||
factory UDPTalkClass() => _share();
|
||||
UDPTalkClass get manager => _share();
|
||||
|
||||
UDPTalkClass._init();
|
||||
|
||||
var status = 0; //0:初始状态 1:等待监视 2: 3:监视中 4:呼叫成功 5:主角通话中 6:被叫通话 8:被叫通话中
|
||||
var remoteEquid;// 手机号
|
||||
var remoteEquid; // 手机号
|
||||
late Timer timer;
|
||||
// 该字段是为了判断是否跳转到接听界面 挂断或者退出接听界面要记得变更状态
|
||||
var isBeCall = false;
|
||||
@ -35,7 +36,7 @@ class UDPTalkClass{
|
||||
// return;
|
||||
// }
|
||||
|
||||
if(status == 0){
|
||||
if (status == 0) {
|
||||
// 空闲
|
||||
// 响铃
|
||||
// [[Pub getApp] ring];
|
||||
@ -59,7 +60,7 @@ class UDPTalkClass{
|
||||
// fullscreenDialog: true
|
||||
// ));
|
||||
|
||||
if(UDPTalkClass().isBeCall == false){
|
||||
if (UDPTalkClass().isBeCall == false) {
|
||||
UDPTalkClass().isBeCall = true;
|
||||
// 保持连接
|
||||
timer = Timer.periodic(1.seconds, (timer) {
|
||||
@ -67,23 +68,38 @@ class UDPTalkClass{
|
||||
data[8] = 9;
|
||||
UDPManage().sendData(data);
|
||||
});
|
||||
|
||||
// _getFirstFrameGoPushAction();
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
// 在这里写要延迟执行的代码
|
||||
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
||||
});
|
||||
}
|
||||
|
||||
Get.toNamed(Routers.lockMonitoringPage, arguments: {
|
||||
"lockId": "111"
|
||||
});
|
||||
playLocalAudio();
|
||||
}else{
|
||||
} else {
|
||||
// 忙
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void _getFirstFrameGoPushAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
StreamSubscription _GetFirstFrameGoPushEvent =
|
||||
eventBus.on<GetFirstFrameGoPush>().listen((event) {
|
||||
if (event.isFirstFrame == true) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
// 在这里写要延迟执行的代码
|
||||
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 判断是否是call的本人
|
||||
Future<bool> isCallMe(List<int>? data) async {
|
||||
final loginData = await Storage.getLoginData();
|
||||
print("getEquidFrombb(data, 1000):${getEquidFrombb(data, 12)}");
|
||||
if(loginData!.mobile == getEquidFrombb(data, 12)){
|
||||
if (loginData!.mobile == getEquidFrombb(data, 12)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -93,17 +109,23 @@ class UDPTalkClass{
|
||||
var equid = "";
|
||||
int equlen = 8;
|
||||
|
||||
if (bb![pos] == 77) { //M
|
||||
if (bb![pos] == 77) {
|
||||
//M
|
||||
equlen = 8;
|
||||
} else if (bb[pos] == 87) { //W
|
||||
} else if (bb[pos] == 87) {
|
||||
//W
|
||||
equlen = 5;
|
||||
} else if (bb[pos] == 72) { //H
|
||||
} else if (bb[pos] == 72) {
|
||||
//H
|
||||
equlen = 12;
|
||||
} else if (bb[pos] == 83) { //S
|
||||
} else if (bb[pos] == 83) {
|
||||
//S
|
||||
equlen = 12;
|
||||
} else if (bb[pos] == 0x50) { //P
|
||||
} else if (bb[pos] == 0x50) {
|
||||
//P
|
||||
equlen = 12;
|
||||
} else if (bb[pos] == 0x54) { //T
|
||||
} else if (bb[pos] == 0x54) {
|
||||
//T
|
||||
equlen = 16;
|
||||
} else {
|
||||
equlen = 12;
|
||||
@ -114,7 +136,6 @@ class UDPTalkClass{
|
||||
return equid;
|
||||
}
|
||||
|
||||
|
||||
//播放本地音频
|
||||
void playLocalAudio() async {
|
||||
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
||||
@ -126,4 +147,4 @@ class UDPTalkClass{
|
||||
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
||||
await audioPlayer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,64 +6,70 @@ import '../main/lockDetail/lcokSet/lockSet/lockSetInfo_entity.dart';
|
||||
EventBus eventBus = EventBus();
|
||||
|
||||
/// 刷新锁列表数据
|
||||
class RefreshLockListInfoDataEvent{
|
||||
class RefreshLockListInfoDataEvent {
|
||||
RefreshLockListInfoDataEvent();
|
||||
}
|
||||
|
||||
/// 刷新考勤员工列表
|
||||
class RefreshCheckInStaffListDataEvent{
|
||||
class RefreshCheckInStaffListDataEvent {
|
||||
RefreshCheckInStaffListDataEvent();
|
||||
}
|
||||
|
||||
/// 传递当前锁信息
|
||||
class PassCurrentLockInformationEvent{
|
||||
class PassCurrentLockInformationEvent {
|
||||
LockSetInfoData lockSetInfoData;
|
||||
PassCurrentLockInformationEvent(this.lockSetInfoData);
|
||||
}
|
||||
|
||||
/// 卡、密码、指纹修改之后刷新列表
|
||||
class OtherTypeRefreshListEvent{
|
||||
class OtherTypeRefreshListEvent {
|
||||
OtherTypeRefreshListEvent();
|
||||
}
|
||||
|
||||
/// 考情添加员工卡、指纹之后回调卡、指纹number
|
||||
class ChickInAddStaffCardAndFingerprintBlockNumberEvent{
|
||||
class ChickInAddStaffCardAndFingerprintBlockNumberEvent {
|
||||
String number;
|
||||
ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number);
|
||||
}
|
||||
|
||||
/// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据
|
||||
class ScanAllDeviceFindCurrentDeviceConnectedEvent{
|
||||
class ScanAllDeviceFindCurrentDeviceConnectedEvent {
|
||||
String uuid;
|
||||
ScanAllDeviceFindCurrentDeviceConnectedEvent(this.uuid);
|
||||
}
|
||||
|
||||
/// 多语言 切换之后传值到上一级界面
|
||||
class ChangeLanguageBlockLastLanguageEvent{
|
||||
class ChangeLanguageBlockLastLanguageEvent {
|
||||
String languageTitle;
|
||||
ChangeLanguageBlockLastLanguageEvent(this.languageTitle);
|
||||
}
|
||||
|
||||
/// 锁分组添加或者删除锁之后刷新首页数据
|
||||
class LockGroupEditGroupLockRefreshEvent{
|
||||
class LockGroupEditGroupLockRefreshEvent {
|
||||
LockGroupEditGroupLockRefreshEvent();
|
||||
}
|
||||
|
||||
/// 锁设置里面开启关闭刷新锁详情
|
||||
class LockSetChangeSetRefreshLockDetailWithType{
|
||||
int type;// 0 考勤 1开锁时是否需联网
|
||||
class LockSetChangeSetRefreshLockDetailWithType {
|
||||
int type; // 0 考勤 1开锁时是否需联网
|
||||
int setResult;
|
||||
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
|
||||
}
|
||||
|
||||
/// 获取到视频流数据然后刷新界面
|
||||
class GetTVDataRefreshUI{
|
||||
class GetTVDataRefreshUI {
|
||||
List<int> tvList;
|
||||
GetTVDataRefreshUI(this.tvList);
|
||||
}
|
||||
|
||||
/// 获取到UDP接收状态然后刷新界面
|
||||
class GetUDPStatusRefreshUI{
|
||||
class GetUDPStatusRefreshUI {
|
||||
int udpStatus;
|
||||
GetUDPStatusRefreshUI(this.udpStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取到第一帧图片数据后跳转
|
||||
class GetFirstFrameGoPush {
|
||||
bool isFirstFrame;
|
||||
GetFirstFrameGoPush(this.isFirstFrame);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user