1、添加获取网关状态协议及逻辑
2、添加更新网关信息功能
This commit is contained in:
parent
d947ffeeb2
commit
c3d9667458
@ -6,8 +6,8 @@ import '../io_reply.dart';
|
|||||||
import '../io_sender.dart';
|
import '../io_sender.dart';
|
||||||
import '../io_tool/io_tool.dart';
|
import '../io_tool/io_tool.dart';
|
||||||
import '../io_type.dart';
|
import '../io_type.dart';
|
||||||
import '../sm4Encipher/sm4.dart';
|
// import '../sm4Encipher/sm4.dart';
|
||||||
import 'package:crypto/crypto.dart' as crypto;
|
// import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
class GatewayConfiguringWifiCommand extends SenderProtocol {
|
class GatewayConfiguringWifiCommand extends SenderProtocol {
|
||||||
|
|
||||||
@ -51,13 +51,6 @@ class GatewayConfiguringWifiCommand extends SenderProtocol {
|
|||||||
data.add(subData.length);
|
data.add(subData.length);
|
||||||
data.addAll(subData);
|
data.addAll(subData);
|
||||||
|
|
||||||
// if ((data.length % 16) != 0) {
|
|
||||||
// final int add = 16 - data.length % 16;
|
|
||||||
// for (int i = 0; i < add; i++) {
|
|
||||||
// data.add(0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
printLog(data);
|
printLog(data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
65
lib/blue/io_protocol/io_gateway_getStatus.dart
Normal file
65
lib/blue/io_protocol/io_gateway_getStatus.dart
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
// 获取网关状态
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
// import '../sm4Encipher/sm4.dart';
|
||||||
|
// import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
class GatewayGetStatusCommand extends SenderProtocol {
|
||||||
|
|
||||||
|
GatewayGetStatusCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.userID,
|
||||||
|
}) : super(CommandType.gatewayGetStatus);
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
String? userID;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GatewayGetStatusCommand{lockID: $lockID, userID: $userID}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<int> messageDetail() {
|
||||||
|
final List<int> data = <int>[];
|
||||||
|
List<int> subData = <int>[];
|
||||||
|
|
||||||
|
// 指令类型
|
||||||
|
final int type = commandType!.typeValue;
|
||||||
|
final double typeDouble = type / 256;
|
||||||
|
final int type1 = typeDouble.toInt();
|
||||||
|
final int type2 = type % 256;
|
||||||
|
data.add(type1);
|
||||||
|
data.add(type2);
|
||||||
|
|
||||||
|
//lockID 40
|
||||||
|
final int ssidLength = utf8.encode(lockID!).length;
|
||||||
|
subData.addAll(utf8.encode(lockID!));
|
||||||
|
subData = getFixedLengthList(subData, 40 - ssidLength);
|
||||||
|
|
||||||
|
//userID 20
|
||||||
|
final int passwordLength = utf8.encode(userID!).length;
|
||||||
|
subData.addAll(utf8.encode(userID!));
|
||||||
|
subData = getFixedLengthList(subData, 20 - passwordLength);
|
||||||
|
|
||||||
|
data.add(subData.length);
|
||||||
|
data.addAll(subData);
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class GatewayGetStatusReply extends Reply {
|
||||||
|
GatewayGetStatusReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
final int status = data[2];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:crypto/crypto.dart' as crypto;
|
// import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
import '../../app_settings/app_settings.dart';
|
import '../../app_settings/app_settings.dart';
|
||||||
import '../io_reply.dart';
|
import '../io_reply.dart';
|
||||||
import '../io_sender.dart';
|
import '../io_sender.dart';
|
||||||
import '../io_tool/io_tool.dart';
|
import '../io_tool/io_tool.dart';
|
||||||
import '../io_type.dart';
|
import '../io_type.dart';
|
||||||
import '../sm4Encipher/sm4.dart';
|
// import '../sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
class GatewayGetWifiCommand extends SenderProtocol {
|
class GatewayGetWifiCommand extends SenderProtocol {
|
||||||
|
|
||||||
@ -47,13 +47,6 @@ class GatewayGetWifiCommand extends SenderProtocol {
|
|||||||
data.add(subData.length);
|
data.add(subData.length);
|
||||||
data.addAll(subData);
|
data.addAll(subData);
|
||||||
|
|
||||||
// if ((data.length % 16) != 0) {
|
|
||||||
// final int add = 16 - data.length % 16;
|
|
||||||
// for (int i = 0; i < add; i++) {
|
|
||||||
// data.add(0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
printLog(data);
|
printLog(data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ enum CommandType {
|
|||||||
startOATUpgrade, //OTA升级开始 0x30E0
|
startOATUpgrade, //OTA升级开始 0x30E0
|
||||||
confirmationOTAUpgrade, //OTA升级开始 0x30E2
|
confirmationOTAUpgrade, //OTA升级开始 0x30E2
|
||||||
processOTAUpgrade, //OTA升级过程 0x30E1
|
processOTAUpgrade, //OTA升级过程 0x30E1
|
||||||
|
gatewayGetStatus,//获取网关状态 0x30F8
|
||||||
gatewayConfiguringWifi,//网关配网 0x30F4
|
gatewayConfiguringWifi,//网关配网 0x30F4
|
||||||
gatewayConfiguringWifiResult,//网关配网结果 0x30F5
|
gatewayConfiguringWifiResult,//网关配网结果 0x30F5
|
||||||
gatewayGetWifiList,//网关获取附近的wifi列表 0x30F6
|
gatewayGetWifiList,//网关获取附近的wifi列表 0x30F6
|
||||||
@ -205,6 +206,11 @@ extension ExtensionCommandType on CommandType {
|
|||||||
type = CommandType.gatewayGetWifiListResult;
|
type = CommandType.gatewayGetWifiListResult;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0x30F8:
|
||||||
|
{
|
||||||
|
type = CommandType.gatewayGetStatus;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
type = CommandType.readLockStatusInfo;
|
type = CommandType.readLockStatusInfo;
|
||||||
@ -304,6 +310,9 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case CommandType.gatewayGetWifiListResult:
|
case CommandType.gatewayGetWifiListResult:
|
||||||
type = 0x30F7;
|
type = 0x30F7;
|
||||||
break;
|
break;
|
||||||
|
case CommandType.gatewayGetStatus:
|
||||||
|
type = 0x30F8;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
type = 0x300A;
|
type = 0x300A;
|
||||||
break;
|
break;
|
||||||
@ -321,6 +330,7 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case CommandType.processOTAUpgrade:
|
case CommandType.processOTAUpgrade:
|
||||||
case CommandType.gatewayGetWifiList:
|
case CommandType.gatewayGetWifiList:
|
||||||
case CommandType.gatewayConfiguringWifi:
|
case CommandType.gatewayConfiguringWifi:
|
||||||
|
case CommandType.gatewayGetStatus:
|
||||||
//不加密
|
//不加密
|
||||||
type = 0x20;
|
type = 0x20;
|
||||||
break;
|
break;
|
||||||
@ -436,6 +446,9 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case 0x30F7:
|
case 0x30F7:
|
||||||
t = '网关获取附近的wifi列表结果';
|
t = '网关获取附近的wifi列表结果';
|
||||||
break;
|
break;
|
||||||
|
case 0x30F8:
|
||||||
|
t = '获取网关状态';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
t = '读星锁状态信息';
|
t = '读星锁状态信息';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import 'io_protocol/io_addUser.dart';
|
|||||||
import 'io_protocol/io_checkingCardStatus.dart';
|
import 'io_protocol/io_checkingCardStatus.dart';
|
||||||
import 'io_protocol/io_checkingUserInfoCount.dart';
|
import 'io_protocol/io_checkingUserInfoCount.dart';
|
||||||
import 'io_protocol/io_configuringWifi.dart';
|
import 'io_protocol/io_configuringWifi.dart';
|
||||||
|
import 'io_protocol/io_gateway_getStatus.dart';
|
||||||
import 'io_protocol/io_getPrivateKey.dart';
|
import 'io_protocol/io_getPrivateKey.dart';
|
||||||
import 'io_protocol/io_getPublicKey.dart';
|
import 'io_protocol/io_getPublicKey.dart';
|
||||||
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
||||||
@ -272,6 +273,11 @@ class CommandReciverManager {
|
|||||||
reply = GatewayGetWifiListReply.parseData(commandType, data);
|
reply = GatewayGetWifiListReply.parseData(commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CommandType.gatewayGetStatus:
|
||||||
|
{
|
||||||
|
reply = GatewayGetStatusReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CommandType.generalExtendedCommond:
|
case CommandType.generalExtendedCommond:
|
||||||
{
|
{
|
||||||
// 子命令类型
|
// 子命令类型
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import 'io_protocol/io_configuringWifi.dart';
|
|||||||
import 'io_protocol/io_editUser.dart';
|
import 'io_protocol/io_editUser.dart';
|
||||||
import 'io_protocol/io_factoryDataReset.dart';
|
import 'io_protocol/io_factoryDataReset.dart';
|
||||||
import 'io_protocol/io_gateway_configuringWifi.dart';
|
import 'io_protocol/io_gateway_configuringWifi.dart';
|
||||||
|
import 'io_protocol/io_gateway_getStatus.dart';
|
||||||
import 'io_protocol/io_getPrivateKey.dart';
|
import 'io_protocol/io_getPrivateKey.dart';
|
||||||
import 'io_protocol/io_getPublicKey.dart';
|
import 'io_protocol/io_getPublicKey.dart';
|
||||||
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
||||||
@ -52,7 +53,7 @@ import 'io_protocol/io_updataLockSet.dart';
|
|||||||
import 'sender_data.dart';
|
import 'sender_data.dart';
|
||||||
|
|
||||||
class IoSenderManage {
|
class IoSenderManage {
|
||||||
//todo:获取公钥
|
// 获取公钥
|
||||||
static void getPublicKey({String? lockId, CommandSendCallBack? callBack}) {
|
static void getPublicKey({String? lockId, CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GetPublicKeyCommand(
|
command: GetPublicKeyCommand(
|
||||||
@ -62,7 +63,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:获取私钥
|
// 获取私钥
|
||||||
static void getPrivateKey(
|
static void getPrivateKey(
|
||||||
{String? lockId,
|
{String? lockId,
|
||||||
String? keyID, // 钥匙ID
|
String? keyID, // 钥匙ID
|
||||||
@ -84,7 +85,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加用户
|
// 添加用户
|
||||||
static void senderAddUser(
|
static void senderAddUser(
|
||||||
{String? lockID,
|
{String? lockID,
|
||||||
String? authUserID,
|
String? authUserID,
|
||||||
@ -136,7 +137,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:修改用户
|
// 修改用户
|
||||||
static void senderEditUser(
|
static void senderEditUser(
|
||||||
{String? lockID,
|
{String? lockID,
|
||||||
String? authUserID,
|
String? authUserID,
|
||||||
@ -172,7 +173,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:删除
|
// 删除
|
||||||
static void deletUser(
|
static void deletUser(
|
||||||
{String? lockID,
|
{String? lockID,
|
||||||
String? authUserID,
|
String? authUserID,
|
||||||
@ -196,7 +197,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:开锁
|
// 开锁
|
||||||
static void senderOpenLock(
|
static void senderOpenLock(
|
||||||
{String? lockID,
|
{String? lockID,
|
||||||
String? userID,
|
String? userID,
|
||||||
@ -223,7 +224,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:获取锁状态 弃用
|
// 获取锁状态 弃用
|
||||||
// static void senderGetLockStatu(
|
// static void senderGetLockStatu(
|
||||||
// {String? lockID,
|
// {String? lockID,
|
||||||
// String? userID,
|
// String? userID,
|
||||||
@ -238,7 +239,7 @@ class IoSenderManage {
|
|||||||
// callBack: callBack);
|
// callBack: callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:获取星锁状态信息
|
// 获取星锁状态信息
|
||||||
static void senderGetStarLockStatuInfo(
|
static void senderGetStarLockStatuInfo(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -259,7 +260,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:转移权限
|
// 转移权限
|
||||||
static void senderTransferPermissions(
|
static void senderTransferPermissions(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
required String? authUserID,
|
required String? authUserID,
|
||||||
@ -285,7 +286,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:转移智能锁
|
// 转移智能锁
|
||||||
static void sendTransferSmartLockCommand(
|
static void sendTransferSmartLockCommand(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -307,7 +308,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:恢复出厂设置
|
// 恢复出厂设置
|
||||||
static void senderFactoryDataReset(
|
static void senderFactoryDataReset(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -329,7 +330,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:设置开锁密码
|
// 设置开锁密码
|
||||||
static void senderCustomPasswordsCommand(
|
static void senderCustomPasswordsCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -366,7 +367,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:修改管理员密码
|
// 修改管理员密码
|
||||||
static void changeAdministratorPasswordCommand(
|
static void changeAdministratorPasswordCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -399,7 +400,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:重置开锁密码
|
// 重置开锁密码
|
||||||
static void senderResetPasswordsCommand(
|
static void senderResetPasswordsCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -422,7 +423,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加指纹开始 弃用
|
// 添加指纹开始 弃用
|
||||||
// static void senderAddFingerprintCommand(
|
// static void senderAddFingerprintCommand(
|
||||||
// {required String? keyID,
|
// {required String? keyID,
|
||||||
// required String? userID,
|
// required String? userID,
|
||||||
@ -451,7 +452,7 @@ class IoSenderManage {
|
|||||||
// callBack: callBack);
|
// callBack: callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:添加指纹开始(带限时、循环、胁迫...)
|
// 添加指纹开始(带限时、循环、胁迫...)
|
||||||
static void senderAddFingerprintWithTimeCycleCoercionCommand(
|
static void senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -496,7 +497,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:取消添加指纹
|
// 取消添加指纹
|
||||||
static void senderCancelAddFingerprintCommand(
|
static void senderCancelAddFingerprintCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -517,7 +518,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加卡开始旧版
|
// 添加卡开始旧版
|
||||||
// static void senderAddICCardCommand(
|
// static void senderAddICCardCommand(
|
||||||
// {required String? keyID,
|
// {required String? keyID,
|
||||||
// required String? userID,
|
// required String? userID,
|
||||||
@ -546,7 +547,7 @@ class IoSenderManage {
|
|||||||
// callBack: callBack);
|
// callBack: callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:添加卡开始(带限时、循环、胁迫...)
|
// 添加卡开始(带限时、循环、胁迫...)
|
||||||
static void senderAddCardWithTimeCycleCoercionCommand(
|
static void senderAddCardWithTimeCycleCoercionCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -591,7 +592,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:取消添加指纹
|
// 取消添加指纹
|
||||||
static void senderCancelAddCardCommand(
|
static void senderCancelAddCardCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -612,7 +613,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加遥控开始(带限时、循环、胁迫...)
|
// 添加遥控开始(带限时、循环、胁迫...)
|
||||||
static void senderAddRemoteControlWithTimeCycleCoercionCommand(
|
static void senderAddRemoteControlWithTimeCycleCoercionCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -657,7 +658,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:取消添加遥控
|
// 取消添加遥控
|
||||||
static void senderCancelAddRemoteControlCommand(
|
static void senderCancelAddRemoteControlCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -678,7 +679,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加人脸开始
|
// 添加人脸开始
|
||||||
static void senderAddFaceCommand(
|
static void senderAddFaceCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -723,7 +724,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:取消添加人脸
|
// 取消添加人脸
|
||||||
static void senderCancelAddFaceCommand(
|
static void senderCancelAddFaceCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -744,7 +745,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加掌静脉开始(带限时、循环、胁迫...)
|
// 添加掌静脉开始(带限时、循环、胁迫...)
|
||||||
static void senderAddPalmWithTimeCycleCoercionCommand(
|
static void senderAddPalmWithTimeCycleCoercionCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -789,7 +790,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:取消添加掌静脉
|
// 取消添加掌静脉
|
||||||
static void senderCancelAddPalmCommand(
|
static void senderCancelAddPalmCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -810,7 +811,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:校验时间
|
// 校验时间
|
||||||
static void senderTimingCommand(
|
static void senderTimingCommand(
|
||||||
{required String? lockID,
|
{required String? lockID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -833,7 +834,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:自动落锁 - 废弃
|
// 自动落锁 - 废弃
|
||||||
// static void senderAutomaticPadlockCommand({
|
// static void senderAutomaticPadlockCommand({
|
||||||
// required String? lockID,
|
// required String? lockID,
|
||||||
// required String? userID,
|
// required String? userID,
|
||||||
@ -855,7 +856,7 @@ class IoSenderManage {
|
|||||||
// ), callBack:callBack);
|
// ), callBack:callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:事件记录(页数查询)
|
// 事件记录(页数查询)
|
||||||
static void senderReferEventRecordNumberCommand(
|
static void senderReferEventRecordNumberCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -880,7 +881,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:事件记录(时间查询)
|
// 事件记录(时间查询)
|
||||||
static void senderReferEventRecordTimeCommand(
|
static void senderReferEventRecordTimeCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -907,7 +908,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:查询指纹状态
|
// 查询指纹状态
|
||||||
static void senderQueryingFingerprintStatusCommand(
|
static void senderQueryingFingerprintStatusCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -934,7 +935,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:查询卡片状态
|
// 查询卡片状态
|
||||||
static void senderCheckingCardStatusCommand(
|
static void senderCheckingCardStatusCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -961,7 +962,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:查询人脸状态
|
// 查询人脸状态
|
||||||
static void senderQueryingFaceStatusCommand(
|
static void senderQueryingFaceStatusCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -988,7 +989,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
static void senderCheckingUserInfoCountCommand(
|
static void senderCheckingUserInfoCountCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1013,7 +1014,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:wifi列表
|
// wifi列表
|
||||||
static void getWifiListCommand(
|
static void getWifiListCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1034,7 +1035,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:配置wifi
|
// 配置wifi
|
||||||
static void senderConfiguringWifiCommand(
|
static void senderConfiguringWifiCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1067,7 +1068,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:添加胁迫指纹
|
// 添加胁迫指纹
|
||||||
// static void senderAddStressFingerprintCommand(
|
// static void senderAddStressFingerprintCommand(
|
||||||
// {required String? keyID,
|
// {required String? keyID,
|
||||||
// required String? userID,
|
// required String? userID,
|
||||||
@ -1099,7 +1100,7 @@ class IoSenderManage {
|
|||||||
// callBack: callBack);
|
// callBack: callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:添加胁迫卡片
|
// 添加胁迫卡片
|
||||||
// static void senderAddStressICCardCommand(
|
// static void senderAddStressICCardCommand(
|
||||||
// {required String? keyID,
|
// {required String? keyID,
|
||||||
// required String? userID,
|
// required String? userID,
|
||||||
@ -1131,7 +1132,7 @@ class IoSenderManage {
|
|||||||
// callBack: callBack);
|
// callBack: callBack);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//todo:添加胁迫密码
|
// 添加胁迫密码
|
||||||
static void senderAddStressPasswordCommand(
|
static void senderAddStressPasswordCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1160,7 +1161,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:读取支持功能(不带参数)启用/禁用
|
// 读取支持功能(不带参数)启用/禁用
|
||||||
static void readSupportFunctionsNoParametersCommand(
|
static void readSupportFunctionsNoParametersCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1183,7 +1184,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:设置支持功能(不带参数)启用/禁用
|
// 设置支持功能(不带参数)启用/禁用
|
||||||
static void setSupportFunctionsNoParametersCommand(
|
static void setSupportFunctionsNoParametersCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1208,7 +1209,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:读取支持功能(带参数)启用/禁用
|
// 读取支持功能(带参数)启用/禁用
|
||||||
static void readSupportFunctionsWithParametersCommand(
|
static void readSupportFunctionsWithParametersCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1231,7 +1232,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:设置支持功能(带参数)启用/禁用
|
// 设置支持功能(带参数)启用/禁用
|
||||||
static void setSupportFunctionsWithParametersCommand(
|
static void setSupportFunctionsWithParametersCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1258,7 +1259,7 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo:读取管理员密码
|
// 读取管理员密码
|
||||||
static void senderReadAdminPasswordCommand(
|
static void senderReadAdminPasswordCommand(
|
||||||
{required String? keyID,
|
{required String? keyID,
|
||||||
required String? userID,
|
required String? userID,
|
||||||
@ -1559,4 +1560,18 @@ class IoSenderManage {
|
|||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取网关状态
|
||||||
|
static void gatewayGetStatusCommand({
|
||||||
|
required String? lockID,
|
||||||
|
required String? userID,
|
||||||
|
CommandSendCallBack? callBack}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: GatewayGetStatusCommand(
|
||||||
|
lockID: lockID,
|
||||||
|
userID: userID
|
||||||
|
),
|
||||||
|
isBeforeAddUser: true,
|
||||||
|
callBack: callBack);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,12 +21,12 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
|||||||
Future<void> gatewayDistributionNetwork() async{
|
Future<void> gatewayDistributionNetwork() async{
|
||||||
final LoginEntity entity = await ApiRepository.to.gatewayDistributionNetwork(
|
final LoginEntity entity = await ApiRepository.to.gatewayDistributionNetwork(
|
||||||
gatewayName: state.gatewayNamePasswardTF.text,
|
gatewayName: state.gatewayNamePasswardTF.text,
|
||||||
gatewayMac: state.macAddress.value,
|
gatewayMac: state.gatewayModel.mac,
|
||||||
serialNumber: DateTime.now().millisecondsSinceEpoch.toString(),
|
serialNumber:state.gatewayModel.serialNum,
|
||||||
gatewayType: 2,
|
gatewayType: 2,
|
||||||
networkName: state.wifiNameTF.text,
|
networkName: state.wifiNameTF.text,
|
||||||
networkMac: state.macAddress.value,
|
networkMac: state.gatewayModel.wifiMac,
|
||||||
version: '1.0.0',
|
version: state.gatewayModel.gatewayVersion,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast('配网成功'.tr, something:(){
|
showToast('配网成功'.tr, something:(){
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -75,11 +75,11 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
Obx(() => CommonItem(
|
CommonItem(
|
||||||
leftTitel: '网络MAC'.tr,
|
leftTitel: '网络MAC'.tr,
|
||||||
rightTitle: state.macAddress.value,
|
rightTitle: state.gatewayModel.wifiMac,
|
||||||
// allHeight: 100.h,
|
// allHeight: 100.h,
|
||||||
isHaveLine: false)),
|
isHaveLine: false),
|
||||||
// SizedBox(
|
// SizedBox(
|
||||||
// height: 10.h,
|
// height: 10.h,
|
||||||
// ),
|
// ),
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
|
||||||
|
import '../selectGateway/getGatewayInfo_model.dart';
|
||||||
|
|
||||||
class GatewayConfigurationWifiState{
|
class GatewayConfigurationWifiState{
|
||||||
GatewayConfigurationWifiState() {
|
GatewayConfigurationWifiState() {
|
||||||
@ -9,12 +12,12 @@ class GatewayConfigurationWifiState{
|
|||||||
wifiNameTF.text = map['wifiName'];
|
wifiNameTF.text = map['wifiName'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map['macAddress'] != null && map['macAddress'] != '') {
|
if (map['gatewayModel'] != null && map['gatewayModel'] != '') {
|
||||||
macAddress = map['macAddress'];
|
gatewayModel = map['gatewayModel'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RxString macAddress = ''.obs;
|
GetGatewayInfoModel gatewayModel = GetGatewayInfoModel();
|
||||||
RxBool isUseStaticIP = false.obs;
|
RxBool isUseStaticIP = false.obs;
|
||||||
|
|
||||||
final TextEditingController wifiNameTF = TextEditingController();
|
final TextEditingController wifiNameTF = TextEditingController();
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class _GatewayGetWifiListPageState extends State<GatewayGetWifiListPage> with Ro
|
|||||||
return _messageListItem(wifiNameStr['wifiName'], wifiNameStr['rssi'], () {
|
return _messageListItem(wifiNameStr['wifiName'], wifiNameStr['rssi'], () {
|
||||||
Get.toNamed(Routers.gatewayConfigurationWifiPage, arguments: {
|
Get.toNamed(Routers.gatewayConfigurationWifiPage, arguments: {
|
||||||
'wifiName': wifiNameStr['wifiName'],
|
'wifiName': wifiNameStr['wifiName'],
|
||||||
'macAddress': state.macAddress
|
'gatewayModel': state.gatewayModel
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)),
|
}) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)),
|
||||||
@ -63,7 +63,7 @@ class _GatewayGetWifiListPageState extends State<GatewayGetWifiListPage> with Ro
|
|||||||
onClick: () {
|
onClick: () {
|
||||||
Get.toNamed(Routers.gatewayConfigurationWifiPage, arguments: {
|
Get.toNamed(Routers.gatewayConfigurationWifiPage, arguments: {
|
||||||
'wifiName': '',
|
'wifiName': '',
|
||||||
'macAddress': state.macAddress
|
'gatewayModel': state.gatewayModel
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|||||||
@ -2,17 +2,19 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../selectGateway/getGatewayInfo_model.dart';
|
||||||
|
|
||||||
class GatewayGetWifiListState{
|
class GatewayGetWifiListState{
|
||||||
GatewayGetWifiListState() {
|
GatewayGetWifiListState() {
|
||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
if (map['macAddress'] != null && map['macAddress'] != '') {
|
if (map['gatewayModel'] != null && map['gatewayModel'] != '') {
|
||||||
macAddress = map['macAddress'];
|
gatewayModel = map['gatewayModel'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final RxList<Map<String, String>> wifiNameDataList = <Map<String, String>>[].obs;
|
final RxList<Map<String, String>> wifiNameDataList = <Map<String, String>>[].obs;
|
||||||
|
|
||||||
String macAddress = '';
|
GetGatewayInfoModel gatewayModel = GetGatewayInfoModel();
|
||||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
RxInt sureBtnState = 0.obs;
|
RxInt sureBtnState = 0.obs;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
class GetGatewayInfoModel{
|
||||||
|
late String mac;
|
||||||
|
late String serialNum;
|
||||||
|
late String gatewayVersion;
|
||||||
|
late String wifiMac;
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -9,12 +10,87 @@ import 'package:star_lock/tools/baseGetXController.dart';
|
|||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_settings.dart';
|
import '../../../../app_settings/app_settings.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
|
import '../../../../blue/io_protocol/io_gateway_getStatus.dart';
|
||||||
|
import '../../../../blue/io_reply.dart';
|
||||||
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
|
import '../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../widget/permission/permission_dialog.dart';
|
import '../../../../widget/permission/permission_dialog.dart';
|
||||||
|
import 'getGatewayInfo_model.dart';
|
||||||
import 'selectGatewayList_state.dart';
|
import 'selectGatewayList_state.dart';
|
||||||
|
|
||||||
class SelectGatewayListLogic extends BaseGetXController {
|
class SelectGatewayListLogic extends BaseGetXController {
|
||||||
SelectGatewayListState state = SelectGatewayListState();
|
SelectGatewayListState state = SelectGatewayListState();
|
||||||
|
|
||||||
|
// 监听设备返回的数据
|
||||||
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
void _initReplySubscription() {
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
|
||||||
|
// 获取网关状态
|
||||||
|
if(reply is GatewayGetStatusReply) {
|
||||||
|
_replyGatewayGetStatusReply(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// WIFI配网结果
|
||||||
|
Future<void> _replyGatewayGetStatusReply(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch(status){
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
// state.sureBtnState.value = 0;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
|
||||||
|
final GetGatewayInfoModel gatewayModel = GetGatewayInfoModel();
|
||||||
|
// 网关MAC地址
|
||||||
|
int index = 3;
|
||||||
|
final List<int> macList = reply.data.sublist(index, index + 20);
|
||||||
|
final String macStr = utf8String(macList);
|
||||||
|
// lockInfo['mac'] = macStr;
|
||||||
|
gatewayModel.mac = macStr;
|
||||||
|
index = index + 20;
|
||||||
|
AppLog.log('网关MAC地址 macList:$macList macStr:$macStr');
|
||||||
|
|
||||||
|
// 网关序列号
|
||||||
|
final List<int> serialNum = reply.data.sublist(index, index + 20);
|
||||||
|
final String serialNumStr = utf8String(serialNum);
|
||||||
|
// lockInfo['serialNum'] = serialNumStr;
|
||||||
|
gatewayModel.serialNum = serialNumStr;
|
||||||
|
index = index + 20;
|
||||||
|
AppLog.log('网关序列号 serialNum:$serialNum serialNumStr:$serialNumStr');
|
||||||
|
|
||||||
|
// 网关版本
|
||||||
|
final List<int> gatewayVersion = reply.data.sublist(index, index + 20);
|
||||||
|
final String gatewayVersionStr = utf8String(gatewayVersion);
|
||||||
|
// lockInfo['gatewayVersion'] = gatewayVersionStr;
|
||||||
|
gatewayModel.gatewayVersion = gatewayVersionStr;
|
||||||
|
index = index + 20;
|
||||||
|
AppLog.log('软件版本 gatewayVersion:$gatewayVersion gatewayVersionStr:$gatewayVersionStr');
|
||||||
|
|
||||||
|
// 硬件版本
|
||||||
|
final List<int> wifiMac = reply.data.sublist(index, index + 20);
|
||||||
|
final String wifiMacStr = utf8String(wifiMac);
|
||||||
|
// lockInfo['wifiMac'] = wifiMacStr;
|
||||||
|
gatewayModel.wifiMac = wifiMacStr;
|
||||||
|
index = index + 20;
|
||||||
|
|
||||||
|
Get.toNamed(Routers.gatewayGetWifiListPage, arguments: {
|
||||||
|
'gatewayModel':gatewayModel,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
showToast('配网失败'.tr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void startScanBlueList() {
|
void startScanBlueList() {
|
||||||
BlueManage().startScan(2000, (List<ScanResult> list) {
|
BlueManage().startScan(2000, (List<ScanResult> list) {
|
||||||
state.devices.clear();
|
state.devices.clear();
|
||||||
@ -53,6 +129,28 @@ class SelectGatewayListLogic extends BaseGetXController {
|
|||||||
startScanBlueList();
|
startScanBlueList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取网关状态
|
||||||
|
Future<void> senderGatewayGetStatusAction() async {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: (){
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
|
if (connectionState == BluetoothConnectionState.connected){
|
||||||
|
IoSenderManage.gatewayGetStatusCommand(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
);
|
||||||
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
if(state.ifCurrentScreen.value == true){
|
||||||
|
showBlueConnetctToast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, isAddEquipment: true);
|
||||||
|
}
|
||||||
|
|
||||||
// 点击连接设备
|
// 点击连接设备
|
||||||
void connect(ScanResult device) {
|
void connect(ScanResult device) {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
@ -60,21 +158,32 @@ class SelectGatewayListLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(device.advertisementData.advName, (BluetoothConnectionState state) async {
|
BlueManage().blueSendData(device.advertisementData.advName, (BluetoothConnectionState state) async {
|
||||||
// AppLog.log('点击要添加的设备了');
|
// AppLog.log('点击要添加的设备了');
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
Get.toNamed(Routers.gatewayGetWifiListPage, arguments: {
|
|
||||||
'macAddress':device.device.remoteId.str
|
// 没有网关调试,做假数据调试
|
||||||
});
|
// final GetGatewayInfoModel gatewayModel = GetGatewayInfoModel();
|
||||||
} else{
|
// gatewayModel.mac = 'C1:1E:0D:E0:0C:A9';
|
||||||
dismissEasyLoading();
|
// gatewayModel.serialNum = DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
}
|
// gatewayModel.gatewayVersion = '1.0.1';
|
||||||
}, isAddEquipment: true);
|
// gatewayModel.wifiMac = 'C1:1E:0D:E0:0C:A9';
|
||||||
|
// Get.toNamed(Routers.gatewayGetWifiListPage, arguments: {
|
||||||
|
// 'gatewayModel':gatewayModel,
|
||||||
|
// });
|
||||||
|
|
||||||
|
senderGatewayGetStatusAction();
|
||||||
|
} else{
|
||||||
|
dismissEasyLoading();
|
||||||
|
}
|
||||||
|
}, isAddEquipment: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
|
_initReplySubscription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -82,4 +191,10 @@ class SelectGatewayListLogic extends BaseGetXController {
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
getNearByLimits();
|
getNearByLimits();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_replySubscription.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,4 +4,6 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
class SelectGatewayListState{
|
class SelectGatewayListState{
|
||||||
RxList<ScanResult> devices = <ScanResult>[].obs;
|
RxList<ScanResult> devices = <ScanResult>[].obs;
|
||||||
|
|
||||||
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
}
|
}
|
||||||
@ -20,4 +20,17 @@ class GatewayDetailLogic extends BaseGetXController{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateGateway(String gatewayName) async{
|
||||||
|
final LoginEntity entity = await ApiRepository.to.gatewayUpdate(
|
||||||
|
gatewayId: state.getewayItemData.value.gatewayId ?? 0,
|
||||||
|
gatewayName:gatewayName
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
showToast('修改成功'.tr, something:(){
|
||||||
|
// eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -44,14 +44,13 @@ class _GatewayDetailPageState extends State<GatewayDetailPage> {
|
|||||||
ShowTipView().showTFViewAlertDialog(
|
ShowTipView().showTFViewAlertDialog(
|
||||||
state.changeGatewayNameController,
|
state.changeGatewayNameController,
|
||||||
'请输入姓名'.tr,
|
'请输入姓名'.tr,
|
||||||
'', () {
|
'请输入姓名'.tr, () {
|
||||||
if (state.changeGatewayNameController.text.isEmpty) {
|
if (state.changeGatewayNameController.text.isEmpty) {
|
||||||
logic.showToast('请输入姓名'.tr);
|
logic.showToast('请输入姓名'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get.back();
|
Get.back();
|
||||||
// state.typeName.value = state.changeNameController.text;
|
logic.updateGateway(state.changeGatewayNameController.text);
|
||||||
// logic.editICCardData();
|
|
||||||
}, inputFormatters: <TextInputFormatter>[
|
}, inputFormatters: <TextInputFormatter>[
|
||||||
FilteringTextInputFormatter.deny('\n'),
|
FilteringTextInputFormatter.deny('\n'),
|
||||||
LengthLimitingTextInputFormatter(50),
|
LengthLimitingTextInputFormatter(50),
|
||||||
@ -75,20 +74,20 @@ class _GatewayDetailPageState extends State<GatewayDetailPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 10.h,
|
height: 10.h,
|
||||||
),
|
),
|
||||||
CommonItem(
|
// CommonItem(
|
||||||
leftTitel: '附近的锁'.tr,
|
// leftTitel: '附近的锁'.tr,
|
||||||
rightTitle: state.getewayItemData.value.lockNum.toString(),
|
// rightTitle: state.getewayItemData.value.lockNum.toString(),
|
||||||
isHaveLine: true,
|
// isHaveLine: true,
|
||||||
isHaveDirection: true,
|
// isHaveDirection: true,
|
||||||
action: () {
|
// action: () {
|
||||||
Navigator.pushNamed(context, Routers.gatewayConnectionLockPage);
|
// Navigator.pushNamed(context, Routers.gatewayConnectionLockPage);
|
||||||
}),
|
// }),
|
||||||
CommonItem(
|
// CommonItem(
|
||||||
leftTitel: '网关升级'.tr,
|
// leftTitel: '网关升级'.tr,
|
||||||
rightTitle: '',
|
// rightTitle: '',
|
||||||
isHaveLine: false,
|
// isHaveLine: false,
|
||||||
isHaveDirection: true,
|
// isHaveDirection: true,
|
||||||
action: () {}),
|
// action: () {}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 80.h,
|
height: 80.h,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -9,6 +9,7 @@ class GatewayDetailState{
|
|||||||
var map = Get.arguments;
|
var map = Get.arguments;
|
||||||
if (map['getewayItemData'] != null && map['getewayItemData'] != '') {
|
if (map['getewayItemData'] != null && map['getewayItemData'] != '') {
|
||||||
getewayItemData.value = map['getewayItemData'];
|
getewayItemData.value = map['getewayItemData'];
|
||||||
|
changeGatewayNameController.text = getewayItemData.value.gatewayName!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,6 +154,7 @@ abstract class Api {
|
|||||||
final String transferGatewayConfirmURL =
|
final String transferGatewayConfirmURL =
|
||||||
'/plug/transferPlugConfirm'; // 转移网关确认
|
'/plug/transferPlugConfirm'; // 转移网关确认
|
||||||
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
final String transferGatewayURL = '/plug/transfer'; // 转移网关
|
||||||
|
final String updateGatewayURL = '/gateway/update'; // 更新网关
|
||||||
|
|
||||||
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
final String getKeyDetailURL = '/key/get'; //获取单把钥匙详情信息
|
||||||
final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
final String lockUserListURL = '/keyUser/listKeyUser'; //锁用户列表
|
||||||
|
|||||||
@ -1750,6 +1750,17 @@ class ApiProvider extends BaseProvider {
|
|||||||
'gatewayId': gatewayId,
|
'gatewayId': gatewayId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 删除网关
|
||||||
|
Future<Response> gatewayUpdate(
|
||||||
|
int gatewayId,
|
||||||
|
String gatewayName,
|
||||||
|
) => post(
|
||||||
|
updateGatewayURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'gatewayId': gatewayId,
|
||||||
|
'gatewayName': gatewayName,
|
||||||
|
}));
|
||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<Response> transferGatewayConfirmInfoData(
|
Future<Response> transferGatewayConfirmInfoData(
|
||||||
String receiverUsername, String type, String countryCode) =>
|
String receiverUsername, String type, String countryCode) =>
|
||||||
|
|||||||
@ -1925,6 +1925,15 @@ class ApiRepository {
|
|||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 网关
|
||||||
|
Future<LoginEntity> gatewayUpdate({
|
||||||
|
required int gatewayId,
|
||||||
|
required String gatewayName,
|
||||||
|
}) async {
|
||||||
|
final res = await apiProvider.gatewayUpdate(gatewayId, gatewayName);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
// 转移网关确认
|
// 转移网关确认
|
||||||
Future<RecipientInformationEntity> transferGatewayConfirmInfoData(
|
Future<RecipientInformationEntity> transferGatewayConfirmInfoData(
|
||||||
{required String receiverUsername,
|
{required String receiverUsername,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user