Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/lib/network/api_provider.dart
This commit is contained in:
commit
186f92cbe1
45
star_lock/VERSION.md
Normal file
45
star_lock/VERSION.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# 项目版本管理
|
||||||
|
在项目进行过程中,我们遇到过以下场景:
|
||||||
|
1. 对用户说“你用的包我们没有了,代码已经向前发展了,我们无法提供相同的安装包/另一个平台的该版本安装包”
|
||||||
|
2. 对用户说“功能有问题?我也不清楚你是不是版本太老了,要不你直接升级到最新版吧“
|
||||||
|
3. ”什么?X.X.X版本有XX问题?我不知道这个问题好像已经修复了啊,要不你升级最新版试试“
|
||||||
|
4. 用户并不是总能升级到最新版、例如新版本引入了某个功能带来新的问题,我们需要在特定版本修复特定问题。
|
||||||
|
5. 例如对于应用商店,当我提交审核1.1.1版本,那么我将会根据反馈修复问题,而此时主分支已经进化到1.2.0版本引入了更多的功能,我现在并不像将1.2的新增功能提交测试,我需要继续在1.0版本修复一些问题。(别想着这是应用商店,用户也是如此,例如你交付给某个客户进行测试,双方都不会想在测试-修复的循环中不断引入新功能【新问题】)
|
||||||
|
|
||||||
|
为了避免以上情况,我们必须对项目进行规范的版本管理。
|
||||||
|
具体来说,任何和内部协同,外部交付的构建,必须遵循此文档的规范。
|
||||||
|
|
||||||
|
## 分支管理
|
||||||
|
目前没有进行工作流分支管理,所有的开发都在`master`分支上进行。
|
||||||
|
|
||||||
|
在构建时需要拉出新分支来区分构建的版本的代码。具体来讲,当你现在需要构建,你需要进行如下操作:
|
||||||
|
1. 按规则修改pubspec.yaml中的版本号,并添加对应的版本说明记录
|
||||||
|
2. 在master分支,提交并push代码
|
||||||
|
3. 在master拉出新分支,例如`build-1.0.18+2024032002`,其中的`1.0.18+2024032002`是你刚新增的版本
|
||||||
|
4. 在新分支构建
|
||||||
|
5. 如果构建过程需要修改代码,提交在build-xx分支而不是master分支
|
||||||
|
6. 构建完成后,如有必要可以合并到master分支,保留build-xx分支已备后续可以再次构建此版本的其他构建平台或构建方式
|
||||||
|
7. 构建完成后,记得切换回master分支
|
||||||
|
|
||||||
|
## 版本号
|
||||||
|
项目版本号遵循flutter规范,即`major.minor.patch+build`,例如`1.0.0+1`。
|
||||||
|
其中的构建号必须在每一次构建都进行递增,具体的规则是年月日二位自增,例如`2024032701`。
|
||||||
|
|
||||||
|
前面的版本号是由项目的业务需求决定的,例如`1.0.0`,`1.0.1`,`1.1.0`等。
|
||||||
|
|
||||||
|
具体来说,`major`是大版本号,`minor`是小版本号,`patch`是修订号
|
||||||
|
|
||||||
|
其中大版本号必须是完全不兼容的更新才可以使用,脱胎换骨,浴火重生级别的。
|
||||||
|
|
||||||
|
小版本号是功能差异,不一定完全兼容,用户可能需要升级否则无法使用某个功能,
|
||||||
|
例如增加了一个新功能,或者修改了一个已有的功能。
|
||||||
|
|
||||||
|
修订号是修复bug,或者优化性能,或者修改了一些细节,但是不影响用户使用的。
|
||||||
|
|
||||||
|
## 构建物文件名
|
||||||
|
|
||||||
|
无论分发到什么渠道,通过自行发布页面或者通过即时通讯工具传递安装包,都必须使用规范的文件名以避免混淆。
|
||||||
|
|
||||||
|
文件名的格式为:`app-sky-64-release-VersionCode.apk`
|
||||||
|
|
||||||
|
其中`sky`是渠道名,`64`是CPU架构,`release`是构建类型,`VersionCode`是版本号。
|
||||||
@ -143,7 +143,12 @@ android {
|
|||||||
// 但是禁用NDK配置,又无法使用flutter run 命令了,因为编译完成它按照名称匹配找不到.apk包
|
// 但是禁用NDK配置,又无法使用flutter run 命令了,因为编译完成它按照名称匹配找不到.apk包
|
||||||
ndk {
|
ndk {
|
||||||
//设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so)
|
//设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so)
|
||||||
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
|
// abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
|
||||||
|
|
||||||
|
|
||||||
|
// 参考魅族平台的公告,得知在2023年1月商店就可以只需要64位应用即可
|
||||||
|
// 这说明32位是很老很老的平台,我们的flutter或者说我们的项目本来就兼容不了老平台,架构兼容也没必要
|
||||||
|
abiFilters "arm64-v8a"
|
||||||
}
|
}
|
||||||
|
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
@ -161,10 +166,11 @@ android {
|
|||||||
abi {
|
abi {
|
||||||
enable true
|
enable true
|
||||||
reset()
|
reset()
|
||||||
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
|
// 参考魅族平台的公告,得知在2023年1月商店就可以只需要64位应用即可
|
||||||
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
|
// 这说明32位是很老很老的平台,我们的flutter或者说我们的项目本来就兼容不了老平台,架构兼容也没必要
|
||||||
include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
|
// include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
|
||||||
universalApk true
|
// include "arm64-v8a"
|
||||||
|
universalApk false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
<!--允许麦克风权限,用于录音发送-->
|
<!--允许麦克风权限,用于录音发送-->
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
@ -37,6 +38,9 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||||
|
android:value="1"/> <!-- 将您的通知渠道ID替换为您的实际ID -->
|
||||||
<!-- 配置定位Service -->
|
<!-- 配置定位Service -->
|
||||||
<service android:name="com.amap.api.location.APSService"/>
|
<service android:name="com.amap.api.location.APSService"/>
|
||||||
<activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
<activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||||
|
|||||||
BIN
star_lock/android/app/src/main/res/drawable/app_icon.png
Normal file
BIN
star_lock/android/app/src/main/res/drawable/app_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@ -26,16 +26,16 @@ class XSConstantMacro {
|
|||||||
// "110412" 已过期
|
// "110412" 已过期
|
||||||
// "110408" 已删除
|
// "110408" 已删除
|
||||||
// "110410" 已重置
|
// "110410" 已重置
|
||||||
static int keyStatusNormalUse = 110401; // 正常使用
|
static int keyStatusNormalUse = 110401; // 正常使用
|
||||||
static int keyStatusWaitReceive = 110402; // 待接收
|
static int keyStatusWaitReceive = 110402; // 待接收
|
||||||
static int keyStatusWaitIneffective = 110403; // 待生效
|
static int keyStatusWaitIneffective = 110403; // 待生效
|
||||||
static int keyStatusFrozen = 110405; // 已冻结
|
static int keyStatusFrozen = 110405; // 已冻结
|
||||||
static int keyStatusExpired = 110412; // 已过期
|
static int keyStatusExpired = 110412; // 已过期
|
||||||
static int keyStatusDeleted = 110408; // 已删除
|
static int keyStatusDeleted = 110408; // 已删除
|
||||||
static int keyStatusReset = 110410; // 已重置
|
static int keyStatusReset = 110410; // 已重置
|
||||||
|
|
||||||
static String getKeyStatusStr(int keyStatus){
|
static String getKeyStatusStr(int keyStatus) {
|
||||||
switch(keyStatus){
|
switch (keyStatus) {
|
||||||
case 110401:
|
case 110401:
|
||||||
// 正常使用
|
// 正常使用
|
||||||
return "";
|
return "";
|
||||||
@ -55,10 +55,17 @@ class XSConstantMacro {
|
|||||||
return "未知";
|
return "未知";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 门锁事件类型 lockEventType 事件类型:0-全部事件;10-开门事件20-异常事件30-门铃事件40-视频事件
|
// 门锁事件类型 lockEventType 事件类型:0-全部事件;10-开门事件20-异常事件30-门铃事件40-视频事件
|
||||||
static int lockEventTypeAll = 0;
|
static int lockEventTypeAll = 0;
|
||||||
static int lockEventTypeOpenDoor = 10;
|
static int lockEventTypeOpenDoor = 10;
|
||||||
static int lockEventTypeAbnormal = 20;
|
static int lockEventTypeAbnormal = 20;
|
||||||
static int lockEventTypeDoorbell = 30;
|
static int lockEventTypeDoorbell = 30;
|
||||||
static int lockEventTypeVideo = 40;
|
static int lockEventTypeVideo = 40;
|
||||||
|
|
||||||
|
//猫眼工作模式
|
||||||
|
static int catEyeWorkModePowerSaving = 1; //省电模式
|
||||||
|
static int catEyeWorkModeStayCapture = 2; //逗留抓拍模式
|
||||||
|
static int catEyeWorkModeRealTimeMonitoring = 3; //实时监控模式
|
||||||
|
static int catEyeWorkModeCustom = 4; //自定义模式
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,8 @@ class StarLockAMapKey {
|
|||||||
|
|
||||||
class F {
|
class F {
|
||||||
static Flavor? appFlavor;
|
static Flavor? appFlavor;
|
||||||
|
// 是否为精简模式(在一些应用商店场景下,需要精简掉一些功能)
|
||||||
|
static bool isLite = false;
|
||||||
|
|
||||||
static String get name => appFlavor?.name ?? '';
|
static String get name => appFlavor?.name ?? '';
|
||||||
|
|
||||||
|
|||||||
@ -207,8 +207,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 10.sp,
|
width: 10.sp,
|
||||||
)),
|
)),
|
||||||
//上架审核注释 提交Google暂时屏蔽
|
F.isLite
|
||||||
F.appFlavor == Flavor.sky
|
|
||||||
? Container()
|
? Container()
|
||||||
: GestureDetector(
|
: GestureDetector(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
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_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
import 'app.dart';
|
import 'app.dart';
|
||||||
@ -17,6 +18,8 @@ FutureOr<void> main() async {
|
|||||||
// 设置国际化信息
|
// 设置国际化信息
|
||||||
await _initTranslation();
|
await _initTranslation();
|
||||||
|
|
||||||
|
initLocalNotification();
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
|
|
||||||
if (AppPlatform.isAndroid) {
|
if (AppPlatform.isAndroid) {
|
||||||
@ -37,7 +40,7 @@ Future _initTranslation() async => TranslationLoader.loadTranslation(
|
|||||||
Future _setCommonServices() async {
|
Future _setCommonServices() async {
|
||||||
await Get.putAsync(() => StoreService().init());
|
await Get.putAsync(() => StoreService().init());
|
||||||
await Get.putAsync(() => PlatformInfoService().init());
|
await Get.putAsync(() => PlatformInfoService().init());
|
||||||
if (F.appFlavor == Flavor.sky) {
|
if (F.isLite) {
|
||||||
//上架审核注释 获取设备信息
|
//上架审核注释 获取设备信息
|
||||||
// await Get.putAsync(() => DeviceInfoService().init());
|
// await Get.putAsync(() => DeviceInfoService().init());
|
||||||
} else {
|
} else {
|
||||||
@ -45,3 +48,14 @@ Future _setCommonServices() async {
|
|||||||
}
|
}
|
||||||
// Get.log(PlatformInfoService.to.info.version);
|
// Get.log(PlatformInfoService.to.info.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initLocalNotification() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
|
FlutterLocalNotificationsPlugin();
|
||||||
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
|
AndroidInitializationSettings('app_icon');
|
||||||
|
const InitializationSettings initializationSettings =
|
||||||
|
InitializationSettings(android: initializationSettingsAndroid);
|
||||||
|
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||||
|
}
|
||||||
|
|||||||
@ -744,6 +744,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 3 修改了锁名字
|
// 3 修改了锁名字
|
||||||
state.lockAlias.value = event.setResult;
|
state.lockAlias.value = event.setResult;
|
||||||
state.keyInfos.value.lockAlias = event.setResult;
|
state.keyInfos.value.lockAlias = event.setResult;
|
||||||
|
Storage.setString(saveLockAlias, state.lockAlias.value);
|
||||||
} else if (event.type == 4) {
|
} else if (event.type == 4) {
|
||||||
// 4 更新了电量
|
// 4 更新了电量
|
||||||
state.electricQuantity.value = int.parse(event.setResult);
|
state.electricQuantity.value = int.parse(event.setResult);
|
||||||
|
|||||||
@ -109,6 +109,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
|
||||||
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
|
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
|
||||||
state.lockAlias.value = state.keyInfos.value.lockAlias!;
|
state.lockAlias.value = state.keyInfos.value.lockAlias!;
|
||||||
|
Storage.setString(saveLockAlias, state.lockAlias.value);
|
||||||
|
|
||||||
BlueManage().connectDeviceName =
|
BlueManage().connectDeviceName =
|
||||||
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
@ -178,7 +179,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
buildPageIndicator(),
|
Obx(() => buildPageIndicator()),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
|
||||||
@ -992,7 +993,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.closedUnlockSuccessfulTimer?.cancel();
|
state.closedUnlockSuccessfulTimer?.cancel();
|
||||||
_lockRefreshLockDetailInfoDataEvent?.cancel();
|
_lockRefreshLockDetailInfoDataEvent?.cancel();
|
||||||
state.replySubscription.cancel();
|
state.replySubscription.cancel();
|
||||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
|
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!
|
||||||
|
.cancel();
|
||||||
|
|
||||||
if (state.animationController != null) {
|
if (state.animationController != null) {
|
||||||
state.animationController!.dispose();
|
state.animationController!.dispose();
|
||||||
|
|||||||
@ -1,7 +1,53 @@
|
|||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import 'catEyeSet_state.dart';
|
import 'catEyeSet_state.dart';
|
||||||
|
|
||||||
class CatEyeSetLogic extends BaseGetXController {
|
class CatEyeSetLogic extends BaseGetXController {
|
||||||
final CatEyeSetState state = CatEyeSetState();
|
final CatEyeSetState state = CatEyeSetState();
|
||||||
|
|
||||||
|
//设置自动亮屏
|
||||||
|
void updateAutoLightScreenConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateAutoLightScreenConfig(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
autoLightScreen: state.isAutoBright.value == true ? 1 : 0,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置自动亮屏
|
||||||
|
void updateLightScreenTimeConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateLightScreenTimeConfig(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
autoLightScreenTime:
|
||||||
|
int.parse(state.selectBrightDuration.value.replaceAll('秒', '')),
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置逗留警告
|
||||||
|
void updateStayWarnConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateStayWarnConfig(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
stayWarn: state.isStayWarning.value == true ? 1 : 0,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置异常警告
|
||||||
|
void updateAbnormalWarnConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateAbnormalWarnConfig(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
abnormalWarn: state.isExceptionWarning.value == true ? 1 : 0,
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,12 +33,18 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: '猫眼工作模式',
|
leftTitel: '猫眼工作模式',
|
||||||
rightTitle: "",
|
rightTitle: state.selectCatEyeWorkMode.value,
|
||||||
allHeight: 70.h,
|
allHeight: 70.h,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.catEyeWorkModePage);
|
Get.toNamed(Routers.catEyeWorkModePage, arguments: {
|
||||||
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
|
})?.then((value) {
|
||||||
|
if (value != null) {
|
||||||
|
state.selectCatEyeWorkMode.value = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: '自动亮屏',
|
leftTitel: '自动亮屏',
|
||||||
@ -94,15 +100,26 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
switch (clickIndex) {
|
switch (clickIndex) {
|
||||||
case 1: //自动亮屏
|
case 1: //自动亮屏
|
||||||
state.isAutoBright.value = value;
|
{
|
||||||
|
state.isAutoBright.value = value;
|
||||||
|
logic.updateAutoLightScreenConfig();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2: //逗留警告
|
case 2: //逗留警告
|
||||||
state.isStayWarning.value = value;
|
{
|
||||||
|
state.isStayWarning.value = value;
|
||||||
|
logic.updateStayWarnConfig();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3: //异常警告
|
case 3: //异常警告
|
||||||
state.isExceptionWarning.value = value;
|
{
|
||||||
|
state.isExceptionWarning.value = value;
|
||||||
|
logic.updateAbnormalWarnConfig();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
print('clickIndex is not match');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -120,6 +137,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
|
|||||||
chooseCallback: (value) {
|
chooseCallback: (value) {
|
||||||
state.selectBrightDuration.value =
|
state.selectBrightDuration.value =
|
||||||
state.brightDurationTimeList[value];
|
state.brightDurationTimeList[value];
|
||||||
|
logic.updateLightScreenTimeConfig();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
|
||||||
class CatEyeSetState {
|
class CatEyeSetState {
|
||||||
var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs;
|
var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs;
|
||||||
@ -6,4 +7,11 @@ class CatEyeSetState {
|
|||||||
var isAutoBright = false.obs; //自动亮屏
|
var isAutoBright = false.obs; //自动亮屏
|
||||||
var isStayWarning = false.obs; //逗留警告
|
var isStayWarning = false.obs; //逗留警告
|
||||||
var isExceptionWarning = false.obs; //异常警告
|
var isExceptionWarning = false.obs; //异常警告
|
||||||
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
var selectCatEyeWorkMode = ''.obs; //猫眼工作模式
|
||||||
|
|
||||||
|
CatEyeSetState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class CatEyeWorkModeLogic extends BaseGetXController {
|
||||||
|
final CatEyeWorkModeState state = CatEyeWorkModeState();
|
||||||
|
|
||||||
|
//设置猫眼工作模式
|
||||||
|
void updateCatEyeModeConfig() async {
|
||||||
|
var entity = await ApiRepository.to.updateCatEyeModeConfig(
|
||||||
|
lockId: state.lockSetInfoData.value.lockId!,
|
||||||
|
catEyeConfig: {
|
||||||
|
'catEyeMode': state.selectCatEyeWorkMode.value,
|
||||||
|
'catEyeModeConfig': {
|
||||||
|
'recordMode': state.recordMode.value,
|
||||||
|
'recordStartTime': state.recordStartTime.value,
|
||||||
|
'recordEndTime': state.recordEndTime.value,
|
||||||
|
'detectionDistance': state.detectionDistance.value,
|
||||||
|
'realTimeMode': state.realTimeMode.value,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
showToast('设置成功');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ import 'package:flutter/material.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/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
@ -14,8 +16,8 @@ class CatEyeWorkModePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
||||||
bool isCheck = false;
|
final logic = Get.put(CatEyeWorkModeLogic());
|
||||||
List boolList = [true, false, false, false];
|
final state = Get.find<CatEyeWorkModeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -30,44 +32,34 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
_buildTipsView(
|
_buildTipsView('省电模式:\n',
|
||||||
'省电模式:\n',
|
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下,满电可使用7-8个月', 0),
|
||||||
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下,满电可使用7-8个月',
|
SizedBox(
|
||||||
0,
|
height: 30.h,
|
||||||
boolList[0]),
|
),
|
||||||
|
_buildTipsView('逗留抓拍模式:\n',
|
||||||
|
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下,满电可使用5~6个月。', 1),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.h,
|
||||||
|
),
|
||||||
|
_buildTipsView('实时监控模式:\n',
|
||||||
|
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下,满电可使用2~4个月。', 2),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
_buildTipsView(
|
_buildTipsView(
|
||||||
'逗留抓拍模式:\n',
|
'自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)
|
||||||
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下,满电可使用5~6个月。',
|
|
||||||
1,
|
|
||||||
boolList[1]),
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
_buildTipsView(
|
|
||||||
'实时监控模式:\n',
|
|
||||||
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下,满电可使用2~4个月。',
|
|
||||||
2,
|
|
||||||
boolList[2]),
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
_buildTipsView('自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。',
|
|
||||||
3, boolList[3])
|
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTipsView(
|
Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
|
||||||
String titleStr, String subTitle, int clickIndex, bool isClick) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Container(
|
||||||
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: state.boolList.value[clickIndex]
|
||||||
? AppColors.blueViewBgColor
|
? AppColors.blueViewBgColor
|
||||||
: AppColors.greyBackgroundColor,
|
: AppColors.greyBackgroundColor,
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
@ -77,7 +69,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
|||||||
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
|
state.boolList.value[clickIndex]
|
||||||
? Image.asset(
|
? Image.asset(
|
||||||
'images/mine/icon_mine_blueSelect.png',
|
'images/mine/icon_mine_blueSelect.png',
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
@ -89,7 +81,8 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
|||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildRichText(titleStr, subTitle, isClick),
|
child: _buildRichText(
|
||||||
|
titleStr, subTitle, state.boolList.value[clickIndex]),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
@ -128,11 +121,30 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
for (int i = 0; i < boolList.length; i++) {
|
for (int i = 0; i < state.boolList.value.length; i++) {
|
||||||
if (clickIndex == i) {
|
if (clickIndex == i) {
|
||||||
boolList[clickIndex] = true;
|
state.boolList.value[clickIndex] = true;
|
||||||
|
switch (clickIndex) {
|
||||||
|
case 0:
|
||||||
|
state.selectCatEyeWorkMode.value =
|
||||||
|
XSConstantMacro.catEyeWorkModePowerSaving;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
state.selectCatEyeWorkMode.value =
|
||||||
|
XSConstantMacro.catEyeWorkModeStayCapture;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
state.selectCatEyeWorkMode.value =
|
||||||
|
XSConstantMacro.catEyeWorkModeRealTimeMonitoring;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
state.selectCatEyeWorkMode.value =
|
||||||
|
XSConstantMacro.catEyeWorkModeCustom;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
logic.updateCatEyeModeConfig();
|
||||||
} else {
|
} else {
|
||||||
boolList[i] = false;
|
state.boolList.value[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
|
|
||||||
|
class CatEyeWorkModeState {
|
||||||
|
var lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
var selectCatEyeWorkMode = 0.obs; //猫眼工作模式
|
||||||
|
var boolList = [true, false, false, false].obs;
|
||||||
|
var recordMode = 0.obs; //录像时段 0全天 1自定义时间
|
||||||
|
//自定义时间需要填:recordStartTime与recordEndTime参数
|
||||||
|
var recordStartTime = 0.obs; // 1709715049775,
|
||||||
|
var recordEndTime = 0.obs; //1709715049775,
|
||||||
|
var recordTime = 0.obs; //有人出现时录像
|
||||||
|
var detectionDistance = 0.obs; //人体侦测距离
|
||||||
|
var realTimeMode = 0.obs; //实时画面 0发生事件事查看 1实时查看
|
||||||
|
|
||||||
|
CatEyeWorkModeState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
lockSetInfoData.value = map["lockSetInfoData"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -299,7 +299,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
// 常开模式
|
// 常开模式
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.lockFeature.value.passageMode == 1 ? true : false,
|
visible: state.lockFeature.value.passageMode == 1 ? true : false,
|
||||||
// visible: true,
|
// visible: true,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
|
||||||
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
|
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
|
||||||
@ -380,7 +380,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
|||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Get.toNamed(Routers.catEyeSetPage);
|
Get.toNamed(Routers.catEyeSetPage, arguments: {
|
||||||
|
'lockSetInfoData': state.lockSetInfoData.value
|
||||||
|
});
|
||||||
})),
|
})),
|
||||||
// Obx(() =>
|
// Obx(() =>
|
||||||
//自动亮屏已包括至面容开锁模块
|
//自动亮屏已包括至面容开锁模块
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -7,6 +6,7 @@ import 'package:flutter_voice_processor/flutter_voice_processor.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
|
import 'package:star_lock/talk/udp/udp_talkClass.dart';
|
||||||
|
|
||||||
import '../../../../talk/call/g711.dart';
|
import '../../../../talk/call/g711.dart';
|
||||||
import '../../../../talk/udp/udp_manage.dart';
|
import '../../../../talk/udp/udp_manage.dart';
|
||||||
@ -33,7 +33,7 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
// 预加载图片数据
|
// 预加载图片数据
|
||||||
Uint8List imageData = Uint8List.fromList(event.tvList);
|
Uint8List imageData = Uint8List.fromList(event.tvList);
|
||||||
// 更新状态
|
// 更新状态
|
||||||
state.listData.value = imageData;
|
state.listPhotoData.value = imageData;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -42,40 +42,59 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
StreamSubscription? _getUDPStatusRefreshUIEvent;
|
StreamSubscription? _getUDPStatusRefreshUIEvent;
|
||||||
void _getUDPStatusRefreshUIAction() {
|
void _getUDPStatusRefreshUIAction() {
|
||||||
_getUDPStatusRefreshUIEvent =
|
_getUDPStatusRefreshUIEvent =
|
||||||
eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
|
eventBus.on<GetUDPStatusRefreshUI>().listen((event) async {
|
||||||
state.udpStatus.value = event.udpStatus;
|
state.udpStatus.value = event.udpStatus;
|
||||||
if (state.udpStatus.value == 8) {
|
state.oneMinuteTime.value = 0;
|
||||||
// 接听成功了,然后刷新界面的时间 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: UDPManage().lockId,
|
|
||||||
lockIP: UDPManage().host,
|
|
||||||
userMobile: await state.userUid,
|
|
||||||
userMobileIP: await state.userMobileIP,
|
|
||||||
endData: []);
|
|
||||||
|
|
||||||
CallTalk().stopPcmSound();
|
// 如果已经挂断,则取消定时器并退出
|
||||||
// 关闭当前界面
|
if (state.udpStatus.value == 0 && UDPTalkClass().isEndCall == true) {
|
||||||
Get.back();
|
state.oneMinuteTimeTimer.cancel();
|
||||||
|
state.oneMinuteTime.value = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是接听状态,则启动定时器更新通话时间
|
||||||
|
if (state.udpStatus.value == 8) {
|
||||||
|
state.oneMinuteTimeTimer.cancel(); // 取消旧定时器
|
||||||
|
state.oneMinuteTimeTimer =
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (Timer t) {
|
||||||
|
state.oneMinuteTime.value++;
|
||||||
|
if (state.oneMinuteTime.value >= 60) {
|
||||||
|
t.cancel(); // 取消定时器
|
||||||
|
initiateUdpHangUpAction(); // 挂断操作
|
||||||
|
print('通话时间超过60秒,自动挂断');
|
||||||
|
state.oneMinuteTime.value = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发起接听命令,每隔一秒钟发一次,六秒无应答则失败
|
||||||
|
void initiateUdpAnswerAction() {
|
||||||
|
state.answerTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
udpAnswerAction();
|
||||||
|
state.answerSeconds++;
|
||||||
|
|
||||||
|
//如果接听成功,取消定时器;接听失败,继续发接听命令
|
||||||
|
if (UDPTalkClass().status == 8) {
|
||||||
|
state.answerTimer.cancel(); // 取消定时器
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查条件,如果达到6秒且未得到应答,则认为失败
|
||||||
|
if (state.answerSeconds >= 6) {
|
||||||
|
state.answerTimer.cancel();
|
||||||
|
showToast("接听失败");
|
||||||
|
initiateUdpHangUpAction();
|
||||||
|
// UDPTalkClass().callNoAnswer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// 接听
|
/// 接听
|
||||||
udpAnswerAction() async {
|
udpAnswerAction() async {
|
||||||
|
print('点了接听么');
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
command: 150,
|
command: 150,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
@ -87,6 +106,27 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
endData: []);
|
endData: []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发起挂断命令,每隔一秒钟发一次,六秒无应答则失败
|
||||||
|
void initiateUdpHangUpAction() {
|
||||||
|
// 每隔一秒调用一次 udpHangUpAction 方法
|
||||||
|
state.hangUpTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
state.hangUpSeconds++;
|
||||||
|
udpHangUpAction();
|
||||||
|
|
||||||
|
//如果已经挂断成功,则取消定时器
|
||||||
|
if (UDPTalkClass().isEndCall == true) {
|
||||||
|
state.hangUpTimer.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查条件,如果达到6秒且未得到应答,则认为失败
|
||||||
|
if (state.hangUpSeconds >= 6) {
|
||||||
|
state.hangUpTimer.cancel(); // 取消定时器
|
||||||
|
UDPTalkClass().callNoAnswer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// 挂断
|
/// 挂断
|
||||||
udpHangUpAction() async {
|
udpHangUpAction() async {
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
@ -100,6 +140,20 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
endData: []);
|
endData: []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发起开门命令,每隔一秒钟发一次,六秒无应答则失败
|
||||||
|
void initiateUdpOpenDoorAction(List<int> list) {
|
||||||
|
// 每隔一秒调用一次 udpOpenDoorAction 方法
|
||||||
|
state.openDoorTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
state.openDoorSeconds++;
|
||||||
|
udpOpenDoorAction(list);
|
||||||
|
|
||||||
|
// 检查条件,如果达到6秒且未得到应答,则认为失败
|
||||||
|
if (state.openDoorSeconds >= 6) {
|
||||||
|
state.openDoorTimer.cancel(); // 取消定时器
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// 开门
|
/// 开门
|
||||||
udpOpenDoorAction(List<int> list) async {
|
udpOpenDoorAction(List<int> list) async {
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
@ -406,6 +460,6 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
state.oneMinuteTimeTimer.cancel();
|
state.oneMinuteTimeTimer.cancel();
|
||||||
}
|
}
|
||||||
stopProcessing();
|
stopProcessing();
|
||||||
state.listData.value = Uint8List(0);
|
state.listPhotoData.value = Uint8List(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
|
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';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
|
import 'package:star_lock/talk/udp/udp_talkClass.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';
|
||||||
@ -23,8 +26,11 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
initAsync();
|
||||||
|
}
|
||||||
|
|
||||||
requestMicrophonePermission();
|
Future<void> initAsync() async {
|
||||||
|
await requestMicrophonePermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,16 +40,23 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
height: 1.sh,
|
height: 1.sh,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Obx(() => state.listData.value.isEmpty
|
Obx(() {
|
||||||
? Container(color: Colors.transparent)
|
if (state.listPhotoData.value.isEmpty ||
|
||||||
: Image.memory(
|
state.listPhotoData.value.length < 10) {
|
||||||
state.listData.value,
|
return Container(color: Colors.transparent);
|
||||||
// key: ValueKey<int>(state.listData.value.hashCode),
|
} else {
|
||||||
gaplessPlayback: true,
|
return Image.memory(
|
||||||
width: 1.sw,
|
state.listPhotoData.value,
|
||||||
height: 1.sh,
|
gaplessPlayback: true,
|
||||||
fit: BoxFit.cover,
|
width: 1.sw,
|
||||||
)),
|
height: 1.sh,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return Container(color: Colors.transparent);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: ScreenUtil().statusBarHeight + 30.h,
|
top: ScreenUtil().statusBarHeight + 30.h,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
@ -163,8 +176,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||||
// 接听
|
// 接听
|
||||||
Obx(() => bottomBtnItemWidget(
|
Obx(() => bottomBtnItemWidget(
|
||||||
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
state.isClickAnswer.value == true
|
||||||
logic.udpAnswerAction();
|
? 'images/main/icon_lockDetail_monitoringUnTalkback.png'
|
||||||
|
: getAnswerBtnImg(),
|
||||||
|
state.isClickAnswer.value == true ? '长按说话' : getAnswerBtnName(),
|
||||||
|
Colors.white, () async {
|
||||||
|
if (state.isClickAnswer.value == false) {
|
||||||
|
logic.initiateUdpAnswerAction();
|
||||||
|
state.isClickAnswer.value = true;
|
||||||
|
}
|
||||||
}, longPress: () {
|
}, longPress: () {
|
||||||
// 开始长按
|
// 开始长按
|
||||||
print("onLongPress");
|
print("onLongPress");
|
||||||
@ -186,7 +206,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
logic.stopProcessing();
|
logic.stopProcessing();
|
||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
// 挂断
|
// 挂断
|
||||||
logic.udpHangUpAction();
|
if (state.isClickHangUp.value == false) {
|
||||||
|
logic.initiateUdpHangUpAction();
|
||||||
|
state.isClickHangUp.value = true;
|
||||||
|
} else {
|
||||||
|
print('点了这里?');
|
||||||
|
state.isClickHangUp.value = false;
|
||||||
|
UDPTalkClass().stopLocalAudio();
|
||||||
|
logic.udpHangUpAction();
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
|
||||||
"开锁", AppColors.mainColor, () {
|
"开锁", AppColors.mainColor, () {
|
||||||
@ -298,7 +326,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// state.isSenderAudioData.value = false;
|
// state.isSenderAudioData.value = false;
|
||||||
print("发送接听了");
|
// print("发送接听了");
|
||||||
// 刚进来是接听状态,然后改为长按对讲
|
// 刚进来是接听状态,然后改为长按对讲
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,16 +10,17 @@ import '../../../../tools/storage.dart';
|
|||||||
|
|
||||||
class LockMonitoringState {
|
class LockMonitoringState {
|
||||||
var isOpenVoice = false.obs;
|
var isOpenVoice = false.obs;
|
||||||
var udpSendDataFrameNumber = 0;// 帧序号
|
var udpSendDataFrameNumber = 0; // 帧序号
|
||||||
// var isSenderAudioData = false.obs;// 是否要发送音频数据
|
// var isSenderAudioData = false.obs;// 是否要发送音频数据
|
||||||
|
|
||||||
var userMobileIP = NetworkInfo().getWifiIP();
|
var userMobileIP = NetworkInfo().getWifiIP();
|
||||||
var userUid = Storage.getUid();
|
var userUid = Storage.getUid();
|
||||||
|
|
||||||
var udpStatus = 0.obs; //0:初始状态 1:等待监视 2: 3:监视中 4:呼叫成功 5:主角通话中 6:被叫通话 8:被叫通话中 9:长按说话
|
var udpStatus =
|
||||||
|
0.obs; //0:初始状态 1:等待监视 2: 3:监视中 4:呼叫成功 5:主角通话中 6:被叫通话 8:被叫通话中 9:长按说话
|
||||||
var passwordTF = TextEditingController();
|
var passwordTF = TextEditingController();
|
||||||
|
|
||||||
var listData = Uint8List(0).obs; //得到的视频流字节数据
|
var listPhotoData = Uint8List(0).obs; //得到的视频流字节数据
|
||||||
var listAudioData = <int>[].obs; //得到的音频流字节数据
|
var listAudioData = <int>[].obs; //得到的音频流字节数据
|
||||||
|
|
||||||
late final VoiceProcessor? voiceProcessor;
|
late final VoiceProcessor? voiceProcessor;
|
||||||
@ -29,7 +30,14 @@ class LockMonitoringState {
|
|||||||
var oneMinuteTime = 0.obs; // 定时器秒数
|
var oneMinuteTime = 0.obs; // 定时器秒数
|
||||||
|
|
||||||
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
||||||
late Timer answerTimer;
|
late Timer answerTimer = Timer(const Duration(seconds: 1), () {}); //接听命令定时器
|
||||||
late Timer hangUpTimer;
|
var answerSeconds = 0.obs;
|
||||||
late Timer openDoorTimer;
|
var isClickAnswer = false.obs; //是否点击了接听按钮
|
||||||
|
|
||||||
|
late Timer hangUpTimer = Timer(const Duration(seconds: 1), () {}); //挂断命令定时器
|
||||||
|
var hangUpSeconds = 0.obs;
|
||||||
|
var isClickHangUp = false.obs; //是否点击了挂断按钮
|
||||||
|
|
||||||
|
late Timer openDoorTimer = Timer(const Duration(seconds: 1), () {}); //开门命令定时器
|
||||||
|
var openDoorSeconds = 0.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,8 +215,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
//上架审核注释 提交Google暂时屏蔽
|
F.isLite
|
||||||
F.appFlavor == Flavor.sky
|
|
||||||
? Container()
|
? Container()
|
||||||
: SubmitBtn(
|
: SubmitBtn(
|
||||||
btnName: '演示模式',
|
btnName: '演示模式',
|
||||||
|
|||||||
9
star_lock/lib/main_sky_lite.dart
Normal file
9
star_lock/lib/main_sky_lite.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'flavors.dart';
|
||||||
|
|
||||||
|
import 'main.dart' as runner;
|
||||||
|
|
||||||
|
Future<void> main() async {
|
||||||
|
F.appFlavor = Flavor.sky;
|
||||||
|
F.isLite = true;
|
||||||
|
await runner.main();
|
||||||
|
}
|
||||||
@ -146,14 +146,14 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
Get.toNamed(Routers.mineSetPage);
|
Get.toNamed(Routers.mineSetPage);
|
||||||
}),
|
}),
|
||||||
//上架审核
|
//上架审核
|
||||||
F.appFlavor == Flavor.sky
|
F.isLite
|
||||||
? Container()
|
? Container()
|
||||||
: mineItem('images/mine/icon_mine_main_vip.png',
|
: mineItem('images/mine/icon_mine_main_vip.png',
|
||||||
TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
|
TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.valueAddedServicesPage);
|
Get.toNamed(Routers.valueAddedServicesPage);
|
||||||
}),
|
}),
|
||||||
F.appFlavor == Flavor.sky
|
F.isLite
|
||||||
? Container()
|
? Container()
|
||||||
: mineItem(
|
: mineItem(
|
||||||
'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () {
|
'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () {
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
|||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
//上架审核注释
|
//上架审核注释
|
||||||
F.appFlavor == Flavor.sky
|
F.isLite
|
||||||
? Container()
|
? Container()
|
||||||
: CommonItem(
|
: CommonItem(
|
||||||
leftTitel: "Amazon Alexa",
|
leftTitel: "Amazon Alexa",
|
||||||
@ -214,7 +214,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
|||||||
action: () {
|
action: () {
|
||||||
logic.showToast("功能暂未开放");
|
logic.showToast("功能暂未开放");
|
||||||
}),
|
}),
|
||||||
F.appFlavor == Flavor.sky
|
F.isLite
|
||||||
? Container()
|
? Container()
|
||||||
: CommonItem(
|
: CommonItem(
|
||||||
leftTitel: "Google Home",
|
leftTitel: "Google Home",
|
||||||
@ -224,7 +224,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
|||||||
action: () {
|
action: () {
|
||||||
logic.showToast("功能暂未开放");
|
logic.showToast("功能暂未开放");
|
||||||
}),
|
}),
|
||||||
F.appFlavor == Flavor.sky
|
F.isLite
|
||||||
? Container()
|
? Container()
|
||||||
: CommonItem(
|
: CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
||||||
|
|||||||
@ -180,4 +180,7 @@ abstract class Api {
|
|||||||
final String deletMessageURL = '/notifications/delete'; //删除消息
|
final String deletMessageURL = '/notifications/delete'; //删除消息
|
||||||
|
|
||||||
final String getVersionURL = '/app/getVersion'; //版本更新
|
final String getVersionURL = '/app/getVersion'; //版本更新
|
||||||
|
|
||||||
|
final String updateCatEyeConfigURL =
|
||||||
|
'/lockSetting/updateCatEyeConfig'; //设置猫眼工作模式
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,8 +204,17 @@ class ApiProvider extends BaseProvider {
|
|||||||
'operatorUid': operatorUid,
|
'operatorUid': operatorUid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
|
Future<Response> updateKeyDate(
|
||||||
String startDate, List weekDays, int keyType, int startTime, int endTime, int isOnlyManageSelf, int remoteEnable) =>
|
String keyId,
|
||||||
|
String lockId,
|
||||||
|
String endDate,
|
||||||
|
String startDate,
|
||||||
|
List weekDays,
|
||||||
|
int keyType,
|
||||||
|
int startTime,
|
||||||
|
int endTime,
|
||||||
|
int isOnlyManageSelf,
|
||||||
|
int remoteEnable) =>
|
||||||
post(
|
post(
|
||||||
updateKeyDateURL.toUrl,
|
updateKeyDateURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -226,22 +235,20 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
|
|
||||||
Future<Response> lockRecordList(
|
Future<Response> lockRecordList(
|
||||||
{
|
{required String endDate,
|
||||||
required String endDate,
|
required String keyId,
|
||||||
required String keyId,
|
required String keyStatus,
|
||||||
required String keyStatus,
|
required String lockId,
|
||||||
required String lockId,
|
required String operatorUid,
|
||||||
required String operatorUid,
|
required String pageNo,
|
||||||
required String pageNo,
|
required String pageSize,
|
||||||
required String pageSize,
|
required String startDate,
|
||||||
required String startDate,
|
required String recordType,
|
||||||
required String recordType,
|
required String searchStr,
|
||||||
required String searchStr,
|
required String timezoneRawOffSet,
|
||||||
required String timezoneRawOffSet,
|
required String keyboardPwdId,
|
||||||
required String keyboardPwdId,
|
required String cardId,
|
||||||
required String cardId,
|
required String fingerprintId}) =>
|
||||||
required String fingerprintId
|
|
||||||
}) =>
|
|
||||||
post(
|
post(
|
||||||
keyOperationRecordURL.toUrl,
|
keyOperationRecordURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -364,9 +371,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 删除拥有的当前钥匙
|
// 删除拥有的当前钥匙
|
||||||
Future<Response> deletOwnerKeyInfo(String lockId, String keyId, int includeUnderlings) => post(
|
Future<Response> deletOwnerKeyInfo(
|
||||||
deleteElectronicKeyURL.toUrl,
|
String lockId, String keyId, int includeUnderlings) =>
|
||||||
jsonEncode({'lockId': lockId, 'keyId': keyId, 'includeUnderlings': includeUnderlings}));
|
post(
|
||||||
|
deleteElectronicKeyURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'keyId': keyId,
|
||||||
|
'includeUnderlings': includeUnderlings
|
||||||
|
}));
|
||||||
|
|
||||||
// 检查账户密码
|
// 检查账户密码
|
||||||
Future<Response> checkLoginPassword(String password) => post(
|
Future<Response> checkLoginPassword(String password) => post(
|
||||||
@ -515,7 +528,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
|
||||||
|
|
||||||
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
|
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
|
||||||
post(deleteElectronicKeyURL.toUrl,
|
post(
|
||||||
|
deleteElectronicKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
'includeUnderlings': includeUnderlings,
|
'includeUnderlings': includeUnderlings,
|
||||||
@ -538,40 +552,39 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置授权管理员
|
// 设置授权管理员
|
||||||
Future<Response> setAdministrator(String keyId) =>
|
Future<Response> setAdministrator(String keyId) => post(
|
||||||
post(setAuthorizeURL.toUrl,
|
setAuthorizeURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 取消授权管理员
|
// 取消授权管理员
|
||||||
Future<Response> cancelAdministrator(String keyId) =>
|
Future<Response> cancelAdministrator(String keyId) => post(
|
||||||
post(cancelAuthorizeURL.toUrl,
|
cancelAuthorizeURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 冻结
|
// 冻结
|
||||||
Future<Response> freezeKey(String keyId) =>
|
Future<Response> freezeKey(String keyId) => post(
|
||||||
post(freezeKeyURL.toUrl,
|
freezeKeyURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 取消冻结
|
// 取消冻结
|
||||||
Future<Response> cancelFreeze(String keyId) =>
|
Future<Response> cancelFreeze(String keyId) => post(
|
||||||
post(cancelFreezeURL.toUrl,
|
cancelFreezeURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'keyId': keyId,
|
'keyId': keyId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> expireLockList(String pageNo, String pageSize) =>
|
Future<Response> expireLockList(String pageNo, String pageSize) => post(
|
||||||
post(
|
expireLockListURL.toUrl,
|
||||||
expireLockListURL.toUrl,
|
jsonEncode({
|
||||||
jsonEncode({
|
'pageNo': pageNo,
|
||||||
'pageNo': pageNo,
|
'pageSize': pageSize,
|
||||||
'pageSize': pageSize,
|
}));
|
||||||
}));
|
|
||||||
|
|
||||||
Future<Response> deleteKeyboardPwd(
|
Future<Response> deleteKeyboardPwd(
|
||||||
String lockId, String keyboardPwdId, int deleteType) =>
|
String lockId, String keyboardPwdId, int deleteType) =>
|
||||||
@ -1009,9 +1022,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
String isCoerced,
|
String isCoerced,
|
||||||
String startDate,
|
String startDate,
|
||||||
List weekDay,
|
List weekDay,
|
||||||
int fingerRight,
|
int fingerRight,
|
||||||
int startTime,
|
int startTime,
|
||||||
int endTime,
|
int endTime,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
addFingerprintURL.toUrl,
|
addFingerprintURL.toUrl,
|
||||||
@ -1040,9 +1053,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
String isCoerced,
|
String isCoerced,
|
||||||
String fingerprintName,
|
String fingerprintName,
|
||||||
String changeType,
|
String changeType,
|
||||||
int startTime,
|
int startTime,
|
||||||
int endTime,
|
int endTime,
|
||||||
int fingerprintType) =>
|
int fingerprintType) =>
|
||||||
post(
|
post(
|
||||||
editFingerprintURL.toUrl,
|
editFingerprintURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1202,9 +1215,9 @@ class ApiProvider extends BaseProvider {
|
|||||||
String startDate,
|
String startDate,
|
||||||
String isCoerced,
|
String isCoerced,
|
||||||
List weekDay,
|
List weekDay,
|
||||||
int startTime,
|
int startTime,
|
||||||
int endTime,
|
int endTime,
|
||||||
int cardRight,
|
int cardRight,
|
||||||
) =>
|
) =>
|
||||||
post(
|
post(
|
||||||
addICCardURL.toUrl,
|
addICCardURL.toUrl,
|
||||||
@ -1225,17 +1238,18 @@ class ApiProvider extends BaseProvider {
|
|||||||
|
|
||||||
// 编辑ICCard
|
// 编辑ICCard
|
||||||
Future<Response> editICCardData(
|
Future<Response> editICCardData(
|
||||||
String lockId,
|
String lockId,
|
||||||
String cardId,
|
String cardId,
|
||||||
String cardName,
|
String cardName,
|
||||||
String startDate,
|
String startDate,
|
||||||
String endDate,
|
String endDate,
|
||||||
String isCoerced,
|
String isCoerced,
|
||||||
List weekDay,
|
List weekDay,
|
||||||
String changeType,
|
String changeType,
|
||||||
int startTime,
|
int startTime,
|
||||||
int endTime,
|
int endTime,
|
||||||
int cardType,) =>
|
int cardType,
|
||||||
|
) =>
|
||||||
post(
|
post(
|
||||||
editICCardURL.toUrl,
|
editICCardURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -1606,12 +1620,58 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取最新版本号
|
// 获取最新版本号
|
||||||
Future<Response> getVersionData(String brandName, String currentVersion) => post(
|
Future<Response> getVersionData(String brandName, String currentVersion) =>
|
||||||
getVersionURL.toUrl,
|
post(
|
||||||
|
getVersionURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'brandName': brandName,
|
||||||
|
'currentVersion': currentVersion,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 设置猫眼工作模式
|
||||||
|
Future<Response> updateCatEyeModeConfig(int lockId, Map catEyeConfig) => post(
|
||||||
|
updateCatEyeConfigURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
'brandName': brandName,
|
'lockId': lockId,
|
||||||
'currentVersion': currentVersion,
|
'catEyeConfig': catEyeConfig,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 设置自动亮屏
|
||||||
|
Future<Response> updateAutoLightScreenConfig(
|
||||||
|
int lockId, int autoLightScreen) =>
|
||||||
|
post(
|
||||||
|
updateCatEyeConfigURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'autoLightScreen': autoLightScreen,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 设置亮屏持续时间
|
||||||
|
Future<Response> updateLightScreenTimeConfig(
|
||||||
|
int lockId, int autoLightScreenTime) =>
|
||||||
|
post(
|
||||||
|
updateCatEyeConfigURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'autoLightScreenTime': autoLightScreenTime,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 设置逗留警告
|
||||||
|
Future<Response> updateStayWarnConfig(int lockId, int stayWarn) => post(
|
||||||
|
updateCatEyeConfigURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'stayWarn': stayWarn,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 设置异常警告
|
||||||
|
Future<Response> updateAbnormalWarnConfig(int lockId, int abnormalWarn) =>
|
||||||
|
post(
|
||||||
|
updateCatEyeConfigURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
'abnormalWarn': abnormalWarn,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -193,37 +193,35 @@ class ApiRepository {
|
|||||||
|
|
||||||
//钥匙详情-操作记录
|
//钥匙详情-操作记录
|
||||||
Future<KeyOperationRecordEntity> lockRecordList(
|
Future<KeyOperationRecordEntity> lockRecordList(
|
||||||
{
|
{required String endDate,
|
||||||
required String endDate,
|
required String keyId,
|
||||||
required String keyId,
|
required String keyStatus,
|
||||||
required String keyStatus,
|
required String lockId,
|
||||||
required String lockId,
|
required String operatorUid,
|
||||||
required String operatorUid,
|
required String pageNo,
|
||||||
required String pageNo,
|
required String pageSize,
|
||||||
required String pageSize,
|
required String startDate,
|
||||||
required String startDate,
|
required String recordType,
|
||||||
required String recordType,
|
required String searchStr,
|
||||||
required String searchStr,
|
required String timezoneRawOffSet,
|
||||||
required String timezoneRawOffSet,
|
required String keyboardPwdId,
|
||||||
required String keyboardPwdId,
|
required String cardId,
|
||||||
required String cardId,
|
required String fingerprintId}) async {
|
||||||
required String fingerprintId
|
|
||||||
}) async {
|
|
||||||
final res = await apiProvider.lockRecordList(
|
final res = await apiProvider.lockRecordList(
|
||||||
endDate:endDate,
|
endDate: endDate,
|
||||||
keyId:keyId,
|
keyId: keyId,
|
||||||
keyStatus:keyStatus,
|
keyStatus: keyStatus,
|
||||||
lockId:lockId,
|
lockId: lockId,
|
||||||
operatorUid:operatorUid,
|
operatorUid: operatorUid,
|
||||||
pageNo:pageNo,
|
pageNo: pageNo,
|
||||||
pageSize:pageSize,
|
pageSize: pageSize,
|
||||||
startDate:startDate,
|
startDate: startDate,
|
||||||
recordType:recordType,
|
recordType: recordType,
|
||||||
searchStr:searchStr,
|
searchStr: searchStr,
|
||||||
timezoneRawOffSet:timezoneRawOffSet,
|
timezoneRawOffSet: timezoneRawOffSet,
|
||||||
keyboardPwdId:keyboardPwdId,
|
keyboardPwdId: keyboardPwdId,
|
||||||
cardId:cardId,
|
cardId: cardId,
|
||||||
fingerprintId:fingerprintId);
|
fingerprintId: fingerprintId);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,8 +395,11 @@ class ApiRepository {
|
|||||||
|
|
||||||
// 删除钥匙
|
// 删除钥匙
|
||||||
Future<LockListInfoEntity> deletOwnerKeyData(
|
Future<LockListInfoEntity> deletOwnerKeyData(
|
||||||
{required String lockId, required String keyId, required int includeUnderlings}) async {
|
{required String lockId,
|
||||||
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings);
|
required String keyId,
|
||||||
|
required int includeUnderlings}) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings);
|
||||||
return LockListInfoEntity.fromJson(res.body);
|
return LockListInfoEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +587,8 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//即将到期的锁列表
|
//即将到期的锁列表
|
||||||
Future<ExpireLockListEntity> expireLockList(String pageNo, String pageSize) async {
|
Future<ExpireLockListEntity> expireLockList(
|
||||||
|
String pageNo, String pageSize) async {
|
||||||
final res = await apiProvider.expireLockList(pageNo, pageSize);
|
final res = await apiProvider.expireLockList(pageNo, pageSize);
|
||||||
return ExpireLockListEntity.fromJson(res.body);
|
return ExpireLockListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
@ -1191,18 +1193,28 @@ class ApiRepository {
|
|||||||
// 编辑指纹
|
// 编辑指纹
|
||||||
Future<LoginEntity> editFingerprintsData(
|
Future<LoginEntity> editFingerprintsData(
|
||||||
{required String fingerprintId,
|
{required String fingerprintId,
|
||||||
required String lockId,
|
required String lockId,
|
||||||
required List weekDay,
|
required List weekDay,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required String fingerprintName,
|
required String fingerprintName,
|
||||||
required String changeType,
|
required String changeType,
|
||||||
required int startTime,
|
required int startTime,
|
||||||
required int endTime,
|
required int endTime,
|
||||||
required int fingerprintType}) async {
|
required int fingerprintType}) async {
|
||||||
final res = await apiProvider.editFingerprintsData(fingerprintId, lockId,
|
final res = await apiProvider.editFingerprintsData(
|
||||||
weekDay, startDate, endDate, isCoerced, fingerprintName, changeType, startTime, endTime, fingerprintType);
|
fingerprintId,
|
||||||
|
lockId,
|
||||||
|
weekDay,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
isCoerced,
|
||||||
|
fingerprintName,
|
||||||
|
changeType,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
fingerprintType);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,26 +1371,48 @@ class ApiRepository {
|
|||||||
required int endTime,
|
required int endTime,
|
||||||
required int cardRight,
|
required int cardRight,
|
||||||
}) async {
|
}) async {
|
||||||
final res = await apiProvider.addICCardData(lockId, endDate, cardName,
|
final res = await apiProvider.addICCardData(
|
||||||
cardNumber, cardType, addType, startDate, isCoerced, weekDay, startTime, endTime, cardRight);
|
lockId,
|
||||||
|
endDate,
|
||||||
|
cardName,
|
||||||
|
cardNumber,
|
||||||
|
cardType,
|
||||||
|
addType,
|
||||||
|
startDate,
|
||||||
|
isCoerced,
|
||||||
|
weekDay,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
cardRight);
|
||||||
return AddICCardEntity.fromJson(res.body);
|
return AddICCardEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑IC卡
|
// 编辑IC卡
|
||||||
Future<LoginEntity> editICCardData(
|
Future<LoginEntity> editICCardData({
|
||||||
{required String lockId,
|
required String lockId,
|
||||||
required String cardId,
|
required String cardId,
|
||||||
required String cardName,
|
required String cardName,
|
||||||
required String startDate,
|
required String startDate,
|
||||||
required String endDate,
|
required String endDate,
|
||||||
required String isCoerced,
|
required String isCoerced,
|
||||||
required List weekDay,
|
required List weekDay,
|
||||||
required String changeType,
|
required String changeType,
|
||||||
required int startTime,
|
required int startTime,
|
||||||
required int endTime,
|
required int endTime,
|
||||||
required int cardType,}) async {
|
required int cardType,
|
||||||
final res = await apiProvider.editICCardData(lockId, cardId, cardName,
|
}) async {
|
||||||
startDate, endDate, isCoerced, weekDay, changeType, startTime, endTime, cardType);
|
final res = await apiProvider.editICCardData(
|
||||||
|
lockId,
|
||||||
|
cardId,
|
||||||
|
cardName,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
isCoerced,
|
||||||
|
weekDay,
|
||||||
|
changeType,
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
cardType);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1629,11 +1663,47 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取版本号
|
// 获取版本号
|
||||||
Future<VersionUndateEntity> getVersionData({
|
Future<VersionUndateEntity> getVersionData(
|
||||||
required String brandName,
|
{required String brandName, required String currentVersion}) async {
|
||||||
required String currentVersion
|
|
||||||
}) async {
|
|
||||||
final res = await apiProvider.getVersionData(brandName, currentVersion);
|
final res = await apiProvider.getVersionData(brandName, currentVersion);
|
||||||
return VersionUndateEntity.fromJson(res.body);
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置猫眼工作模式
|
||||||
|
Future<VersionUndateEntity> updateCatEyeModeConfig(
|
||||||
|
{required int lockId, required Map catEyeConfig}) async {
|
||||||
|
final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置自动亮屏
|
||||||
|
Future<VersionUndateEntity> updateAutoLightScreenConfig(
|
||||||
|
{required int lockId, required int autoLightScreen}) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.updateAutoLightScreenConfig(lockId, autoLightScreen);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置亮屏持续时间
|
||||||
|
Future<VersionUndateEntity> updateLightScreenTimeConfig(
|
||||||
|
{required int lockId, required int autoLightScreenTime}) async {
|
||||||
|
final res = await apiProvider.updateLightScreenTimeConfig(
|
||||||
|
lockId, autoLightScreenTime);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置逗留警告
|
||||||
|
Future<VersionUndateEntity> updateStayWarnConfig(
|
||||||
|
{required int lockId, required int stayWarn}) async {
|
||||||
|
final res = await apiProvider.updateStayWarnConfig(lockId, stayWarn);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置异常警告
|
||||||
|
Future<VersionUndateEntity> updateAbnormalWarnConfig(
|
||||||
|
{required int lockId, required int abnormalWarn}) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn);
|
||||||
|
return VersionUndateEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,9 +17,7 @@ class CallTalk {
|
|||||||
static int ABUF_NUM = 100;
|
static int ABUF_NUM = 100;
|
||||||
static int FIRSTINDEX = 1;
|
static int FIRSTINDEX = 1;
|
||||||
|
|
||||||
int status = 0; // 假设有这个成员变量
|
|
||||||
IframeInfo? iframe; // 假设有这个成员变量
|
IframeInfo? iframe; // 假设有这个成员变量
|
||||||
bool getFirstFrame = false; //是否得到了第一帧
|
|
||||||
List<int> allDataBytes = <int>[]; //音频数据
|
List<int> allDataBytes = <int>[]; //音频数据
|
||||||
|
|
||||||
CallTalk._init() {
|
CallTalk._init() {
|
||||||
@ -73,12 +71,7 @@ class CallTalk {
|
|||||||
// print('获取帧序号 getIframeIndex:$getIframeIndex');
|
// print('获取帧序号 getIframeIndex:$getIframeIndex');
|
||||||
|
|
||||||
// 获取帧长度 65
|
// 获取帧长度 65
|
||||||
// int alen = bb[POS_alen] & 0xff;
|
int alen = bb[POS_alen] + bb[POS_alen + 1] * 256;
|
||||||
// var alenList = bb.sublist(POS_alen, POS_alen + 4);
|
|
||||||
// int alen = ((0xff & alenList[(0)]) << 24 |
|
|
||||||
// (0xff & alenList[1]) << 16 |
|
|
||||||
// (0xff & alenList[2]) << 8 |
|
|
||||||
// (0xFF & alenList[3]));
|
|
||||||
// print('获取帧长度 alen:$alen');
|
// print('获取帧长度 alen:$alen');
|
||||||
|
|
||||||
// 当前包号 71
|
// 当前包号 71
|
||||||
@ -96,7 +89,7 @@ class CallTalk {
|
|||||||
iframe = IframeInfo();
|
iframe = IframeInfo();
|
||||||
iframe!.iframeIndex = getIframeIndex;
|
iframe!.iframeIndex = getIframeIndex;
|
||||||
iframe!.bagNum = getBagNum;
|
iframe!.bagNum = getBagNum;
|
||||||
// iframe!.cur_len = alen;
|
iframe!.cur_len = alen;
|
||||||
iframe!.bb = [];
|
iframe!.bb = [];
|
||||||
// growableList = iframe!.bb!.toList(growable: true);
|
// growableList = iframe!.bb!.toList(growable: true);
|
||||||
}
|
}
|
||||||
@ -105,15 +98,19 @@ class CallTalk {
|
|||||||
|
|
||||||
// 如果是同一帧就添加起来
|
// 如果是同一帧就添加起来
|
||||||
if (getIframeIndex == iframe!.iframeIndex) {
|
if (getIframeIndex == iframe!.iframeIndex) {
|
||||||
var getList = bb.sublist(77, bb.length);
|
var getList = bb.sublist(POS_data, bb.length);
|
||||||
iframe!.bb!.addAll(getList);
|
iframe!.bb!.addAll(getList);
|
||||||
}
|
}
|
||||||
// print('iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
// print(
|
||||||
|
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
|
||||||
|
|
||||||
// 如果收到的包数等于总包数,说明这一帧数据已经接收完毕
|
// 如果收到的包数等于总包数,说明这一帧数据已经接收完毕
|
||||||
if (iframe!.bagNum == iframe!.bagReceive) {
|
if (iframe!.bagNum == iframe!.bagReceive) {
|
||||||
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
|
||||||
|
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
|
||||||
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
|
||||||
|
} else {
|
||||||
|
// print('接收到的包数不等于总包数');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
class IframeInfo {
|
class IframeInfo {
|
||||||
int iframeIndex = -1;
|
int iframeIndex = 0;
|
||||||
int iframeTime = 0;
|
int iframeTime = 0;
|
||||||
int bagNum = 0;
|
int bagNum = 0;
|
||||||
int bagReceive = 1;
|
int bagReceive = 1;
|
||||||
@ -12,7 +10,7 @@ class IframeInfo {
|
|||||||
int codecMode = 0;
|
int codecMode = 0;
|
||||||
|
|
||||||
IframeInfo() {
|
IframeInfo() {
|
||||||
iframeIndex = -1;
|
iframeIndex = 0;
|
||||||
bagNum = 0;
|
bagNum = 0;
|
||||||
bagReceive = 0;
|
bagReceive = 0;
|
||||||
isFull = false;
|
isFull = false;
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
|
||||||
import 'package:star_lock/talk/udp/udp_manage.dart';
|
import 'package:star_lock/talk/udp/udp_manage.dart';
|
||||||
|
|
||||||
import '../../blue/io_tool/io_tool.dart';
|
import '../../blue/io_tool/io_tool.dart';
|
||||||
@ -33,7 +35,7 @@ class CommandUDPReciverManager {
|
|||||||
// print("心跳包反馈 在线状态");
|
// print("心跳包反馈 在线状态");
|
||||||
} else if (data[7] == 3) {
|
} else if (data[7] == 3) {
|
||||||
// [Toast.show(msg: "您已在其他设备登录")];
|
// [Toast.show(msg: "您已在其他设备登录")];
|
||||||
EasyLoading.showToast("您已在其他设备登录",duration: 2000.milliseconds);
|
EasyLoading.showToast("您已在其他设备登录", duration: 2000.milliseconds);
|
||||||
}
|
}
|
||||||
} else if (data[6] == 150) {
|
} else if (data[6] == 150) {
|
||||||
// if( [Pub getApp].isBack){
|
// if( [Pub getApp].isBack){
|
||||||
@ -66,6 +68,7 @@ class CommandUDPReciverManager {
|
|||||||
// 停止声音
|
// 停止声音
|
||||||
UDPTalkClass().stopLocalAudio();
|
UDPTalkClass().stopLocalAudio();
|
||||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||||
|
print('接听反馈刷新UI1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -95,7 +98,7 @@ class CommandUDPReciverManager {
|
|||||||
print("appReceiveUDPData:$data");
|
print("appReceiveUDPData:$data");
|
||||||
if ((data[7] & 0x3) == 2) {
|
if ((data[7] & 0x3) == 2) {
|
||||||
print("开门成功");
|
print("开门成功");
|
||||||
EasyLoading.showToast("开门成功",duration: 2000.milliseconds);
|
EasyLoading.showToast("开门成功", duration: 2000.milliseconds);
|
||||||
} else {
|
} else {
|
||||||
print("开门失败");
|
print("开门失败");
|
||||||
}
|
}
|
||||||
@ -117,6 +120,7 @@ class CommandUDPReciverManager {
|
|||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||||
Get.back();
|
Get.back();
|
||||||
|
print('挂断反馈刷新UI1');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 140:
|
case 140:
|
||||||
@ -187,10 +191,10 @@ class CommandUDPReciverManager {
|
|||||||
if ((data[7] & 0x3) == 2) {
|
if ((data[7] & 0x3) == 2) {
|
||||||
print("开门成功");
|
print("开门成功");
|
||||||
// Toast.show(msg: "开门成功");
|
// Toast.show(msg: "开门成功");
|
||||||
EasyLoading.showToast("开门成功",duration: 2000.milliseconds);
|
EasyLoading.showToast("开门成功", duration: 2000.milliseconds);
|
||||||
} else {
|
} else {
|
||||||
print("开门失败");
|
print("开门失败");
|
||||||
EasyLoading.showToast("开门失败",duration: 2000.milliseconds);
|
EasyLoading.showToast("开门失败", duration: 2000.milliseconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
import 'package:fast_gbk/fast_gbk.dart';
|
import 'package:fast_gbk/fast_gbk.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../tools/storage.dart';
|
import '../../tools/storage.dart';
|
||||||
@ -27,7 +29,11 @@ class UDPTalkClass {
|
|||||||
late Timer timer;
|
late Timer timer;
|
||||||
// 该字段是为了判断是否跳转到接听界面 挂断或者退出接听界面要记得变更状态
|
// 该字段是为了判断是否跳转到接听界面 挂断或者退出接听界面要记得变更状态
|
||||||
var isBeCall = false;
|
var isBeCall = false;
|
||||||
|
var isEndCall = false; //是否已经调用结束对讲
|
||||||
final audioPlayer = AudioPlayer();
|
final audioPlayer = AudioPlayer();
|
||||||
|
var playLocalAudioSecond = 0;
|
||||||
|
Timer playLocalAudioTimer =
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (timer) {});
|
||||||
|
|
||||||
beCallW({List<int>? data, String? ip, int? port}) async {
|
beCallW({List<int>? data, String? ip, int? port}) async {
|
||||||
print("beCall status:$status");
|
print("beCall status:$status");
|
||||||
@ -70,17 +76,46 @@ class UDPTalkClass {
|
|||||||
|
|
||||||
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
||||||
}
|
}
|
||||||
Timer(const Duration(minutes: 1), () {
|
|
||||||
stopLocalAudio();
|
|
||||||
callNoAnswer();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
|
FlutterLocalNotificationsPlugin();
|
||||||
|
_showNotification(flutterLocalNotificationsPlugin);
|
||||||
playLocalAudio();
|
playLocalAudio();
|
||||||
|
|
||||||
|
if (isEndCall == true) {
|
||||||
|
print('已经结束对讲');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
playLocalAudioSecond++;
|
||||||
|
// 检查条件,如果达到60秒且未得到应答,则认为失败
|
||||||
|
if (playLocalAudioSecond >= 60) {
|
||||||
|
playLocalAudioTimer.cancel(); // 取消定时器
|
||||||
|
LockMonitoringLogic().initiateUdpHangUpAction();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 忙
|
// 忙
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发送本地通知
|
||||||
|
Future<void> _showNotification(
|
||||||
|
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin) async {
|
||||||
|
const AndroidNotificationDetails androidPlatformChannelSpecifics =
|
||||||
|
AndroidNotificationDetails('1', 'flutter_channel',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.high,
|
||||||
|
playSound: true,
|
||||||
|
ticker: 'ticker');
|
||||||
|
const NotificationDetails platformChannelSpecifics =
|
||||||
|
NotificationDetails(android: androidPlatformChannelSpecifics);
|
||||||
|
var getLockName = await Storage.getString(saveLockAlias);
|
||||||
|
await flutterLocalNotificationsPlugin.show(
|
||||||
|
0, '呼叫提醒', '收到来自($getLockName)锁的呼叫。', platformChannelSpecifics,
|
||||||
|
payload: 'item x');
|
||||||
|
}
|
||||||
|
|
||||||
// 判断是否是call的本人
|
// 判断是否是call的本人
|
||||||
Future<bool> isCallMe(List<int>? data) async {
|
Future<bool> isCallMe(List<int>? data) async {
|
||||||
final loginData = await Storage.getLoginData();
|
final loginData = await Storage.getLoginData();
|
||||||
@ -136,10 +171,13 @@ class UDPTalkClass {
|
|||||||
|
|
||||||
//呼叫有响铃无应答处理
|
//呼叫有响铃无应答处理
|
||||||
void callNoAnswer() {
|
void callNoAnswer() {
|
||||||
|
// print('无应答处理');
|
||||||
|
stopLocalAudio();
|
||||||
|
status = 0;
|
||||||
|
isBeCall = false;
|
||||||
|
isEndCall = true;
|
||||||
|
LockMonitoringState().isClickHangUp.value = false;
|
||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
// 挂断
|
|
||||||
LockMonitoringLogic().udpHangUpAction();
|
|
||||||
// 关闭当前界面
|
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import 'dart:convert';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../login/login/entity/LoginData.dart';
|
import '../login/login/entity/LoginData.dart';
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
|
||||||
|
|
||||||
const saveBluePublicKey = "BluePublicKey";
|
const saveBluePublicKey = "BluePublicKey";
|
||||||
const saveBluePrivateKey = "BluePrivateKey";
|
const saveBluePrivateKey = "BluePrivateKey";
|
||||||
@ -20,6 +19,7 @@ const isAgreePosition = "isAgreePosition"; //是否同意获取位置弹窗
|
|||||||
const isAgreeCamera = "isAgreeCamera"; //是否同意获取相机/相册弹窗
|
const isAgreeCamera = "isAgreeCamera"; //是否同意获取相机/相册弹窗
|
||||||
|
|
||||||
const isShowUpdateVersion = "isShowUpdateVersion"; //是否更新弹窗
|
const isShowUpdateVersion = "isShowUpdateVersion"; //是否更新弹窗
|
||||||
|
const saveLockAlias = "saveLockAlias"; //锁别名
|
||||||
|
|
||||||
const saveUserLoginData = "userLoginData";
|
const saveUserLoginData = "userLoginData";
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class XSJPushProvider {
|
|||||||
appKey: "7ff37d174c1a568a89e98dad",
|
appKey: "7ff37d174c1a568a89e98dad",
|
||||||
channel: "flutter_channel",
|
channel: "flutter_channel",
|
||||||
production: false,
|
production: false,
|
||||||
debug: true,
|
debug: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
jpush.addEventHandler(
|
jpush.addEventHandler(
|
||||||
|
|||||||
@ -22,7 +22,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.18+2024032002:修复注册页布局错乱;修复第二次才可以删除锁的问题;修改申请权限字符串
|
# 1.0.18+2024032002:修复注册页布局错乱;修复第二次才可以删除锁的问题;修改申请权限字符串
|
||||||
# 1.0.18+20240321(2024032101):打包给欧阳测试
|
# 1.0.18+20240321(2024032101):打包给欧阳测试
|
||||||
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
# 1.0.20+2024032102:修复Apple Store App Tracking Transparency权限问题
|
||||||
version: 1.0.20+2024032102
|
# 1.0.21+2024032801:同为斯凯环境也区分删减版和完整版,通过main_sky_lite.dart/main_sky_full.dart切换
|
||||||
|
version: 1.0.21+2024032801
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user