修复网关调试问题
This commit is contained in:
parent
a81e7ff917
commit
d947ffeeb2
@ -361,4 +361,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
COCOAPODS: 1.14.3
|
||||
|
||||
@ -51,12 +51,12 @@ class GatewayConfiguringWifiCommand extends SenderProtocol {
|
||||
data.add(subData.length);
|
||||
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);
|
||||
}
|
||||
}
|
||||
// if ((data.length % 16) != 0) {
|
||||
// final int add = 16 - data.length % 16;
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
printLog(data);
|
||||
return data;
|
||||
@ -67,7 +67,7 @@ class GatewayConfiguringWifiReply extends Reply {
|
||||
GatewayConfiguringWifiReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
final int status = data[5];
|
||||
final int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ class GatewayConfiguringWifiResultReply extends Reply {
|
||||
GatewayConfiguringWifiResultReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
final int status = data[5];
|
||||
final int status = data[2];
|
||||
errorWithStstus(status);
|
||||
}
|
||||
}
|
||||
@ -47,12 +47,12 @@ class GatewayGetWifiCommand extends SenderProtocol {
|
||||
data.add(subData.length);
|
||||
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);
|
||||
}
|
||||
}
|
||||
// if ((data.length % 16) != 0) {
|
||||
// final int add = 16 - data.length % 16;
|
||||
// for (int i = 0; i < add; i++) {
|
||||
// data.add(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
printLog(data);
|
||||
return data;
|
||||
|
||||
@ -19,29 +19,13 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
||||
final GatewayConfigurationWifiState state = GatewayConfigurationWifiState();
|
||||
|
||||
Future<void> gatewayDistributionNetwork() async{
|
||||
if(state.gatewayNamePasswardTF.text.isEmpty){
|
||||
showToast('请输入网关名称'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.wifiNameTF.text.isEmpty){
|
||||
showToast('请输入wifi名称'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.wifiPasswardTF.text.isEmpty){
|
||||
showToast('请输入WiFi密码'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final LoginEntity entity = await ApiRepository.to.gatewayDistributionNetwork(
|
||||
gatewayName: state.gatewayNamePasswardTF.text,
|
||||
gatewayMac: state.macAddress,
|
||||
gatewayMac: state.macAddress.value,
|
||||
serialNumber: DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
gatewayType: 2,
|
||||
networkName: state.wifiNameTF.text,
|
||||
networkMac: state.macAddress,
|
||||
networkMac: state.macAddress.value,
|
||||
version: '1.0.0',
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
@ -56,16 +40,40 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// WIFI配网
|
||||
// if(reply is GatewayConfiguringWifiReply) {
|
||||
// _replySenderConfiguringWifi(reply);
|
||||
// }
|
||||
|
||||
// WIFI配网结果
|
||||
if(reply is GatewayConfiguringWifiReply) {
|
||||
_replySenderConfiguringWifi(reply);
|
||||
if(reply is GatewayConfiguringWifiResultReply) {
|
||||
_replySenderConfiguringWifiResult(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// WIFI配网
|
||||
// Future<void> _replySenderConfiguringWifi(Reply reply) async {
|
||||
// final int status = reply.data[2];
|
||||
//
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// state.sureBtnState.value = 0;
|
||||
// cancelBlueConnetctToastTimer();
|
||||
// dismissEasyLoading();
|
||||
// gatewayDistributionNetwork();
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// dismissEasyLoading();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// WIFI配网结果
|
||||
Future<void> _replySenderConfiguringWifi(Reply reply) async {
|
||||
final int status = reply.data[5];
|
||||
Future<void> _replySenderConfiguringWifiResult(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
@ -75,33 +83,31 @@ class GatewayConfigurationWifiLogic extends BaseGetXController {
|
||||
dismissEasyLoading();
|
||||
gatewayDistributionNetwork();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
IoSenderManage.gatewayConfiguringWifiCommand(
|
||||
ssid: state.gatewayNamePasswardTF.text,
|
||||
password: state.wifiPasswardTF.text,
|
||||
);
|
||||
|
||||
break;
|
||||
case 0xff:
|
||||
//失败
|
||||
dismissEasyLoading();
|
||||
showToast('配网失败'.tr);
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
dismissEasyLoading();
|
||||
showToast('配网失败'.tr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 点击配置wifi
|
||||
Future<void> senderConfiguringWifiAction() async {
|
||||
if(state.gatewayNamePasswardTF.text.isEmpty){
|
||||
if(state.wifiNameTF.text.isEmpty){
|
||||
showToast('请输入wifi名称'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.wifiPasswardTF.text.isEmpty){
|
||||
showToast('请输入WiFi密码'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.gatewayNamePasswardTF.text.isEmpty){
|
||||
showToast('请输入网关名称'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.sureBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
|
||||
@ -75,11 +75,11 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: '网络MAC'.tr,
|
||||
rightTitle: '48:55:19:7d:84:7a',
|
||||
rightTitle: state.macAddress.value,
|
||||
// allHeight: 100.h,
|
||||
isHaveLine: false),
|
||||
isHaveLine: false)),
|
||||
// SizedBox(
|
||||
// height: 10.h,
|
||||
// ),
|
||||
|
||||
@ -14,7 +14,7 @@ class GatewayConfigurationWifiState{
|
||||
}
|
||||
}
|
||||
|
||||
String macAddress = '';
|
||||
RxString macAddress = ''.obs;
|
||||
RxBool isUseStaticIP = false.obs;
|
||||
|
||||
final TextEditingController wifiNameTF = TextEditingController();
|
||||
|
||||
@ -68,7 +68,7 @@ class GatewayGetWifiListLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
// 设置自动落锁数据解析
|
||||
// 获取WiFi数据解析
|
||||
Future<void> _replyGetWifiListParameters(Reply reply) async {
|
||||
final int status = reply.data[2];
|
||||
switch(status){
|
||||
@ -78,8 +78,8 @@ class GatewayGetWifiListLogic extends BaseGetXController {
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
|
||||
if (reply.data[6] > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
if (reply.data[3] > 0) {
|
||||
reply.data.removeRange(0, 4);
|
||||
// 把得到的数据按33位分割成数组 然后塞进一个新的数组里面
|
||||
final List<List<int>> getList = splitList(reply.data, 33);
|
||||
final List<Map<String, String>> uploadList = <Map<String, String>>[];
|
||||
|
||||
@ -92,8 +92,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.79+2024083001:测试所有国家国际化功能
|
||||
# 1.0.79+2024083001:测试开完锁数据上传功能
|
||||
# 1.0.80+2024091901:添加网关功能给谢敬调试
|
||||
# 1.0.80+2024091902:网关功能去掉网关通信不够16倍数凑够16倍数功能
|
||||
|
||||
version: 1.0.80+2024091901
|
||||
version: 1.0.80+2024092601
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user