# Conflicts:
#	star_lock/lib/network/api_provider.dart
This commit is contained in:
魏少阳 2024-03-28 13:50:23 +08:00
commit 186f92cbe1
35 changed files with 761 additions and 279 deletions

45
star_lock/VERSION.md Normal file
View 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`是版本号。

View File

@ -143,7 +143,12 @@ android {
// NDK配置使flutter run .apk包
ndk {
//SO库架构so
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// 2023164
// 32flutter或者说我们的项目本来就兼容不了老平台
abiFilters "arm64-v8a"
}
manifestPlaceholders = [
@ -161,10 +166,11 @@ android {
abi {
enable true
reset()
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a
include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
universalApk true
// 2023164
// 32flutter或者说我们的项目本来就兼容不了老平台
// include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// include "arm64-v8a"
universalApk false
}
}
}

View File

@ -29,6 +29,7 @@
<!--允许麦克风权限,用于录音发送-->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<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.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
@ -37,6 +38,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="1"/> <!-- 将您的通知渠道ID替换为您的实际ID -->
<!-- 配置定位Service -->
<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">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -26,16 +26,16 @@ class XSConstantMacro {
// "110412"
// "110408"
// "110410"
static int keyStatusNormalUse = 110401; // 使
static int keyStatusWaitReceive = 110402; //
static int keyStatusNormalUse = 110401; // 使
static int keyStatusWaitReceive = 110402; //
static int keyStatusWaitIneffective = 110403; //
static int keyStatusFrozen = 110405; //
static int keyStatusExpired = 110412; //
static int keyStatusDeleted = 110408; //
static int keyStatusReset = 110410; //
static int keyStatusFrozen = 110405; //
static int keyStatusExpired = 110412; //
static int keyStatusDeleted = 110408; //
static int keyStatusReset = 110410; //
static String getKeyStatusStr(int keyStatus){
switch(keyStatus){
static String getKeyStatusStr(int keyStatus) {
switch (keyStatus) {
case 110401:
// 使
return "";
@ -55,10 +55,17 @@ class XSConstantMacro {
return "未知";
}
}
// lockEventType 0-10-20-30-40-
static int lockEventTypeAll = 0;
static int lockEventTypeOpenDoor = 10;
static int lockEventTypeAbnormal = 20;
static int lockEventTypeDoorbell = 30;
static int lockEventTypeVideo = 40;
//
static int catEyeWorkModePowerSaving = 1; //
static int catEyeWorkModeStayCapture = 2; //
static int catEyeWorkModeRealTimeMonitoring = 3; //
static int catEyeWorkModeCustom = 4; //
}

View File

@ -16,6 +16,8 @@ class StarLockAMapKey {
class F {
static Flavor? appFlavor;
// ()
static bool isLite = false;
static String get name => appFlavor?.name ?? '';

View File

@ -207,8 +207,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: SizedBox(
width: 10.sp,
)),
// Google暂时屏蔽
F.appFlavor == Flavor.sky
F.isLite
? Container()
: GestureDetector(
child: SizedBox(

View File

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.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/translations/trans_lib.dart';
import 'app.dart';
@ -17,6 +18,8 @@ FutureOr<void> main() async {
//
await _initTranslation();
initLocalNotification();
runApp(MyApp());
if (AppPlatform.isAndroid) {
@ -37,7 +40,7 @@ Future _initTranslation() async => TranslationLoader.loadTranslation(
Future _setCommonServices() async {
await Get.putAsync(() => StoreService().init());
await Get.putAsync(() => PlatformInfoService().init());
if (F.appFlavor == Flavor.sky) {
if (F.isLite) {
//
// await Get.putAsync(() => DeviceInfoService().init());
} else {
@ -45,3 +48,14 @@ Future _setCommonServices() async {
}
// 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);
}

View File

@ -744,6 +744,7 @@ class LockDetailLogic extends BaseGetXController {
// 3
state.lockAlias.value = event.setResult;
state.keyInfos.value.lockAlias = event.setResult;
Storage.setString(saveLockAlias, state.lockAlias.value);
} else if (event.type == 4) {
// 4
state.electricQuantity.value = int.parse(event.setResult);

View File

@ -109,6 +109,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
state.lockAlias.value = state.keyInfos.value.lockAlias!;
Storage.setString(saveLockAlias, state.lockAlias.value);
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
@ -178,7 +179,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(
height: 10.h,
),
buildPageIndicator(),
Obx(() => buildPageIndicator()),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
@ -992,7 +993,8 @@ class _LockDetailPageState extends State<LockDetailPage>
state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel();
state.replySubscription.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!
.cancel();
if (state.animationController != null) {
state.animationController!.dispose();

View File

@ -1,7 +1,53 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'catEyeSet_state.dart';
class CatEyeSetLogic extends BaseGetXController {
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('设置成功');
}
}
}

View File

@ -33,12 +33,18 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
children: [
CommonItem(
leftTitel: '猫眼工作模式',
rightTitle: "",
rightTitle: state.selectCatEyeWorkMode.value,
allHeight: 70.h,
isHaveLine: true,
isHaveDirection: true,
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(
leftTitel: '自动亮屏',
@ -94,15 +100,26 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
onChanged: (value) {
switch (clickIndex) {
case 1: //
state.isAutoBright.value = value;
{
state.isAutoBright.value = value;
logic.updateAutoLightScreenConfig();
}
break;
case 2: //
state.isStayWarning.value = value;
{
state.isStayWarning.value = value;
logic.updateStayWarnConfig();
}
break;
case 3: //
state.isExceptionWarning.value = value;
{
state.isExceptionWarning.value = value;
logic.updateAbnormalWarnConfig();
}
break;
default:
print('clickIndex is not match');
break;
}
},
);
@ -120,6 +137,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
chooseCallback: (value) {
state.selectBrightDuration.value =
state.brightDurationTimeList[value];
logic.updateLightScreenTimeConfig();
},
);
});

View File

@ -1,4 +1,5 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeSetState {
var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs;
@ -6,4 +7,11 @@ class CatEyeSetState {
var isAutoBright = false.obs; //
var isStayWarning = false.obs; //
var isExceptionWarning = false.obs; //
var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = ''.obs; //
CatEyeSetState() {
Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

@ -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('设置成功');
}
}
}

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 '../../../../../tools/titleAppBar.dart';
@ -14,8 +16,8 @@ class CatEyeWorkModePage extends StatefulWidget {
}
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
bool isCheck = false;
List boolList = [true, false, false, false];
final logic = Get.put(CatEyeWorkModeLogic());
final state = Get.find<CatEyeWorkModeLogic>().state;
@override
Widget build(BuildContext context) {
@ -30,44 +32,34 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
SizedBox(
height: 30.h,
),
_buildTipsView(
'省电模式:\n',
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月',
0,
boolList[0]),
_buildTipsView('省电模式:\n',
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0),
SizedBox(
height: 30.h,
),
_buildTipsView('逗留抓拍模式:\n',
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1),
SizedBox(
height: 30.h,
),
_buildTipsView('实时监控模式:\n',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。', 2),
SizedBox(
height: 30.h,
),
_buildTipsView(
'逗留抓拍模式:\n',
'有人逗留或发生特定事件才录像,可随时查看\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])
'自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)
],
));
}
Widget _buildTipsView(
String titleStr, String subTitle, int clickIndex, bool isClick) {
Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
return GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration(
color: isClick
color: state.boolList.value[clickIndex]
? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor,
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),
child: Row(
children: [
isClick
state.boolList.value[clickIndex]
? Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
@ -89,7 +81,8 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
),
SizedBox(width: 10.w),
Expanded(
child: _buildRichText(titleStr, subTitle, isClick),
child: _buildRichText(
titleStr, subTitle, state.boolList.value[clickIndex]),
),
SizedBox(
width: 10.w,
@ -128,11 +121,30 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
),
onTap: () {
setState(() {
for (int i = 0; i < boolList.length; i++) {
for (int i = 0; i < state.boolList.value.length; 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 {
boolList[i] = false;
state.boolList.value[i] = false;
}
}
});

View File

@ -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"];
}
}

View File

@ -299,7 +299,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
//
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false,
// visible: true,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
@ -380,7 +380,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage);
Get.toNamed(Routers.catEyeSetPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// Obx(() =>
//

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math';
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:permission_handler/permission_handler.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/udp/udp_manage.dart';
@ -33,7 +33,7 @@ class LockMonitoringLogic extends BaseGetXController {
//
Uint8List imageData = Uint8List.fromList(event.tvList);
//
state.listData.value = imageData;
state.listPhotoData.value = imageData;
}
});
}
@ -42,40 +42,59 @@ class LockMonitoringLogic extends BaseGetXController {
StreamSubscription? _getUDPStatusRefreshUIEvent;
void _getUDPStatusRefreshUIAction() {
_getUDPStatusRefreshUIEvent =
eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
eventBus.on<GetUDPStatusRefreshUI>().listen((event) async {
state.udpStatus.value = event.udpStatus;
if (state.udpStatus.value == 8) {
// 60
state.oneMinuteTimeTimer =
Timer.periodic(const Duration(seconds: 1), (Timer t) async {
state.oneMinuteTime.value++;
// Get.log('state.oneMinuteTime.value:${state.oneMinuteTime.value}');
if (state.oneMinuteTime.value >= 60) {
// 60
state.oneMinuteTimeTimer.cancel();
state.oneMinuteTime.value = 0;
//
UDPSenderManage.sendMainProtocol(
command: 150,
commandTypeIsCalling: 1,
subCommand: 30,
lockID: UDPManage().lockId,
lockIP: UDPManage().host,
userMobile: await state.userUid,
userMobileIP: await state.userMobileIP,
endData: []);
state.oneMinuteTime.value = 0;
CallTalk().stopPcmSound();
//
Get.back();
// 退
if (state.udpStatus.value == 0 && UDPTalkClass().isEndCall == true) {
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 {
print('点了接听么');
UDPSenderManage.sendMainProtocol(
command: 150,
commandTypeIsCalling: 1,
@ -87,6 +106,27 @@ class LockMonitoringLogic extends BaseGetXController {
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 {
UDPSenderManage.sendMainProtocol(
@ -100,6 +140,20 @@ class LockMonitoringLogic extends BaseGetXController {
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 {
UDPSenderManage.sendMainProtocol(
@ -406,6 +460,6 @@ class LockMonitoringLogic extends BaseGetXController {
state.oneMinuteTimeTimer.cancel();
}
stopProcessing();
state.listData.value = Uint8List(0);
state.listPhotoData.value = Uint8List(0);
}
}

View File

@ -1,8 +1,11 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 '../../../../login/selectCountryRegion/common/index.dart';
@ -23,8 +26,11 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
@override
void initState() {
super.initState();
initAsync();
}
requestMicrophonePermission();
Future<void> initAsync() async {
await requestMicrophonePermission();
}
@override
@ -34,16 +40,23 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
height: 1.sh,
child: Stack(
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,
)),
Obx(() {
if (state.listPhotoData.value.isEmpty ||
state.listPhotoData.value.length < 10) {
return Container(color: Colors.transparent);
} else {
return Image.memory(
state.listPhotoData.value,
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(color: Colors.transparent);
},
);
}
}),
Positioned(
top: ScreenUtil().statusBarHeight + 30.h,
width: 1.sw,
@ -163,8 +176,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
//
Obx(() => bottomBtnItemWidget(
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
logic.udpAnswerAction();
state.isClickAnswer.value == true
? '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: () {
//
print("onLongPress");
@ -186,7 +206,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
logic.stopProcessing();
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",
"开锁", AppColors.mainColor, () {
@ -298,7 +326,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
}
// state.isSenderAudioData.value = false;
print("发送接听了");
// print("发送接听了");
//
});
}

View File

@ -10,16 +10,17 @@ import '../../../../tools/storage.dart';
class LockMonitoringState {
var isOpenVoice = false.obs;
var udpSendDataFrameNumber = 0;//
var udpSendDataFrameNumber = 0; //
// var isSenderAudioData = false.obs;//
var userMobileIP = NetworkInfo().getWifiIP();
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 listData = Uint8List(0).obs; //
var listPhotoData = Uint8List(0).obs; //
var listAudioData = <int>[].obs; //
late final VoiceProcessor? voiceProcessor;
@ -29,7 +30,14 @@ class LockMonitoringState {
var oneMinuteTime = 0.obs; //
// 10
late Timer answerTimer;
late Timer hangUpTimer;
late Timer openDoorTimer;
late Timer answerTimer = Timer(const Duration(seconds: 1), () {}); //
var answerSeconds = 0.obs;
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;
}

View File

@ -215,8 +215,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
SizedBox(
height: 160.h,
),
// Google暂时屏蔽
F.appFlavor == Flavor.sky
F.isLite
? Container()
: SubmitBtn(
btnName: '演示模式',

View 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();
}

View File

@ -146,14 +146,14 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
Get.toNamed(Routers.mineSetPage);
}),
//
F.appFlavor == Flavor.sky
F.isLite
? Container()
: mineItem('images/mine/icon_mine_main_vip.png',
TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
Get.back();
Get.toNamed(Routers.valueAddedServicesPage);
}),
F.appFlavor == Flavor.sky
F.isLite
? Container()
: mineItem(
'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () {

View File

@ -204,7 +204,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 10.h,
),
//
F.appFlavor == Flavor.sky
F.isLite
? Container()
: CommonItem(
leftTitel: "Amazon Alexa",
@ -214,7 +214,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () {
logic.showToast("功能暂未开放");
}),
F.appFlavor == Flavor.sky
F.isLite
? Container()
: CommonItem(
leftTitel: "Google Home",
@ -224,7 +224,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () {
logic.showToast("功能暂未开放");
}),
F.appFlavor == Flavor.sky
F.isLite
? Container()
: CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,

View File

@ -180,4 +180,7 @@ abstract class Api {
final String deletMessageURL = '/notifications/delete'; //
final String getVersionURL = '/app/getVersion'; //
final String updateCatEyeConfigURL =
'/lockSetting/updateCatEyeConfig'; //
}

View File

@ -204,8 +204,17 @@ class ApiProvider extends BaseProvider {
'operatorUid': operatorUid,
}));
Future<Response> updateKeyDate(String keyId, String lockId, String endDate,
String startDate, List weekDays, int keyType, int startTime, int endTime, int isOnlyManageSelf, int remoteEnable) =>
Future<Response> updateKeyDate(
String keyId,
String lockId,
String endDate,
String startDate,
List weekDays,
int keyType,
int startTime,
int endTime,
int isOnlyManageSelf,
int remoteEnable) =>
post(
updateKeyDateURL.toUrl,
jsonEncode({
@ -226,22 +235,20 @@ class ApiProvider extends BaseProvider {
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
Future<Response> lockRecordList(
{
required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String recordType,
required String searchStr,
required String timezoneRawOffSet,
required String keyboardPwdId,
required String cardId,
required String fingerprintId
}) =>
{required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String recordType,
required String searchStr,
required String timezoneRawOffSet,
required String keyboardPwdId,
required String cardId,
required String fingerprintId}) =>
post(
keyOperationRecordURL.toUrl,
jsonEncode({
@ -364,9 +371,15 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> deletOwnerKeyInfo(String lockId, String keyId, int includeUnderlings) => post(
deleteElectronicKeyURL.toUrl,
jsonEncode({'lockId': lockId, 'keyId': keyId, 'includeUnderlings': includeUnderlings}));
Future<Response> deletOwnerKeyInfo(
String lockId, String keyId, int includeUnderlings) =>
post(
deleteElectronicKeyURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyId': keyId,
'includeUnderlings': includeUnderlings
}));
//
Future<Response> checkLoginPassword(String password) => post(
@ -515,7 +528,8 @@ class ApiProvider extends BaseProvider {
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
post(deleteElectronicKeyURL.toUrl,
post(
deleteElectronicKeyURL.toUrl,
jsonEncode({
'keyId': keyId,
'includeUnderlings': includeUnderlings,
@ -538,40 +552,39 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> setAdministrator(String keyId) =>
post(setAuthorizeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
Future<Response> setAdministrator(String keyId) => post(
setAuthorizeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
//
Future<Response> cancelAdministrator(String keyId) =>
post(cancelAuthorizeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
Future<Response> cancelAdministrator(String keyId) => post(
cancelAuthorizeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
//
Future<Response> freezeKey(String keyId) =>
post(freezeKeyURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
Future<Response> freezeKey(String keyId) => post(
freezeKeyURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
//
Future<Response> cancelFreeze(String keyId) =>
post(cancelFreezeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
Future<Response> cancelFreeze(String keyId) => post(
cancelFreezeURL.toUrl,
jsonEncode({
'keyId': keyId,
}));
Future<Response> expireLockList(String pageNo, String pageSize) =>
post(
expireLockListURL.toUrl,
jsonEncode({
'pageNo': pageNo,
'pageSize': pageSize,
}));
Future<Response> expireLockList(String pageNo, String pageSize) => post(
expireLockListURL.toUrl,
jsonEncode({
'pageNo': pageNo,
'pageSize': pageSize,
}));
Future<Response> deleteKeyboardPwd(
String lockId, String keyboardPwdId, int deleteType) =>
@ -1009,9 +1022,9 @@ class ApiProvider extends BaseProvider {
String isCoerced,
String startDate,
List weekDay,
int fingerRight,
int startTime,
int endTime,
int fingerRight,
int startTime,
int endTime,
) =>
post(
addFingerprintURL.toUrl,
@ -1040,9 +1053,9 @@ class ApiProvider extends BaseProvider {
String isCoerced,
String fingerprintName,
String changeType,
int startTime,
int endTime,
int fingerprintType) =>
int startTime,
int endTime,
int fingerprintType) =>
post(
editFingerprintURL.toUrl,
jsonEncode({
@ -1202,9 +1215,9 @@ class ApiProvider extends BaseProvider {
String startDate,
String isCoerced,
List weekDay,
int startTime,
int endTime,
int cardRight,
int startTime,
int endTime,
int cardRight,
) =>
post(
addICCardURL.toUrl,
@ -1225,17 +1238,18 @@ class ApiProvider extends BaseProvider {
// ICCard
Future<Response> editICCardData(
String lockId,
String cardId,
String cardName,
String startDate,
String endDate,
String isCoerced,
List weekDay,
String changeType,
int startTime,
int endTime,
int cardType,) =>
String lockId,
String cardId,
String cardName,
String startDate,
String endDate,
String isCoerced,
List weekDay,
String changeType,
int startTime,
int endTime,
int cardType,
) =>
post(
editICCardURL.toUrl,
jsonEncode({
@ -1606,12 +1620,58 @@ class ApiProvider extends BaseProvider {
}));
//
Future<Response> getVersionData(String brandName, String currentVersion) => post(
getVersionURL.toUrl,
Future<Response> getVersionData(String brandName, String currentVersion) =>
post(
getVersionURL.toUrl,
jsonEncode({
'brandName': brandName,
'currentVersion': currentVersion,
}));
//
Future<Response> updateCatEyeModeConfig(int lockId, Map catEyeConfig) => post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'brandName': brandName,
'currentVersion': currentVersion,
'lockId': lockId,
'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 {

View File

@ -193,37 +193,35 @@ class ApiRepository {
//-
Future<KeyOperationRecordEntity> lockRecordList(
{
required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String recordType,
required String searchStr,
required String timezoneRawOffSet,
required String keyboardPwdId,
required String cardId,
required String fingerprintId
}) async {
{required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String recordType,
required String searchStr,
required String timezoneRawOffSet,
required String keyboardPwdId,
required String cardId,
required String fingerprintId}) async {
final res = await apiProvider.lockRecordList(
endDate:endDate,
keyId:keyId,
keyStatus:keyStatus,
lockId:lockId,
operatorUid:operatorUid,
pageNo:pageNo,
pageSize:pageSize,
startDate:startDate,
recordType:recordType,
searchStr:searchStr,
timezoneRawOffSet:timezoneRawOffSet,
keyboardPwdId:keyboardPwdId,
cardId:cardId,
fingerprintId:fingerprintId);
endDate: endDate,
keyId: keyId,
keyStatus: keyStatus,
lockId: lockId,
operatorUid: operatorUid,
pageNo: pageNo,
pageSize: pageSize,
startDate: startDate,
recordType: recordType,
searchStr: searchStr,
timezoneRawOffSet: timezoneRawOffSet,
keyboardPwdId: keyboardPwdId,
cardId: cardId,
fingerprintId: fingerprintId);
return KeyOperationRecordEntity.fromJson(res.body);
}
@ -397,8 +395,11 @@ class ApiRepository {
//
Future<LockListInfoEntity> deletOwnerKeyData(
{required String lockId, required String keyId, required int includeUnderlings}) async {
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings);
{required String lockId,
required String keyId,
required int includeUnderlings}) async {
final res =
await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings);
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);
return ExpireLockListEntity.fromJson(res.body);
}
@ -1191,18 +1193,28 @@ class ApiRepository {
//
Future<LoginEntity> editFingerprintsData(
{required String fingerprintId,
required String lockId,
required List weekDay,
required String startDate,
required String endDate,
required String isCoerced,
required String fingerprintName,
required String changeType,
required int startTime,
required int endTime,
required int fingerprintType}) async {
final res = await apiProvider.editFingerprintsData(fingerprintId, lockId,
weekDay, startDate, endDate, isCoerced, fingerprintName, changeType, startTime, endTime, fingerprintType);
required String lockId,
required List weekDay,
required String startDate,
required String endDate,
required String isCoerced,
required String fingerprintName,
required String changeType,
required int startTime,
required int endTime,
required int fingerprintType}) async {
final res = await apiProvider.editFingerprintsData(
fingerprintId,
lockId,
weekDay,
startDate,
endDate,
isCoerced,
fingerprintName,
changeType,
startTime,
endTime,
fingerprintType);
return LoginEntity.fromJson(res.body);
}
@ -1359,26 +1371,48 @@ class ApiRepository {
required int endTime,
required int cardRight,
}) async {
final res = await apiProvider.addICCardData(lockId, endDate, cardName,
cardNumber, cardType, addType, startDate, isCoerced, weekDay, startTime, endTime, cardRight);
final res = await apiProvider.addICCardData(
lockId,
endDate,
cardName,
cardNumber,
cardType,
addType,
startDate,
isCoerced,
weekDay,
startTime,
endTime,
cardRight);
return AddICCardEntity.fromJson(res.body);
}
// IC卡
Future<LoginEntity> editICCardData(
{required String lockId,
required String cardId,
required String cardName,
required String startDate,
required String endDate,
required String isCoerced,
required List weekDay,
required String changeType,
required int startTime,
required int endTime,
required int cardType,}) async {
final res = await apiProvider.editICCardData(lockId, cardId, cardName,
startDate, endDate, isCoerced, weekDay, changeType, startTime, endTime, cardType);
Future<LoginEntity> editICCardData({
required String lockId,
required String cardId,
required String cardName,
required String startDate,
required String endDate,
required String isCoerced,
required List weekDay,
required String changeType,
required int startTime,
required int endTime,
required int cardType,
}) async {
final res = await apiProvider.editICCardData(
lockId,
cardId,
cardName,
startDate,
endDate,
isCoerced,
weekDay,
changeType,
startTime,
endTime,
cardType);
return LoginEntity.fromJson(res.body);
}
@ -1629,11 +1663,47 @@ class ApiRepository {
}
//
Future<VersionUndateEntity> getVersionData({
required String brandName,
required String currentVersion
}) async {
Future<VersionUndateEntity> getVersionData(
{required String brandName, required String currentVersion}) async {
final res = await apiProvider.getVersionData(brandName, currentVersion);
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);
}
}

View File

@ -17,9 +17,7 @@ class CallTalk {
static int ABUF_NUM = 100;
static int FIRSTINDEX = 1;
int status = 0; //
IframeInfo? iframe; //
bool getFirstFrame = false; //
List<int> allDataBytes = <int>[]; //
CallTalk._init() {
@ -73,12 +71,7 @@ class CallTalk {
// print('获取帧序号 getIframeIndex$getIframeIndex');
// 65
// int alen = bb[POS_alen] & 0xff;
// 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]));
int alen = bb[POS_alen] + bb[POS_alen + 1] * 256;
// print('获取帧长度 alen$alen');
// 71
@ -96,7 +89,7 @@ class CallTalk {
iframe = IframeInfo();
iframe!.iframeIndex = getIframeIndex;
iframe!.bagNum = getBagNum;
// iframe!.cur_len = alen;
iframe!.cur_len = alen;
iframe!.bb = [];
// growableList = iframe!.bb!.toList(growable: true);
}
@ -105,15 +98,19 @@ class CallTalk {
//
if (getIframeIndex == iframe!.iframeIndex) {
var getList = bb.sublist(77, bb.length);
var getList = bb.sublist(POS_data, bb.length);
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) {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
} else {
// print('接收到的包数不等于总包数');
}
}
}

View File

@ -1,7 +1,5 @@
import 'dart:typed_data';
class IframeInfo {
int iframeIndex = -1;
int iframeIndex = 0;
int iframeTime = 0;
int bagNum = 0;
int bagReceive = 1;
@ -12,7 +10,7 @@ class IframeInfo {
int codecMode = 0;
IframeInfo() {
iframeIndex = -1;
iframeIndex = 0;
bagNum = 0;
bagReceive = 0;
isFull = false;

View File

@ -2,6 +2,8 @@ import 'dart:typed_data';
import 'package:flutter_easyloading/flutter_easyloading.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 '../../blue/io_tool/io_tool.dart';
@ -33,7 +35,7 @@ class CommandUDPReciverManager {
// print("心跳包反馈 在线状态");
} else if (data[7] == 3) {
// [Toast.show(msg: "您已在其他设备登录")];
EasyLoading.showToast("您已在其他设备登录",duration: 2000.milliseconds);
EasyLoading.showToast("您已在其他设备登录", duration: 2000.milliseconds);
}
} else if (data[6] == 150) {
// if( [Pub getApp].isBack){
@ -66,6 +68,7 @@ class CommandUDPReciverManager {
//
UDPTalkClass().stopLocalAudio();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
print('接听反馈刷新UI1');
}
}
break;
@ -95,7 +98,7 @@ class CommandUDPReciverManager {
print("appReceiveUDPData:$data");
if ((data[7] & 0x3) == 2) {
print("开门成功");
EasyLoading.showToast("开门成功",duration: 2000.milliseconds);
EasyLoading.showToast("开门成功", duration: 2000.milliseconds);
} else {
print("开门失败");
}
@ -117,6 +120,7 @@ class CommandUDPReciverManager {
CallTalk().stopPcmSound();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
Get.back();
print('挂断反馈刷新UI1');
}
break;
case 140:
@ -187,10 +191,10 @@ class CommandUDPReciverManager {
if ((data[7] & 0x3) == 2) {
print("开门成功");
// Toast.show(msg: "开门成功");
EasyLoading.showToast("开门成功",duration: 2000.milliseconds);
EasyLoading.showToast("开门成功", duration: 2000.milliseconds);
} else {
print("开门失败");
EasyLoading.showToast("开门失败",duration: 2000.milliseconds);
EasyLoading.showToast("开门失败", duration: 2000.milliseconds);
}
}
break;

View File

@ -1,8 +1,10 @@
import 'dart:async';
import 'package:audioplayers/audioplayers.dart';
import 'package:fast_gbk/fast_gbk.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.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/call/callTalk.dart';
import '../../appRouters.dart';
import '../../tools/storage.dart';
@ -27,7 +29,11 @@ class UDPTalkClass {
late Timer timer;
// 退
var isBeCall = false;
var isEndCall = false; //
final audioPlayer = AudioPlayer();
var playLocalAudioSecond = 0;
Timer playLocalAudioTimer =
Timer.periodic(const Duration(seconds: 1), (timer) {});
beCallW({List<int>? data, String? ip, int? port}) async {
print("beCall status:$status");
@ -70,17 +76,46 @@ class UDPTalkClass {
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
}
Timer(const Duration(minutes: 1), () {
stopLocalAudio();
callNoAnswer();
});
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
_showNotification(flutterLocalNotificationsPlugin);
playLocalAudio();
if (isEndCall == true) {
print('已经结束对讲');
return;
}
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
playLocalAudioSecond++;
// 60
if (playLocalAudioSecond >= 60) {
playLocalAudioTimer.cancel(); //
LockMonitoringLogic().initiateUdpHangUpAction();
}
});
} 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的本人
Future<bool> isCallMe(List<int>? data) async {
final loginData = await Storage.getLoginData();
@ -136,10 +171,13 @@ class UDPTalkClass {
//
void callNoAnswer() {
// print('无应答处理');
stopLocalAudio();
status = 0;
isBeCall = false;
isEndCall = true;
LockMonitoringState().isClickHangUp.value = false;
CallTalk().stopPcmSound();
//
LockMonitoringLogic().udpHangUpAction();
//
Get.back();
}
}

View File

@ -6,7 +6,6 @@ import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import '../login/login/entity/LoginData.dart';
import '../login/login/entity/LoginEntity.dart';
const saveBluePublicKey = "BluePublicKey";
const saveBluePrivateKey = "BluePrivateKey";
@ -20,6 +19,7 @@ const isAgreePosition = "isAgreePosition"; //是否同意获取位置弹窗
const isAgreeCamera = "isAgreeCamera"; ///
const isShowUpdateVersion = "isShowUpdateVersion"; //
const saveLockAlias = "saveLockAlias"; //
const saveUserLoginData = "userLoginData";

View File

@ -15,7 +15,7 @@ class XSJPushProvider {
appKey: "7ff37d174c1a568a89e98dad",
channel: "flutter_channel",
production: false,
debug: true,
debug: false,
);
jpush.addEventHandler(

View File

@ -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+20240321(2024032101):打包给欧阳测试
# 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:
sdk: '>=2.12.0 <3.0.0'