Merge branch 'develop_liyi' of code-internal.star-lock.cn:StarlockTeam/app-starlock into develop_liyi
This commit is contained in:
commit
d5ac3ebf3e
@ -35,7 +35,6 @@ abstract class SenderProtocol extends IOData {
|
|||||||
void printLog(List<int> data) {
|
void printLog(List<int> data) {
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
"App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
"App -> 锁,指令类型:${commandType!.typeName} ${commandType!.typeValue == 0x3030 ? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
||||||
AppLog.log("子命令数据是:${data.sublist(66, 79)}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拼装数据
|
// 拼装数据
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||||
|
import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.dart';
|
||||||
|
|
||||||
class LoginData {
|
class LoginData {
|
||||||
LoginData(
|
LoginData(
|
||||||
@ -63,4 +64,13 @@ class LoginData {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateStarchart(
|
||||||
|
StarChartRegisterNodeEntity starChartRegisterNodeEntity) {
|
||||||
|
starchart = Starchart(
|
||||||
|
starchartId: starChartRegisterNodeEntity.peer?.id,
|
||||||
|
starchartPeerPublicKey: starChartRegisterNodeEntity.peer?.publicKey,
|
||||||
|
starchartPeerPrivateKey: starChartRegisterNodeEntity.peer?.privateKey,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,17 +58,22 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
'login_res': '成功',
|
'login_res': '成功',
|
||||||
});
|
});
|
||||||
|
|
||||||
Storage.saveLoginData(entity.data);
|
|
||||||
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
|
||||||
//如已有星图配置则保存 无需重复注册节点及重复绑定
|
//如已有星图配置则保存 无需重复注册节点及重复绑定
|
||||||
if (entity.data!.starchart != null) {
|
if (entity.data!.starchart != null) {
|
||||||
final Starchart starChart = entity.data!.starchart!;
|
final Starchart starChart = entity.data!.starchart!;
|
||||||
Storage.saveStarChartRegisterNodeInfo(StarChartRegisterNodeEntity(
|
final StarChartRegisterNodeEntity starChartRegisterNodeEntity =
|
||||||
peer: PeerData(
|
StarChartRegisterNodeEntity(
|
||||||
id: starChart.starchartId,
|
peer: PeerData(
|
||||||
publicKey: starChart.starchartPeerPublicKey,
|
id: starChart.starchartId,
|
||||||
privateKey: starChart.starchartPeerPrivateKey)));
|
publicKey: starChart.starchartPeerPublicKey,
|
||||||
|
privateKey: starChart.starchartPeerPrivateKey,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
||||||
|
entity.data!.updateStarchart(starChartRegisterNodeEntity);
|
||||||
}
|
}
|
||||||
|
Storage.saveLoginData(entity.data);
|
||||||
|
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
||||||
eventBus.fire(MineInfoChangeRefreshUI());
|
eventBus.fire(MineInfoChangeRefreshUI());
|
||||||
if (Get.isRegistered<LockMainLogic>()) {
|
if (Get.isRegistered<LockMainLogic>()) {
|
||||||
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:star_lock/apm/apm_helper.dart';
|
|||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockDetail/device_network_info.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
import 'package:star_lock/talk/starChart/constant/talk_status.dart';
|
import 'package:star_lock/talk/starChart/constant/talk_status.dart';
|
||||||
@ -744,12 +745,40 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 请求设备网络信息并设置
|
||||||
|
void _requestDeviceNetworkInfo() async {
|
||||||
|
final DeviceNetwork deviceNetworkInfo =
|
||||||
|
await ApiRepository.to.getDeviceNetwork(
|
||||||
|
deviceType: 2,
|
||||||
|
deviceMac: state.keyInfos.value.mac!,
|
||||||
|
);
|
||||||
|
if (deviceNetworkInfo.data?.wifiName == null ||
|
||||||
|
deviceNetworkInfo.data?.wifiName == '') {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
final peerId = deviceNetworkInfo?.data?.peerId;
|
||||||
|
if (peerId == null || peerId.isEmpty || peerId == '') {
|
||||||
|
throw Exception('设备peerId为空');
|
||||||
|
}
|
||||||
|
// 设置锁的peerID
|
||||||
|
StartChartManage().lockPeerId = peerId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 发送监控消息
|
||||||
|
void sendMonitorMessage() {
|
||||||
|
// 发送监控id
|
||||||
|
StartChartManage().startCallRequestMessageTimer(
|
||||||
|
ToPeerId: StartChartManage().lockPeerId ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
getServerDatetime();
|
getServerDatetime();
|
||||||
await PermissionDialog.request(Permission.location);
|
await PermissionDialog.request(Permission.location);
|
||||||
await PermissionDialog.requestBluetooth();
|
await PermissionDialog.requestBluetooth();
|
||||||
|
_requestDeviceNetworkInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -68,7 +68,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
lockListInfoItemEntity: widget.lockListInfoItemEntity,
|
lockListInfoItemEntity: widget.lockListInfoItemEntity,
|
||||||
isOnlyOneData: widget.isOnlyOneData);
|
isOnlyOneData: widget.isOnlyOneData);
|
||||||
|
|
||||||
_handleLockMonitor2();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1164,7 +1164,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
showWidgetArr.add(
|
showWidgetArr.add(
|
||||||
bottomItem('images/main/icon_catEyes.png', '监控'.tr,
|
bottomItem('images/main/icon_catEyes.png', '监控'.tr,
|
||||||
state.bottomBtnisEable.value, () async {
|
state.bottomBtnisEable.value, () async {
|
||||||
await _handleLockMonitor();
|
logic.sendMonitorMessage();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1572,36 +1572,4 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleLockMonitor2() async {
|
|
||||||
final lockId = state.keyInfos.value.lockId;
|
|
||||||
final LockSetInfoEntity entity =
|
|
||||||
await ApiRepository.to.getLockSettingInfoData(
|
|
||||||
lockId: lockId.toString(),
|
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
|
||||||
final LockSetInfoData data = entity.data!;
|
|
||||||
final mac = data.lockBasicInfo?.mac;
|
|
||||||
if (mac != null && mac.isNotEmpty) {
|
|
||||||
final DeviceNetwork deviceNetworkInfo = await ApiRepository.to
|
|
||||||
.getDeviceNetwork(deviceType: 2, deviceMac: mac);
|
|
||||||
if (deviceNetworkInfo.data?.wifiName == null ||
|
|
||||||
deviceNetworkInfo.data?.wifiName == '') {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
final peerId = deviceNetworkInfo?.data?.peerId;
|
|
||||||
if (peerId == null || peerId.isEmpty || peerId == '') {
|
|
||||||
throw Exception('设备peerId为空');
|
|
||||||
}
|
|
||||||
// 设置锁的peerID
|
|
||||||
StartChartManage().lockPeerId = peerId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _handleLockMonitor() async {
|
|
||||||
// 发送监控id
|
|
||||||
StartChartManage().startCallRequestMessageTimer(
|
|
||||||
ToPeerId: StartChartManage().lockPeerId ?? '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -313,7 +313,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 开启UDP
|
// 开启UDP
|
||||||
// AppLog.log('onReady() LockMainLogic');
|
// AppLog.log('onReady() LockMainLogic');
|
||||||
UdpHelp().openUDP();
|
// UdpHelp().openUDP();
|
||||||
BlueManage();
|
BlueManage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,9 +53,11 @@ class LockMainXHJLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity.data!.starchart != null) {
|
if (entity.data!.starchart != null) {
|
||||||
if (entity.data!.starchart!.starchartId!.isEmpty) {
|
if (entity.data!.starchart!.starchartId == null) {
|
||||||
bindStarChart();
|
bindStarChart();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
StartChartManage().init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class MineSetLogic extends BaseGetXController {
|
|||||||
'logout_result': '成功',
|
'logout_result': '成功',
|
||||||
});
|
});
|
||||||
|
|
||||||
UdpHelp().closeUDP();
|
// UdpHelp().closeUDP();
|
||||||
logOut();
|
logOut();
|
||||||
|
|
||||||
StoreService.to.saveLanguageCode('');
|
StoreService.to.saveLanguageCode('');
|
||||||
|
|||||||
@ -146,23 +146,23 @@ class StartChartManage {
|
|||||||
await _requestStarChartRegisterNode();
|
await _requestStarChartRegisterNode();
|
||||||
await _saveStarChartRegisterNodeToStorage(requestStarChartRegisterNode);
|
await _saveStarChartRegisterNodeToStorage(requestStarChartRegisterNode);
|
||||||
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
||||||
bindUserStarchart();
|
bindUserStarchart(requestStarChartRegisterNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//绑定星图配置
|
//绑定星图配置
|
||||||
Future<void> bindUserStarchart() async {
|
Future<void> bindUserStarchart(
|
||||||
|
StarChartRegisterNodeEntity requestStarChartRegisterNode) async {
|
||||||
try {
|
try {
|
||||||
final StarChartRegisterNodeEntity? registerNodeEntity =
|
|
||||||
await Storage.getStarChartRegisterNodeInfo();
|
|
||||||
|
|
||||||
final LoginEntity entity = await ApiRepository.to.bindUserStarchart(
|
final LoginEntity entity = await ApiRepository.to.bindUserStarchart(
|
||||||
starchartId: registerNodeEntity?.peer?.id ?? '',
|
starchartId: requestStarChartRegisterNode.peer?.id ?? '',
|
||||||
starchartPeerPublicKey: registerNodeEntity?.peer?.publicKey ?? '',
|
starchartPeerPublicKey:
|
||||||
starchartPeerPrivateKey: registerNodeEntity?.peer?.privateKey ?? '',
|
requestStarChartRegisterNode.peer?.publicKey ?? '',
|
||||||
|
starchartPeerPrivateKey:
|
||||||
|
requestStarChartRegisterNode.peer?.privateKey ?? '',
|
||||||
);
|
);
|
||||||
registerNodeEntity?.peer?.id = entity.data?.starchart?.starchartId;
|
requestStarChartRegisterNode.peer?.id =
|
||||||
await Storage.saveStarChartRegisterNodeInfo(registerNodeEntity!);
|
entity.data?.starchart?.starchartId;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
AppLog.log('绑定成功');
|
AppLog.log('绑定成功');
|
||||||
} else {
|
} else {
|
||||||
@ -762,6 +762,9 @@ class StartChartManage {
|
|||||||
StarChartRegisterNodeEntity starChartRegisterNodeEntity) async {
|
StarChartRegisterNodeEntity starChartRegisterNodeEntity) async {
|
||||||
if (starChartRegisterNodeEntity != null) {
|
if (starChartRegisterNodeEntity != null) {
|
||||||
await Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
await Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
||||||
|
final LoginData? loginData = await Storage.getLoginData();
|
||||||
|
loginData?.updateStarchart(starChartRegisterNodeEntity);
|
||||||
|
Storage.saveLoginData(loginData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,9 +782,9 @@ class StartChartManage {
|
|||||||
final RelayInfoEntity? relayInfoEntity = await Storage.getRelayInfo();
|
final RelayInfoEntity? relayInfoEntity = await Storage.getRelayInfo();
|
||||||
|
|
||||||
// 获取公钥
|
// 获取公钥
|
||||||
final publicKey = await getPublicKey();
|
final String publicKey = await getPublicKey();
|
||||||
// 获取私钥
|
// 获取私钥
|
||||||
final privateKey = await getPrivateKey();
|
final String privateKey = await getPrivateKey();
|
||||||
// 生成签名
|
// 生成签名
|
||||||
final sign = await DoSign().generateSign(
|
final sign = await DoSign().generateSign(
|
||||||
currentTimestamp: relayInfoEntity!.time ?? 0,
|
currentTimestamp: relayInfoEntity!.time ?? 0,
|
||||||
|
|||||||
@ -255,39 +255,39 @@ class _TalkViewPageState extends State<TalkViewPage>
|
|||||||
)
|
)
|
||||||
: Container()),
|
: Container()),
|
||||||
//ToDo: 增加对讲调试、正式可删除
|
//ToDo: 增加对讲调试、正式可删除
|
||||||
Visibility(
|
// Visibility(
|
||||||
visible: true,
|
// visible: true,
|
||||||
child: Positioned(
|
// child: Positioned(
|
||||||
top: 20, // 设置在顶部
|
// top: 20, // 设置在顶部
|
||||||
left: 20,
|
// left: 20,
|
||||||
right: 20, // 确保调试信息在屏幕宽度内居中
|
// right: 20, // 确保调试信息在屏幕宽度内居中
|
||||||
child: Container(
|
// child: Container(
|
||||||
height: 100, // 设置高度为 100
|
// height: 100, // 设置高度为 100
|
||||||
color: Colors.black.withOpacity(0.5), // 可选:设置背景颜色和透明度
|
// color: Colors.black.withOpacity(0.5), // 可选:设置背景颜色和透明度
|
||||||
padding: const EdgeInsets.all(10), // 可选:设置内边距
|
// padding: const EdgeInsets.all(10), // 可选:设置内边距
|
||||||
child: Consumer<DebugInfoModel>(
|
// child: Consumer<DebugInfoModel>(
|
||||||
builder: (BuildContext context, DebugInfoModel debugInfo,
|
// builder: (BuildContext context, DebugInfoModel debugInfo,
|
||||||
Widget? child) {
|
// Widget? child) {
|
||||||
return Column(
|
// return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
// children: <Widget>[
|
||||||
Text(
|
// Text(
|
||||||
'recv ${debugInfo.recvDataRate}KB/s [${debugInfo.recvPacketCount}]',
|
// 'recv ${debugInfo.recvDataRate}KB/s [${debugInfo.recvPacketCount}]',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
color: Colors.white), // 设置文本颜色为白色
|
// color: Colors.white), // 设置文本颜色为白色
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
'send ${debugInfo.sendDataRate}KB/s [${debugInfo.sendPacketCount}]',
|
// 'send ${debugInfo.sendDataRate}KB/s [${debugInfo.sendPacketCount}]',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
color: Colors.white), // 设置文本颜色为白色
|
// color: Colors.white), // 设置文本颜色为白色
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
// 添加服务器延迟检测
|
// 添加服务器延迟检测
|
||||||
// Positioned(
|
// Positioned(
|
||||||
// top: 120,
|
// top: 120,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user