fix:增加获取锁板peerId的逻辑
This commit is contained in:
parent
88fbd1cac9
commit
641ff4a2b6
@ -68,7 +68,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
lockListInfoItemEntity: widget.lockListInfoItemEntity,
|
||||
isOnlyOneData: widget.isOnlyOneData);
|
||||
|
||||
_handleLockSettingInfoData();
|
||||
_handleLockMonitor2();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1164,10 +1164,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
showWidgetArr.add(
|
||||
bottomItem('images/main/icon_catEyes.png', '监控'.tr,
|
||||
state.bottomBtnisEable.value, () async {
|
||||
_handleLockSettingInfoData();
|
||||
// 发送监控id
|
||||
StartChartManage().startCallRequestMessageTimer(
|
||||
ToPeerId: StartChartManage().lockPeerId ?? '');
|
||||
await _handleLockMonitor();
|
||||
}),
|
||||
);
|
||||
}
|
||||
@ -1575,7 +1572,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
BlueManage().disconnect();
|
||||
}
|
||||
|
||||
void _handleLockSettingInfoData() async {
|
||||
Future<void> _handleLockMonitor2() async {
|
||||
final lockId = state.keyInfos.value.lockId;
|
||||
final LockSetInfoEntity entity =
|
||||
await ApiRepository.to.getLockSettingInfoData(
|
||||
@ -1587,12 +1584,47 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
if (mac != null && mac.isNotEmpty) {
|
||||
final DeviceNetwork deviceNetworkInfo = await ApiRepository.to
|
||||
.getDeviceNetwork(deviceType: 2, deviceMac: mac);
|
||||
final peerId = deviceNetworkInfo?.data?.peerId;
|
||||
if (peerId == null || peerId.isEmpty) {
|
||||
throw Exception('设备peerId为空');
|
||||
if (deviceNetworkInfo.data?.wifiName == null) {
|
||||
return;
|
||||
} else {
|
||||
final peerId = deviceNetworkInfo?.data?.peerId;
|
||||
if (peerId == null || peerId.isEmpty) {
|
||||
throw Exception('设备peerId为空');
|
||||
}
|
||||
// 设置锁的peerID
|
||||
StartChartManage().lockPeerId = peerId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleLockMonitor() 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) {
|
||||
// 未找到配网信息
|
||||
logic.showToast('请先进行配网');
|
||||
return;
|
||||
} else {
|
||||
final peerId = deviceNetworkInfo?.data?.peerId;
|
||||
if (peerId == null || peerId.isEmpty) {
|
||||
throw Exception('设备peerId为空');
|
||||
}
|
||||
// 设置锁的peerID
|
||||
StartChartManage().lockPeerId = peerId;
|
||||
// 发送监控id
|
||||
StartChartManage().startCallRequestMessageTimer(
|
||||
ToPeerId: StartChartManage().lockPeerId ?? '');
|
||||
}
|
||||
// 设置锁的peerID
|
||||
StartChartManage().lockPeerId = peerId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user