修复问题
This commit is contained in:
parent
ef5a7c63fb
commit
1210ad9110
@ -27,6 +27,10 @@ PODS:
|
||||
- AMapFoundation (1.8.2)
|
||||
- AMapLocation (2.10.0):
|
||||
- AMapFoundation (>= 1.8.0)
|
||||
- audio_session (0.0.1):
|
||||
- Flutter
|
||||
- audioplayers_darwin (0.0.1):
|
||||
- Flutter
|
||||
- auto_orientation (0.0.1):
|
||||
- Flutter
|
||||
- camera_avfoundation (0.0.1):
|
||||
@ -37,22 +41,38 @@ PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_native_contact_picker (0.0.1):
|
||||
- Flutter
|
||||
- flutter_pcm_sound (0.0.1):
|
||||
- Flutter
|
||||
- flutter_sound (9.2.13):
|
||||
- Flutter
|
||||
- flutter_sound_core (= 9.2.13)
|
||||
- flutter_sound_core (9.2.13)
|
||||
- flutter_voice_processor (1.1.0):
|
||||
- Flutter
|
||||
- ios-voice-processor (~> 1.1.0)
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- g711_flutter (0.0.1):
|
||||
- Flutter
|
||||
- google_maps_flutter_ios (0.0.1):
|
||||
- Flutter
|
||||
- GoogleMaps (< 9.0)
|
||||
- GoogleMaps (5.2.0):
|
||||
- GoogleMaps/Maps (= 5.2.0)
|
||||
- GoogleMaps/Base (5.2.0)
|
||||
- GoogleMaps/Maps (5.2.0):
|
||||
- GoogleMaps (6.2.1):
|
||||
- GoogleMaps/Maps (= 6.2.1)
|
||||
- GoogleMaps/Base (6.2.1)
|
||||
- GoogleMaps/Maps (6.2.1):
|
||||
- GoogleMaps/Base
|
||||
- image_gallery_saver (2.0.2):
|
||||
- Flutter
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- ios-voice-processor (1.1.0)
|
||||
- just_audio (0.0.1):
|
||||
- Flutter
|
||||
- network_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
@ -73,7 +93,7 @@ PODS:
|
||||
- sqflite (0.0.3):
|
||||
- Flutter
|
||||
- FMDB (>= 2.7.5)
|
||||
- SwiftProtobuf (1.25.1)
|
||||
- SwiftProtobuf (1.25.2)
|
||||
- Toast (4.0.0)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
@ -88,14 +108,22 @@ DEPENDENCIES:
|
||||
- aliyun_push (from `.symlinks/plugins/aliyun_push/ios`)
|
||||
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
|
||||
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
|
||||
- audio_session (from `.symlinks/plugins/audio_session/ios`)
|
||||
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
|
||||
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
|
||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||
- flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`)
|
||||
- flutter_sound (from `.symlinks/plugins/flutter_sound/ios`)
|
||||
- flutter_voice_processor (from `.symlinks/plugins/flutter_voice_processor/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- g711_flutter (from `.symlinks/plugins/g711_flutter/ios`)
|
||||
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
||||
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- just_audio (from `.symlinks/plugins/just_audio/ios`)
|
||||
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
@ -119,8 +147,10 @@ SPEC REPOS:
|
||||
- AMap3DMap
|
||||
- AMapFoundation
|
||||
- AMapLocation
|
||||
- flutter_sound_core
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
- ios-voice-processor
|
||||
- Protobuf
|
||||
- SwiftProtobuf
|
||||
- Toast
|
||||
@ -134,6 +164,10 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/amap_flutter_location/ios"
|
||||
amap_flutter_map:
|
||||
:path: ".symlinks/plugins/amap_flutter_map/ios"
|
||||
audio_session:
|
||||
:path: ".symlinks/plugins/audio_session/ios"
|
||||
audioplayers_darwin:
|
||||
:path: ".symlinks/plugins/audioplayers_darwin/ios"
|
||||
auto_orientation:
|
||||
:path: ".symlinks/plugins/auto_orientation/ios"
|
||||
camera_avfoundation:
|
||||
@ -144,12 +178,24 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter
|
||||
flutter_native_contact_picker:
|
||||
:path: ".symlinks/plugins/flutter_native_contact_picker/ios"
|
||||
flutter_pcm_sound:
|
||||
:path: ".symlinks/plugins/flutter_pcm_sound/ios"
|
||||
flutter_sound:
|
||||
:path: ".symlinks/plugins/flutter_sound/ios"
|
||||
flutter_voice_processor:
|
||||
:path: ".symlinks/plugins/flutter_voice_processor/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
g711_flutter:
|
||||
:path: ".symlinks/plugins/g711_flutter/ios"
|
||||
google_maps_flutter_ios:
|
||||
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
||||
image_gallery_saver:
|
||||
:path: ".symlinks/plugins/image_gallery_saver/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
just_audio:
|
||||
:path: ".symlinks/plugins/just_audio/ios"
|
||||
network_info_plus:
|
||||
:path: ".symlinks/plugins/network_info_plus/ios"
|
||||
package_info_plus:
|
||||
@ -184,17 +230,27 @@ SPEC CHECKSUMS:
|
||||
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
|
||||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
||||
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
|
||||
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
|
||||
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
|
||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
||||
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
|
||||
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
|
||||
flutter_voice_processor: 53afbf59ad3feb82f4a379fea9ed8dc98495210f
|
||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
g711_flutter: 8f2769052d2cf3549f83d11e1c42d81d94441123
|
||||
google_maps_flutter_ios: 590249c67f34f422122c232f2a626192adbc78ee
|
||||
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
|
||||
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
||||
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
|
||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
||||
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1
|
||||
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
|
||||
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
|
||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
@ -203,12 +259,12 @@ SPEC CHECKSUMS:
|
||||
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
||||
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
|
||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||
SwiftProtobuf: 69f02cd54fb03201c5e6bf8b76f687c5ef7541a3
|
||||
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
|
||||
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
|
||||
PODFILE CHECKSUM: adf6d8caf5faa9ea4ee2a2ea37f5aea37a6520d7
|
||||
PODFILE CHECKSUM: 42aa7ffc6134b996f93caa6a9b6a2b5b580ff28a
|
||||
|
||||
COCOAPODS: 1.14.3
|
||||
|
||||
@ -65,6 +65,10 @@
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
|
||||
@ -58,10 +58,7 @@ class BlueManage {
|
||||
}
|
||||
|
||||
void _initSendStreamSubscription() {
|
||||
_sendStreamSubscription ??= EventBusManager()
|
||||
.eventBus!
|
||||
.on<EventSendModel>()
|
||||
.listen((EventSendModel model) {
|
||||
_sendStreamSubscription ??= EventBusManager().eventBus!.on<EventSendModel>().listen((EventSendModel model) {
|
||||
if (model.sendChannel == DataChannel.ble) {
|
||||
// managerAppWriteData(model.data);
|
||||
writeCharacteristicWithResponse(model.data);
|
||||
@ -72,21 +69,15 @@ class BlueManage {
|
||||
/// 开始扫描蓝牙设备
|
||||
void startScan({List<Uuid>? idList}) {
|
||||
scanDevices.clear();
|
||||
_scanSubscription = _flutterReactiveBle!
|
||||
.scanForDevices(withServices: idList ?? [])
|
||||
.listen((device) {
|
||||
_scanSubscription = _flutterReactiveBle!.scanForDevices(withServices: idList ?? []).listen((device) {
|
||||
// 判断名字为空的直接剔除
|
||||
if (device.name.isEmpty) {
|
||||
return;
|
||||
}
|
||||
// print("startScanDevice:$device");
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "")
|
||||
.toString()
|
||||
.contains("758824")) &&
|
||||
(device.rssi >= -100)) {
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString().contains("758824")) && (device.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex =
|
||||
scanDevices.indexWhere((d) => d.id == device.id);
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.id == device.id);
|
||||
// 不存在的时候返回-1
|
||||
if (knownDeviceIndex >= 0) {
|
||||
scanDevices[knownDeviceIndex] = device;
|
||||
@ -115,9 +106,7 @@ class BlueManage {
|
||||
Future<void> _connect(String deviceName, ConnectStateCallBack connectStateCallBack) async {
|
||||
connectDeviceName = deviceName;
|
||||
// 判断数组列表里面是否有这个设备
|
||||
final knownDeviceIndex =
|
||||
scanDevices.indexWhere((d) => d.name == deviceName);
|
||||
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.name == deviceName);
|
||||
if (knownDeviceIndex >= 0) {
|
||||
// 存在的时候赋值
|
||||
connectDeviceMacAddress = scanDevices[knownDeviceIndex].id;
|
||||
@ -156,21 +145,17 @@ class BlueManage {
|
||||
// 等待Completer完成
|
||||
await completer.future;
|
||||
}
|
||||
print(
|
||||
"connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
print("connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
|
||||
if (connectDeviceMacAddress.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_currentConnectionStream = _flutterReactiveBle!.connectToDevice(id: connectDeviceMacAddress, connectionTimeout: const Duration(seconds: 10)).listen((connectionStateUpdate) async {
|
||||
// 获取状态
|
||||
deviceConnectionState = connectionStateUpdate.connectionState;
|
||||
print(
|
||||
'deviceConnectionState:$deviceConnectionState connectionStateUpdate.connectionState:${connectionStateUpdate.connectionState}');
|
||||
if (connectionStateUpdate.connectionState ==
|
||||
DeviceConnectionState.connected) {
|
||||
print('deviceConnectionState:$deviceConnectionState connectionStateUpdate.connectionState:${connectionStateUpdate.connectionState}');
|
||||
if (connectionStateUpdate.connectionState == DeviceConnectionState.connected) {
|
||||
// 如果状态是连接的开始发现服务
|
||||
try {
|
||||
_subScribeToCharacteristic(QualifiedCharacteristic(characteristicId: characteristicIdSubscription, serviceId: serviceIdConnect, deviceId: connectDeviceMacAddress));
|
||||
@ -188,13 +173,11 @@ class BlueManage {
|
||||
deviceConnectionState = connectionStateUpdate.connectionState;
|
||||
connectStateCallBack(deviceConnectionState!);
|
||||
}
|
||||
print(
|
||||
'ConnectionState for device $connectDeviceMacAddress : ${connectionStateUpdate.connectionState}');
|
||||
print('ConnectionState for device $connectDeviceMacAddress : ${connectionStateUpdate.connectionState}');
|
||||
}, onError: (Object e) {
|
||||
deviceConnectionState = DeviceConnectionState.disconnected;
|
||||
connectStateCallBack(deviceConnectionState!);
|
||||
print(
|
||||
'Connecting to device $connectDeviceMacAddress resulted in error $e');
|
||||
print('Connecting to device $connectDeviceMacAddress resulted in error $e');
|
||||
});
|
||||
}
|
||||
|
||||
@ -202,26 +185,21 @@ class BlueManage {
|
||||
var allData = <int>[];
|
||||
int? dataLen;
|
||||
_subScribeToCharacteristic(QualifiedCharacteristic characteristic) {
|
||||
_flutterReactiveBle!.subscribeToCharacteristic(characteristic).listen(
|
||||
(data) {
|
||||
_flutterReactiveBle!.subscribeToCharacteristic(characteristic).listen((data) {
|
||||
// code to handle incoming data
|
||||
print(
|
||||
"subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
if ((data[0] == 0xEF) &&
|
||||
(data[1] == 0x01) &&
|
||||
(data[2] == 0xEE) &&
|
||||
(data[3] == 0x02)) {
|
||||
// print("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
||||
if ((data[0] == 0xEF) && (data[1] == 0x01) && (data[2] == 0xEE) && (data[3] == 0x02)) {
|
||||
// 当包有头时
|
||||
// 判断是否需要分包
|
||||
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||
print("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
// print("dataLen1111:$dataLen getDataLength:${data.length}");
|
||||
if (dataLen! + 12 > data.length) {
|
||||
// 当前包的长度小于实际的包时 分包添加 不解析
|
||||
allData.addAll(data);
|
||||
} else {
|
||||
// 当前包的长度小于实际的包时 不分包 解析
|
||||
allData.addAll(data);
|
||||
print("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
// print("dataLen2222:$dataLen getDataLength:${data.length}");
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
allData = <int>[];
|
||||
@ -230,9 +208,9 @@ class BlueManage {
|
||||
// 当包没有头时 是分包的包 直接添加
|
||||
allData.addAll(data);
|
||||
// var len = allData[8] * 256 + allData[9];
|
||||
print("dataLen3333:$dataLen");
|
||||
// print("dataLen3333:$dataLen");
|
||||
if ((dataLen! + 14) <= allData.length) {
|
||||
print("44444数据被解析了");
|
||||
// print("44444数据被解析了");
|
||||
// 当长度小于等于当前包的数据时 直接解析数据
|
||||
CommandReciverManager.appDataReceive(allData);
|
||||
// 发送完解析初始化数组
|
||||
|
||||
@ -128,6 +128,10 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}校验错误");
|
||||
|
||||
break;
|
||||
case 0xff:
|
||||
//成功
|
||||
Toast.show(msg: "配网失败");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -141,8 +145,8 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
Future<void> senderConfiguringWifiAction() async {
|
||||
showEasyLoading();
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
dismissEasyLoading();
|
||||
if (connectionState == DeviceConnectionState.connected){
|
||||
dismissEasyLoading();
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -169,13 +173,13 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
serversList.add(int.parse(element));
|
||||
}
|
||||
print('Resolved google.com to address: ${addresses.first.address} serversList:${serversList}');
|
||||
|
||||
double typeDouble = int.parse(item.port!) / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = int.parse(item.port!) % 256;
|
||||
serversList.add(type1);
|
||||
serversList.add(type2);
|
||||
}
|
||||
|
||||
double typeDouble = int.parse(item.port!) / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = int.parse(item.port!) % 256;
|
||||
serversList.add(type1);
|
||||
serversList.add(type2);
|
||||
}
|
||||
|
||||
String? phone = '';
|
||||
@ -200,6 +204,9 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (connectionState == DeviceConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -27,9 +27,7 @@ import 'checkingInInfoData_entity.dart';
|
||||
import 'lockSet_state.dart';
|
||||
|
||||
typedef BlockSetStateCallback = void Function();
|
||||
typedef BlockSetCheckInCallback = void Function(
|
||||
CheckingInInfoDataEntity checkingInInfoDataEntity);
|
||||
typedef BlockDeletNumberCheckPasswordCallback = void Function();
|
||||
typedef BlockSetCheckInCallback = void Function(CheckingInInfoDataEntity checkingInInfoDataEntity);
|
||||
|
||||
class LockSetLogic extends BaseGetXController {
|
||||
final LockSetState state = LockSetState();
|
||||
@ -258,9 +256,10 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 删除用户
|
||||
Future<void> deletUserAction() async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName,
|
||||
(DeviceConnectionState connectionState) async {
|
||||
showEasyLoading();
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -283,6 +282,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (connectionState == DeviceConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
}
|
||||
});
|
||||
@ -291,8 +291,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
// 恢复出厂设置
|
||||
Future<void> factoryDataResetAction() async {
|
||||
showEasyLoading();
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName,
|
||||
(DeviceConnectionState connectionState) async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -348,8 +347,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
// 设置支持功能(带参数)
|
||||
Future<void> sendBurglarAlarm(int type) async {
|
||||
showEasyLoading();
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName,
|
||||
(DeviceConnectionState connectionState) async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -473,41 +471,32 @@ class LockSetLogic extends BaseGetXController {
|
||||
password: state.passwordTF.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// blockDeletNumberCheckPasswordCallback();
|
||||
Get.back();
|
||||
|
||||
// if(state.currentDeviceUUid.value[31] == "1"){
|
||||
|
||||
// 判断是否是锁的拥有者
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// 判断是否扫描到当前设备 调用删除锁协议
|
||||
factoryDataResetAction();
|
||||
} else {
|
||||
// 判断是否扫描到当前设备
|
||||
if (BlueManage().connectDeviceMacAddress.isNotEmpty) {
|
||||
// 调用删除钥匙协议
|
||||
deletUserAction();
|
||||
} else {
|
||||
if(state.currentDeviceUUid.value.isEmpty){
|
||||
// 扫描到的设备列表里面灭有 直接弹窗调用删除锁接口
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
}else{
|
||||
// 当扫描的数组里面是否有当前设备
|
||||
if(state.currentDeviceUUid.value[31] == "1"){
|
||||
// 已配对 表示这把锁未被初始化,还处于被添加状态
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// 如果是锁拥有者直接删除锁,调用初始化协议
|
||||
factoryDataResetAction();
|
||||
} else {
|
||||
// 不是锁拥有者,调用删除钥匙协议
|
||||
deletUserAction();
|
||||
}
|
||||
}else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// 未配对 表示这把锁已被强制初始化 处于可添加状态 直接弹窗删除即可
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
}
|
||||
}
|
||||
|
||||
// }else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// // 未配对
|
||||
// if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// // 直接调用删除锁接口
|
||||
// deletLockInfoData();
|
||||
// }else{
|
||||
// // 直接调用删除要是接口
|
||||
// deletKeyData();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// 开启考勤获取是否有公司
|
||||
void openCheckingInData(
|
||||
BlockSetCheckInCallback blockSetCheckInCallback) async {
|
||||
void openCheckingInData(BlockSetCheckInCallback blockSetCheckInCallback) async {
|
||||
var entity = await ApiRepository.to.openCheckingInData(
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
);
|
||||
@ -528,10 +517,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
state.isAttendance.value = (state.isAttendance.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.attendance = state.isAttendance.value;
|
||||
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
|
||||
0, state.lockSettingInfo.value.attendance!));
|
||||
print(
|
||||
"state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, state.lockSettingInfo.value.attendance!));
|
||||
print("state.lockSettingInfo.value.attendance:${state.lockSettingInfo.value.attendance}");
|
||||
Toast.show(msg: "设置成功");
|
||||
}
|
||||
}
|
||||
@ -545,10 +532,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
|
||||
state.isLockPickingReminder.value =
|
||||
(state.isLockPickingReminder.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.unlockReminderPush =
|
||||
state.isLockPickingReminder.value;
|
||||
state.isLockPickingReminder.value = (state.isLockPickingReminder.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.unlockReminderPush = state.isLockPickingReminder.value;
|
||||
Toast.show(msg: "设置成功");
|
||||
} else {}
|
||||
}
|
||||
@ -562,15 +547,11 @@ class LockSetLogic extends BaseGetXController {
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
|
||||
state.isOpenLockNeedOnline.value =
|
||||
(state.isOpenLockNeedOnline.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.appUnlockOnline =
|
||||
state.isOpenLockNeedOnline.value;
|
||||
state.isOpenLockNeedOnline.value = (state.isOpenLockNeedOnline.value == 1 ? 0 : 1);
|
||||
state.lockSettingInfo.value.appUnlockOnline = state.isOpenLockNeedOnline.value;
|
||||
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(
|
||||
0, state.lockSettingInfo.value.appUnlockOnline!));
|
||||
print(
|
||||
"state.lockSettingInfo.value.appUnlockOnline:${state.lockSettingInfo.value.appUnlockOnline}");
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, state.lockSettingInfo.value.appUnlockOnline!));
|
||||
print("state.lockSettingInfo.value.appUnlockOnline:${state.lockSettingInfo.value.appUnlockOnline}");
|
||||
Toast.show(msg: "设置成功");
|
||||
}
|
||||
}
|
||||
@ -579,21 +560,20 @@ class LockSetLogic extends BaseGetXController {
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent =
|
||||
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
// state.lockSetInfoData.value = event.keyInfo;
|
||||
blockSetStateCallback();
|
||||
});
|
||||
}
|
||||
|
||||
// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据
|
||||
StreamSubscription? _scanAllDeviceFindCurrentDeviceConnectedEvent;
|
||||
void initLoadDataScanAllDeviceFindCurrentDeviceAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_scanAllDeviceFindCurrentDeviceConnectedEvent = eventBus
|
||||
.on<ScanAllDeviceFindCurrentDeviceConnectedEvent>()
|
||||
.listen((event) {
|
||||
state.currentDeviceUUid.value = event.uuid;
|
||||
late StreamSubscription<List<DiscoveredDevice>>_scanListDiscoveredDeviceSubscription;
|
||||
void _scanListDiscoveredDeviceSubscriptionAction() {
|
||||
_scanListDiscoveredDeviceSubscription = EventBusManager().eventBus!.on<List<DiscoveredDevice>>().listen((List<DiscoveredDevice> list) {
|
||||
final knownDeviceIndex = list.indexWhere((d) => d.name == BlueManage().connectDeviceName);
|
||||
if (knownDeviceIndex >= 0) {
|
||||
// 存在的时候赋值
|
||||
state.currentDeviceUUid.value = (list[knownDeviceIndex].serviceUuids.isNotEmpty ? list[knownDeviceIndex].serviceUuids[0] : "").toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -615,8 +595,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner ==
|
||||
1) {
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// 直接调用删除锁接口
|
||||
deletLockInfoData();
|
||||
} else {
|
||||
@ -640,7 +619,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
getLockSettingInfoData();
|
||||
|
||||
_initReplySubscription();
|
||||
initLoadDataScanAllDeviceFindCurrentDeviceAction();
|
||||
_scanListDiscoveredDeviceSubscriptionAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -655,6 +634,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
_passCurrentLockInformationEvent!.cancel();
|
||||
_scanAllDeviceFindCurrentDeviceConnectedEvent!.cancel();
|
||||
_scanListDiscoveredDeviceSubscription.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,11 +65,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 开门数据解析
|
||||
Future<void> _replyOpenLock(Reply reply) async {
|
||||
var tokenData = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(tokenData);
|
||||
print("openDoorToken:$tokenData");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
print("status:$status");
|
||||
|
||||
@ -98,6 +93,11 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var tokenData = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(tokenData);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
print("openDoorToken:$tokenData");
|
||||
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
@ -353,14 +353,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
bool isHave = await Storage.ifHaveKey(saveBlueToken);
|
||||
List<int> getTokenList;
|
||||
if (isHave) {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
getTokenList = changeStringListToIntList(token!);
|
||||
} else {
|
||||
getTokenList = [0, 0, 0, 0];
|
||||
}
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
print("openDoorTokenPubToken:$getTokenList getPrivateKeyList:$getPrivateKeyList");
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
@ -374,7 +369,10 @@ class LockDetailLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
}else if (deviceConnectionState == DeviceConnectionState.disconnected){
|
||||
Toast.show(msg: "连接设备失败,请确保在设备附近,设备未被连接,设备已打开");
|
||||
if(state.lockState.value != 2){
|
||||
// 2的状态是从已经连接上了 然后没有进行任何操作 锁板主动断开了 所以只需要改变开锁按钮状态不需要弹出toast
|
||||
Toast.show(msg: "连接设备失败,请确保在设备附近,设备未被连接,设备已打开");
|
||||
}
|
||||
state.lockState.value = 4;
|
||||
state.animationController.reset();
|
||||
state.animationController.forward();
|
||||
|
||||
@ -66,7 +66,8 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
||||
var saveSignKeyList = changeIntListToStringList(signKeyData);
|
||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||
|
||||
Storage.setStringList(saveBlueToken, [0, 0, 0, 0]);
|
||||
var saveTokenList = changeIntListToStringList([0, 0, 0, 0]);
|
||||
Storage.setStringList(saveBlueToken, saveTokenList);
|
||||
// logic.startScanAction();
|
||||
|
||||
listeningAnimations();
|
||||
|
||||
@ -396,7 +396,9 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
print("锁详情界面销毁了");
|
||||
_getTVDataRefreshUIEvent!.cancel();
|
||||
_getUDPStatusRefreshUIEvent!.cancel();
|
||||
state.oneMinuteTimeTimer.cancel();
|
||||
if(state.oneMinuteTimeTimer != null){
|
||||
state.oneMinuteTimeTimer.cancel();
|
||||
}
|
||||
stopProcessing();
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
IoSenderManage.getPublicKey(lockId: deviceName);
|
||||
}else if (state == DeviceConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
showBlueConnetctToast();
|
||||
// showBlueConnetctToast();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -181,8 +181,7 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
var serialNum0 = reply.data.sublist(84, 100);
|
||||
var serialNum0Str = utf8String(serialNum0);
|
||||
// state.lockInfo["serialNum0"] = serialNum0Str;
|
||||
state.lockInfo["serialNum0"] =
|
||||
"${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||
state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||
// print("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
|
||||
|
||||
// 成品商序列号
|
||||
@ -345,19 +344,13 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
late StreamSubscription<List<DiscoveredDevice>>
|
||||
_scanListDiscoveredDeviceSubscription;
|
||||
late StreamSubscription<List<DiscoveredDevice>>_scanListDiscoveredDeviceSubscription;
|
||||
void _scanListDiscoveredDeviceSubscriptionAction() {
|
||||
_scanListDiscoveredDeviceSubscription = EventBusManager()
|
||||
.eventBus!
|
||||
.on<List<DiscoveredDevice>>()
|
||||
.listen((List<DiscoveredDevice> list) {
|
||||
_scanListDiscoveredDeviceSubscription = EventBusManager().eventBus!.on<List<DiscoveredDevice>>().listen((List<DiscoveredDevice> list) {
|
||||
state.devices.clear();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
DiscoveredDevice device = list[i];
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "")
|
||||
.toString()[31] !=
|
||||
"1")) {
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString()[31] != "1")) {
|
||||
state.devices.add(list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,10 +103,13 @@ class SaveLockLogic extends BaseGetXController {
|
||||
|
||||
// 添加用户
|
||||
Future<void> addUserConnectBlue() async {
|
||||
// print("111111");
|
||||
// 进来之后首先连接
|
||||
showEasyLoading();
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||
// print("222222");
|
||||
if (state == DeviceConnectionState.connected){
|
||||
// print("333333");
|
||||
dismissEasyLoading();
|
||||
// 私钥
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -138,6 +141,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
token: getTokenList
|
||||
);
|
||||
} else if (state == DeviceConnectionState.disconnected) {
|
||||
print("444444");
|
||||
dismissEasyLoading();
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
@ -212,7 +216,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_replySubscription.cancel();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
abstract class Api {
|
||||
static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境
|
||||
// static String baseAddress = "http://192.168.56.101:8099"; //联调环境
|
||||
// static String baseAddress = "https://pre.lock.star-lock.cn:8093"; //预发布环境
|
||||
static String baseAddress = "http://192.168.56.101:8099"; //联调环境
|
||||
// static String baseAddress = "http://192.168.1.15:8022"; //谢总本地
|
||||
|
||||
final String baseUrl = "$baseAddress/api";
|
||||
|
||||
|
||||
@ -32,12 +32,6 @@ class ChickInAddStaffCardAndFingerprintBlockNumberEvent {
|
||||
ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number);
|
||||
}
|
||||
|
||||
/// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据
|
||||
class ScanAllDeviceFindCurrentDeviceConnectedEvent {
|
||||
String uuid;
|
||||
ScanAllDeviceFindCurrentDeviceConnectedEvent(this.uuid);
|
||||
}
|
||||
|
||||
/// 多语言 切换之后传值到上一级界面
|
||||
class ChangeLanguageBlockLastLanguageEvent {
|
||||
String languageTitle;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user