Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
e9681e01a3
@ -17,6 +17,12 @@ typedef ConnectStateCallBack = Function(
|
|||||||
typedef ScanDevicesCallBack = Function(List<ScanResult>);
|
typedef ScanDevicesCallBack = Function(List<ScanResult>);
|
||||||
|
|
||||||
class BlueManage {
|
class BlueManage {
|
||||||
|
|
||||||
|
factory BlueManage() => shareManager()!;
|
||||||
|
|
||||||
|
BlueManage._init() {
|
||||||
|
_initBlue();
|
||||||
|
}
|
||||||
final List<ScanResult> scanDevices = <ScanResult>[];
|
final List<ScanResult> scanDevices = <ScanResult>[];
|
||||||
|
|
||||||
// 用来写入的服务id
|
// 用来写入的服务id
|
||||||
@ -34,12 +40,6 @@ class BlueManage {
|
|||||||
// 监听发送事件
|
// 监听发送事件
|
||||||
StreamSubscription<EventSendModel>? _sendStreamSubscription;
|
StreamSubscription<EventSendModel>? _sendStreamSubscription;
|
||||||
|
|
||||||
// 监听蓝牙扫描的事件
|
|
||||||
// StreamSubscription? _scanSubscription;
|
|
||||||
// 监听蓝牙连接的事件
|
|
||||||
// StreamSubscription<dynamic>? _currentConnectionStream;
|
|
||||||
|
|
||||||
// StreamSubscription<List<ScanResult>>? _scanResultsSubscription;
|
|
||||||
StreamSubscription<BluetoothConnectionState>? _connectionStateSubscription;
|
StreamSubscription<BluetoothConnectionState>? _connectionStateSubscription;
|
||||||
|
|
||||||
StreamSubscription<int>? _mtuSubscription;
|
StreamSubscription<int>? _mtuSubscription;
|
||||||
@ -64,11 +64,14 @@ class BlueManage {
|
|||||||
BluetoothAdapterState? _adapterState = BluetoothAdapterState.unknown;
|
BluetoothAdapterState? _adapterState = BluetoothAdapterState.unknown;
|
||||||
StreamSubscription<BluetoothAdapterState>? _adapterStateStateSubscription;
|
StreamSubscription<BluetoothAdapterState>? _adapterStateStateSubscription;
|
||||||
|
|
||||||
static BlueManage? _manager;
|
// 听上报来的数据,参数来自前面扫描到的结果
|
||||||
|
List<int> allData = <int>[];
|
||||||
|
|
||||||
BlueManage._init() {
|
// 保存上一次的数据,用来判断是否收到重复的数据
|
||||||
_initBlue();
|
List<int> lastTimeData = <int>[];
|
||||||
}
|
int? dataLen;
|
||||||
|
|
||||||
|
static BlueManage? _manager;
|
||||||
|
|
||||||
static BlueManage? shareManager() {
|
static BlueManage? shareManager() {
|
||||||
_manager ??= BlueManage._init();
|
_manager ??= BlueManage._init();
|
||||||
@ -76,16 +79,12 @@ class BlueManage {
|
|||||||
return _manager;
|
return _manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory BlueManage() => shareManager()!;
|
|
||||||
|
|
||||||
BlueManage? get manager => shareManager();
|
BlueManage? get manager => shareManager();
|
||||||
|
|
||||||
void _initBlue() {
|
void _initBlue() {
|
||||||
FlutterBluePlus.setLogLevel(LogLevel.error, color: true);
|
FlutterBluePlus.setLogLevel(LogLevel.error, color: true);
|
||||||
_initSendStreamSubscription();
|
_initSendStreamSubscription();
|
||||||
_initAdapterStateStateSubscription();
|
_initAdapterStateStateSubscription();
|
||||||
// _initListenscanResults();
|
|
||||||
// _initListenConnectionState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _initGetMtuSubscription() {
|
void _initGetMtuSubscription() {
|
||||||
@ -102,45 +101,6 @@ class BlueManage {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// void _initListenscanResults() {
|
|
||||||
// var subscription = FlutterBluePlus.scanResults.listen((results) {
|
|
||||||
// scanDevices.clear();
|
|
||||||
// for (var scanResult in results) {
|
|
||||||
// // 判断名字为空的直接剔除
|
|
||||||
// // if (scanResult.device.advName.isEmpty) {
|
|
||||||
// // return;
|
|
||||||
// // }
|
|
||||||
// AppLog.log("scanResult.device.advName:${scanResult.device.advName}"
|
|
||||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
|
||||||
// " rssi:${scanResult.rssi}");
|
|
||||||
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
|
||||||
// // 查询id相同的元素
|
|
||||||
// final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
|
||||||
// // 不存在的时候返回-1
|
|
||||||
// if (knownDeviceIndex >= 0) {
|
|
||||||
// scanDevices[knownDeviceIndex] = scanResult;
|
|
||||||
// } else {
|
|
||||||
// scanDevices.add(scanResult);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// EventBusManager().eventBusFir(scanDevices);
|
|
||||||
// // FlutterBluePlus.stopScan();
|
|
||||||
// }, onError: (e) {
|
|
||||||
// AppLog.log("Scan Error:$e", );
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// FlutterBluePlus.cancelWhenScanComplete(subscription);
|
|
||||||
|
|
||||||
// FlutterBluePlus.isScanning.listen((state) {
|
|
||||||
// if (state) {
|
|
||||||
// prAppLog.logint('Scanning');
|
|
||||||
// } else {
|
|
||||||
// AppLog.log('Not scanning');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
void _initListenConnectionState() {
|
void _initListenConnectionState() {
|
||||||
_connectionStateSubscription?.cancel();
|
_connectionStateSubscription?.cancel();
|
||||||
_connectionStateSubscription = null;
|
_connectionStateSubscription = null;
|
||||||
@ -185,7 +145,7 @@ class BlueManage {
|
|||||||
if (_adapterState == BluetoothAdapterState.on) {
|
if (_adapterState == BluetoothAdapterState.on) {
|
||||||
try {
|
try {
|
||||||
//android 扫描比较慢,取样只要 8 分之一
|
//android 扫描比较慢,取样只要 8 分之一
|
||||||
final int divisor = Platform.isAndroid ? 8 : 1;
|
final int divisor = Platform.isAndroid ? 3 : 1;
|
||||||
FlutterBluePlus.startScan(
|
FlutterBluePlus.startScan(
|
||||||
continuousDivisor: divisor,
|
continuousDivisor: divisor,
|
||||||
continuousUpdates: true,
|
continuousUpdates: true,
|
||||||
@ -316,7 +276,7 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 调用发送数据 List senderData,
|
/// 调用发送数据 List senderData,
|
||||||
Future<void> bludSendData(
|
Future<void> blueSendData(
|
||||||
String deviceName, ConnectStateCallBack stateCallBack,
|
String deviceName, ConnectStateCallBack stateCallBack,
|
||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
FlutterBluePlus.isSupported.then((bool isAvailable) async {
|
||||||
@ -368,14 +328,13 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查找缓存里面是否有设备
|
//查找缓存里面是否有设备
|
||||||
bool isExistScanDevices(String connectDeviceName){
|
bool isExistScanDevices(String connectDeviceName) {
|
||||||
final bool isExistDevice = scanDevices.any((ScanResult element) =>
|
final bool isExistDevice = scanDevices.any((ScanResult element) =>
|
||||||
element.device.platformName == connectDeviceName ||
|
element.device.platformName == connectDeviceName ||
|
||||||
element.advertisementData.advName == connectDeviceName);
|
element.advertisementData.advName == connectDeviceName);
|
||||||
return isExistDevice;
|
return isExistDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> _connectDevice(List<ScanResult> devicesList, String deviceName,
|
Future<void> _connectDevice(List<ScanResult> devicesList, String deviceName,
|
||||||
ConnectStateCallBack connectStateCallBack,
|
ConnectStateCallBack connectStateCallBack,
|
||||||
{bool isAddEquipment = false}) async {
|
{bool isAddEquipment = false}) async {
|
||||||
@ -400,13 +359,9 @@ class BlueManage {
|
|||||||
_initGetMtuSubscription();
|
_initGetMtuSubscription();
|
||||||
_initListenConnectionState();
|
_initListenConnectionState();
|
||||||
}
|
}
|
||||||
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
|
||||||
// stopScan();
|
|
||||||
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
|
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
|
||||||
// connectStateCallBack(BluetoothConnectionState.disconnected!);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppLog.log("调用了停止扫描的方法");
|
// AppLog.log("调用了停止扫描的方法");
|
||||||
await stopScan();
|
await stopScan();
|
||||||
|
|
||||||
@ -438,28 +393,18 @@ class BlueManage {
|
|||||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// await bluetoothConnectDevice!.connect();
|
|
||||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||||
try {
|
try {
|
||||||
bluetoothConnectDevice!
|
bluetoothConnectDevice!
|
||||||
.discoverServices()
|
.discoverServices()
|
||||||
.then((List<BluetoothService> services) {
|
.then((List<BluetoothService> services) {
|
||||||
for (final BluetoothService service in services) {
|
for (final BluetoothService service in services) {
|
||||||
// AppLog.log("11111service.remoteId:${service.remoteId}"
|
|
||||||
// " service.uuid:${service.uuid}"
|
|
||||||
// " service.characteristics:${service.characteristics}"
|
|
||||||
// " service.includedServices:${service.includedServices}");
|
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (final BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
|
|
||||||
// " characteristic.uuid:${characteristic.uuid}"
|
|
||||||
// " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}"
|
|
||||||
// " characteristic.characteristicUuid:${characteristic.characteristicUuid}");
|
|
||||||
if (characteristic.characteristicUuid ==
|
if (characteristic.characteristicUuid ==
|
||||||
_characteristicIdSubscription) {
|
_characteristicIdSubscription) {
|
||||||
_subScribeToCharacteristic(characteristic);
|
_subScribeToCharacteristic(characteristic);
|
||||||
// AppLog.log('Discovering services finished');
|
|
||||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||||
connectStateCallBack(bluetoothConnectionState!);
|
connectStateCallBack(bluetoothConnectionState!);
|
||||||
}
|
}
|
||||||
@ -477,49 +422,41 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 听上报来的数据,参数来自前面扫描到的结果
|
|
||||||
List<int> allData = <int>[];
|
|
||||||
|
|
||||||
// 保存上一次的数据,用来判断是否收到重复的数据
|
|
||||||
List<int> lastTimeData = <int>[];
|
|
||||||
int? dataLen;
|
|
||||||
|
|
||||||
Future<void> _subScribeToCharacteristic(
|
Future<void> _subScribeToCharacteristic(
|
||||||
BluetoothCharacteristic characteristic) async {
|
BluetoothCharacteristic characteristic) async {
|
||||||
final StreamSubscription<List<int>> subscription =
|
final StreamSubscription<List<int>> subscription =
|
||||||
characteristic.onValueReceived.listen((List<int> data) {
|
characteristic.onValueReceived.listen((List<int> data) {
|
||||||
// AppLog.log("订阅获取的数据:$data");
|
AppLog.log('订阅获取的数据: $data ');
|
||||||
if (data == lastTimeData || data.isEmpty) {
|
if (data == lastTimeData || data.isEmpty) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
lastTimeData = data;
|
lastTimeData = data;
|
||||||
}
|
}
|
||||||
// code to handle incoming data
|
final bool dataHeadCorrect = isDataHeadCorrect(data);
|
||||||
// AppLog.log("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
|
final bool allDataHeadCorrect = isDataHeadCorrect(allData);
|
||||||
if ((data[0] == 0xEF) &&
|
if (dataHeadCorrect && allDataHeadCorrect) {
|
||||||
(data[1] == 0x01) &&
|
//缓存数据和新数据都有包头,直接放弃缓存数据
|
||||||
(data[2] == 0xEE) &&
|
allData = <int>[];
|
||||||
(data[3] == 0x02)) {
|
}
|
||||||
|
if (dataHeadCorrect) {
|
||||||
// 当包有头时
|
// 当包有头时
|
||||||
// 判断是否需要分包
|
// 判断是否需要分包
|
||||||
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||||
// AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
|
|
||||||
if (dataLen! + 14 > data.length) {
|
if (dataLen! + 14 > data.length) {
|
||||||
// 当前包的长度小于实际的包时 分包添加 不解析
|
// 当前包的长度小于实际的包时 分包添加 不解析
|
||||||
allData.addAll(data);
|
allData.addAll(data);
|
||||||
} else {
|
} else {
|
||||||
// 当前包的长度小于实际的包时 不分包 解析
|
// 当前包的长度小于实际的包时 不分包 解析
|
||||||
allData.addAll(data);
|
allData.addAll(data);
|
||||||
// AppLog.log("dataLen2222:$dataLen getDataLength:${data.length}");
|
|
||||||
CommandReciverManager.appDataReceive(allData);
|
CommandReciverManager.appDataReceive(allData);
|
||||||
// 发送完解析初始化数组
|
// 发送完解析初始化数组
|
||||||
allData = <int>[];
|
allData = <int>[];
|
||||||
}
|
}
|
||||||
} else {
|
} else if (allDataHeadCorrect) {
|
||||||
// 当包没有头时 是分包的包 直接添加
|
// 当包没有头时 是分包的包 直接添加
|
||||||
allData.addAll(data);
|
allData.addAll(data);
|
||||||
// var len = allData[8] * 256 + allData[9];
|
|
||||||
// AppLog.log("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
|
|
||||||
if (((dataLen ?? 0) + 14) <= allData.length) {
|
if (((dataLen ?? 0) + 14) <= allData.length) {
|
||||||
// 当长度小于等于当前包的数据时 直接解析数据
|
// 当长度小于等于当前包的数据时 直接解析数据
|
||||||
CommandReciverManager.appDataReceive(allData);
|
CommandReciverManager.appDataReceive(allData);
|
||||||
@ -532,24 +469,30 @@ class BlueManage {
|
|||||||
await characteristic.setNotifyValue(true);
|
await characteristic.setNotifyValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//判断数据头是否正确
|
||||||
|
bool isDataHeadCorrect(List<int> data) {
|
||||||
|
if (data.length < 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//239, 1, 238, 2, 是数据包头
|
||||||
|
if ((data[0] == 0xEF) &&
|
||||||
|
(data[1] == 0x01) &&
|
||||||
|
(data[2] == 0xEE) &&
|
||||||
|
(data[3] == 0x02)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 写入
|
// 写入
|
||||||
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
||||||
final List<BluetoothService> services =
|
final List<BluetoothService> services =
|
||||||
await bluetoothConnectDevice!.discoverServices();
|
await bluetoothConnectDevice!.discoverServices();
|
||||||
for (final BluetoothService service in services) {
|
for (final BluetoothService service in services) {
|
||||||
// AppLog.log("33333 service.remoteId:${service.remoteId}"
|
|
||||||
// " service.uuid:${service.uuid}\n\n"
|
|
||||||
// " service.characteristics:${service.characteristics}\n\n"
|
|
||||||
// " service.includedServices:${service.includedServices}");
|
|
||||||
if (service.uuid == _serviceIdConnect) {
|
if (service.uuid == _serviceIdConnect) {
|
||||||
for (final BluetoothCharacteristic characteristic
|
for (final BluetoothCharacteristic characteristic
|
||||||
in service.characteristics) {
|
in service.characteristics) {
|
||||||
// AppLog.log("44444 characteristic.remoteId:${characteristic.remoteId}"
|
|
||||||
// " characteristic.uuid:${characteristic.uuid}\n\n"
|
|
||||||
// " characteristic.secondaryServiceUuid:${characteristic
|
|
||||||
// .secondaryServiceUuid}\n\n"
|
|
||||||
// " characteristic.characteristicUuid:${characteristic
|
|
||||||
// .characteristicUuid}");
|
|
||||||
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
if (characteristic.characteristicUuid == _characteristicIdWrite) {
|
||||||
try {
|
try {
|
||||||
final List<int> valueList = value;
|
final List<int> valueList = value;
|
||||||
@ -558,22 +501,10 @@ class BlueManage {
|
|||||||
for (int i = 0; i < subData.length; i++) {
|
for (int i = 0; i < subData.length; i++) {
|
||||||
if (characteristic.properties.writeWithoutResponse) {
|
if (characteristic.properties.writeWithoutResponse) {
|
||||||
// 使用WRITE_NO_RESPONSE属性写入值
|
// 使用WRITE_NO_RESPONSE属性写入值
|
||||||
await characteristic
|
await characteristic.write(subData[i], withoutResponse: true);
|
||||||
.write(subData[i], withoutResponse: true)
|
|
||||||
.then((value) async {
|
|
||||||
// await Future.delayed(const Duration(milliseconds: 1)).then((
|
|
||||||
// value) async {
|
|
||||||
// AppLog.log('分包发送成功了');
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
} else if (characteristic.properties.write) {
|
} else if (characteristic.properties.write) {
|
||||||
// 使用WRITE属性写入值
|
// 使用WRITE属性写入值
|
||||||
await characteristic.write(subData[i]).then((value) async {
|
await characteristic.write(subData[i]);
|
||||||
// await Future.delayed(const Duration(milliseconds: 1)).then((
|
|
||||||
// value) async {
|
|
||||||
// AppLog.log('分包发送成功了');
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// 特性不支持写入
|
// 特性不支持写入
|
||||||
throw Exception(
|
throw Exception(
|
||||||
@ -588,28 +519,6 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// List<BluetoothService> services = await bluetoothConnectDevice!.discoverServices();
|
|
||||||
// BluetoothCharacteristic characteristic = services
|
|
||||||
// .firstWhere((service) => service.uuid == _serviceIdWrite)
|
|
||||||
// .characteristics
|
|
||||||
// .firstWhere((char) => char.uuid == _characteristicIdWrite);
|
|
||||||
// try {
|
|
||||||
// List<int> valueList = value;
|
|
||||||
// List subData = splitList(valueList, _mtuSize!);
|
|
||||||
// AppLog.log('writeCharacteristicWithResponse 得到的分割数据:$subData');
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < subData.length; i++) {
|
|
||||||
// await characteristic.write(subData[i]).then((value) async {
|
|
||||||
// await Future.delayed(const Duration(milliseconds: 1)).then((value) async {
|
|
||||||
// AppLog.log('分包发送成功了');
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// } on Exception catch (e, s) {
|
|
||||||
// AppLog.log('Error occurred when writing: $e');
|
|
||||||
// AppLog.log(s);
|
|
||||||
// rethrow;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 停止扫描蓝牙设备
|
// 停止扫描蓝牙设备
|
||||||
@ -624,16 +533,12 @@ class BlueManage {
|
|||||||
// 断开连接
|
// 断开连接
|
||||||
Future<void> disconnect() async {
|
Future<void> disconnect() async {
|
||||||
try {
|
try {
|
||||||
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
|
|
||||||
connectDeviceMacAddress = '';
|
connectDeviceMacAddress = '';
|
||||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||||
// await writeNull();
|
|
||||||
// await Future.delayed(const Duration(milliseconds: 1000));
|
|
||||||
//加快蓝牙断连
|
//加快蓝牙断连
|
||||||
await bluetoothConnectDevice!.disconnect(timeout: 2);
|
await bluetoothConnectDevice!.disconnect(timeout: 3);
|
||||||
AppLog.log('断开连接成功');
|
AppLog.log('断开连接成功');
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
} on Exception catch (e, _) {
|
} on Exception catch (e, _) {
|
||||||
AppLog.log('断开连接失败: $e');
|
AppLog.log('断开连接失败: $e');
|
||||||
} finally {
|
} finally {
|
||||||
@ -641,7 +546,7 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openBlue() async {
|
Future<void> openBlue() async {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
await FlutterBluePlus.turnOn();
|
await FlutterBluePlus.turnOn();
|
||||||
}
|
}
|
||||||
@ -650,10 +555,9 @@ class BlueManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disposed() {
|
void disposed() {
|
||||||
_sendStreamSubscription?.cancel();
|
_sendStreamSubscription?.cancel();
|
||||||
_mtuSubscription!.cancel();
|
_mtuSubscription!.cancel();
|
||||||
// _scanResultsSubscription!.cancel();
|
|
||||||
_adapterStateStateSubscription!.cancel();
|
_adapterStateStateSubscription!.cancel();
|
||||||
_connectionStateSubscription!.cancel();
|
_connectionStateSubscription!.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import '../app_settings/app_settings.dart';
|
|||||||
import 'io_type.dart';
|
import 'io_type.dart';
|
||||||
|
|
||||||
abstract class Reply{
|
abstract class Reply{
|
||||||
|
Reply.parseData(this.commandType, List<int> dataDetail);
|
||||||
|
|
||||||
CommandType? commandType;
|
CommandType? commandType;
|
||||||
|
|
||||||
@ -13,122 +14,121 @@ abstract class Reply{
|
|||||||
int status = 0;
|
int status = 0;
|
||||||
List<int> data = [];
|
List<int> data = [];
|
||||||
static String logTag= '锁 -> App,指令订阅类型 :';
|
static String logTag= '锁 -> App,指令订阅类型 :';
|
||||||
Reply.parseData(this.commandType, List<int> dataDetail);
|
|
||||||
|
|
||||||
void errorWithStstus(int status){
|
void errorWithStstus(int status){
|
||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
// 成功
|
// 成功
|
||||||
AppLog.log("$logTag ${commandType?.typeName} 0x00 成功");
|
AppLog.log('$logTag ${commandType?.typeName} 0x00 成功');
|
||||||
break;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
// 包格式错误
|
// 包格式错误
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误");
|
AppLog.log('$logTag ${commandType!.typeName} 0x01 包格式错误');
|
||||||
showErrorMessage("包格式错误");
|
showErrorMessage('包格式错误');
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
// 密码错误
|
// 密码错误
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误");
|
AppLog.log('$logTag ${commandType!.typeName} 0x02 密码错误');
|
||||||
showErrorMessage("密码错误");
|
showErrorMessage('密码错误');
|
||||||
break;
|
break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
// 网络中断
|
// 网络中断
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断");
|
AppLog.log('$logTag ${commandType!.typeName} 0x03 网络中断');
|
||||||
showErrorMessage("网络中断");
|
showErrorMessage('网络中断');
|
||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// 用户未登记
|
// 用户未登记
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记");
|
AppLog.log('$logTag ${commandType!.typeName} 0x04 用户未登记');
|
||||||
showErrorMessage("用户未登记");
|
showErrorMessage('用户未登记');
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
// 参数错误
|
// 参数错误
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误");
|
AppLog.log('$logTag ${commandType!.typeName} 0x05 参数错误');
|
||||||
showErrorMessage("参数错误");
|
showErrorMessage('参数错误');
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
// 需要鉴权
|
// 需要鉴权
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权");
|
AppLog.log('$logTag ${commandType!.typeName} 0x06 需要鉴权');
|
||||||
// showErrorMessage("需要鉴权");
|
// showErrorMessage("需要鉴权");
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
// 无权限
|
// 无权限
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限");
|
AppLog.log('$logTag ${commandType!.typeName} 0x07 无权限');
|
||||||
// showErrorMessage("无权限");
|
// showErrorMessage("无权限");
|
||||||
break;
|
break;
|
||||||
case 0x08:
|
case 0x08:
|
||||||
// 应答超时
|
// 应答超时
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时");
|
AppLog.log('$logTag ${commandType!.typeName} 0x08 应答超时');
|
||||||
showErrorMessage("应答超时");
|
showErrorMessage('应答超时');
|
||||||
break;
|
break;
|
||||||
case 0x09:
|
case 0x09:
|
||||||
// 权限校验错误
|
// 权限校验错误
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误");
|
AppLog.log('$logTag ${commandType!.typeName} 0x09 权限校验错误');
|
||||||
showErrorMessage("权限校验错误");
|
showErrorMessage('权限校验错误');
|
||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
// 钥匙不存在
|
// 钥匙不存在
|
||||||
showErrorMessage("钥匙不存在");
|
showErrorMessage('钥匙不存在');
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0a 钥匙不存在');
|
||||||
break;
|
break;
|
||||||
case 0x0b:
|
case 0x0b:
|
||||||
// 钥匙过期
|
// 钥匙过期
|
||||||
showErrorMessage("钥匙过期");
|
showErrorMessage('钥匙过期');
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0b 钥匙过期');
|
||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
// 钥匙数量已到上限
|
// 钥匙数量已到上限
|
||||||
showErrorMessage("钥匙数量已到上限");
|
showErrorMessage('钥匙数量已到上限');
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限');
|
||||||
break;
|
break;
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
// 钥匙无效
|
// 钥匙无效
|
||||||
showErrorMessage("钥匙无效");
|
showErrorMessage('钥匙无效');
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0d 钥匙无效');
|
||||||
break;
|
break;
|
||||||
case 0x0e:
|
case 0x0e:
|
||||||
// 钥匙已存在
|
// 钥匙已存在
|
||||||
showErrorMessage("钥匙已存在");
|
showErrorMessage('钥匙已存在');
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙已存在");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0e 钥匙已存在');
|
||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// 用户已存在
|
// 用户已存在
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在");
|
AppLog.log('$logTag ${commandType!.typeName} 0x0f 用户已存在');
|
||||||
showErrorMessage("用户已存在");
|
showErrorMessage('用户已存在');
|
||||||
break;
|
break;
|
||||||
case 0x10:
|
case 0x10:
|
||||||
// 密码失效
|
// 密码失效
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效");
|
AppLog.log('$logTag ${commandType!.typeName} 0x11 密码失效');
|
||||||
showErrorMessage("密码失效");
|
showErrorMessage('密码失效');
|
||||||
break;
|
break;
|
||||||
case 0x11:
|
case 0x11:
|
||||||
// 无效指令
|
// 无效指令
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令");
|
AppLog.log('$logTag ${commandType!.typeName} 0x11 无效指令');
|
||||||
showErrorMessage("无效指令");
|
showErrorMessage('无效指令');
|
||||||
break;
|
break;
|
||||||
case 0x12:
|
case 0x12:
|
||||||
// 门锁时间异常
|
// 门锁时间异常
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常");
|
AppLog.log('$logTag ${commandType!.typeName} 0x12 门锁时间异常');
|
||||||
showErrorMessage("门锁时间异常");
|
showErrorMessage('门锁时间异常');
|
||||||
break;
|
break;
|
||||||
case 0x15:
|
case 0x15:
|
||||||
// APP(手机)未联网
|
// APP(手机)未联网
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网");
|
AppLog.log('$logTag ${commandType!.typeName} 0x15 APP(手机)未联网');
|
||||||
showErrorMessage("APP(手机)未联网");
|
showErrorMessage('APP(手机)未联网');
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
AppLog.log("$logTag ${commandType!.typeName} $status 正在开锁中...");
|
AppLog.log('$logTag ${commandType!.typeName} $status 正在开锁中...');
|
||||||
showErrorMessage("正在开锁中...");
|
showErrorMessage('正在开锁中...');
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
// 异常,未知错误
|
// 异常,未知错误
|
||||||
AppLog.log("$logTag ${commandType!.typeName} 0xff 异常,未知错误");
|
AppLog.log('$logTag ${commandType!.typeName} 0xff 异常,未知错误');
|
||||||
showErrorMessage("异常,未知错误");
|
showErrorMessage('异常,未知错误');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
AppLog.log("$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题");
|
AppLog.log('$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ abstract class SenderProtocol extends IOData {
|
|||||||
? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:拼装数据Ï
|
//TODO:拼装数据
|
||||||
List<int> packageData() {
|
List<int> packageData() {
|
||||||
commandData = messageDetail();
|
commandData = messageDetail();
|
||||||
List<int> commandList = [];
|
List<int> commandList = [];
|
||||||
|
|||||||
@ -47,12 +47,12 @@ import 'io_tool/manager_event_bus.dart';
|
|||||||
import 'sm4Encipher/sm4.dart';
|
import 'sm4Encipher/sm4.dart';
|
||||||
|
|
||||||
class CommandReciverManager {
|
class CommandReciverManager {
|
||||||
static void appDataReceive(List<int> data) async {
|
static Future<void> appDataReceive(List<int> data) async {
|
||||||
///解析数据
|
///解析数据
|
||||||
if (data.isEmpty) {
|
if (data.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int dataSize = data.length;
|
final int dataSize = data.length;
|
||||||
// 当小于包头加起来13个字节
|
// 当小于包头加起来13个字节
|
||||||
if (dataSize < 13) {
|
if (dataSize < 13) {
|
||||||
return;
|
return;
|
||||||
@ -62,20 +62,20 @@ class CommandReciverManager {
|
|||||||
(data[1] == 0x01) &&
|
(data[1] == 0x01) &&
|
||||||
(data[2] == 0xEE) &&
|
(data[2] == 0xEE) &&
|
||||||
(data[3] == 0x02)) {
|
(data[3] == 0x02)) {
|
||||||
var tmpType = (data[7] & 0x0f); // 包标识
|
final int tmpType = data[7] & 0x0f; // 包标识
|
||||||
// AppLog.log("temType:$tmpType");
|
// AppLog.log('temType:$tmpType');
|
||||||
|
|
||||||
var dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
final int dataLen = data[8] * 256 + data[9]; // 高16位用来指示后面数据块内容的长度
|
||||||
var oriLen = data[10] * 256 + data[11]; // 低16位用来指示数据加密前的原长度
|
final int oriLen = data[10] * 256 + data[11]; // 低16位用来指示数据加密前的原长度
|
||||||
// AppLog.log("dataLen:$dataLen oriLen:$oriLen");
|
// AppLog.log("dataLen:$dataLen oriLen:$oriLen");
|
||||||
List<int> oriDataList = [];
|
List<int> oriDataList = <int>[];
|
||||||
switch (tmpType) {
|
switch (tmpType) {
|
||||||
case 0: //不加密
|
case 0: //不加密
|
||||||
// for (var i = 0; i < oriLen ; i++) {
|
// for (var i = 0; i < oriLen ; i++) {
|
||||||
// oriDataList.add(data[12 + i]);
|
// oriDataList.add(data[12 + i]);
|
||||||
// }
|
// }
|
||||||
oriDataList = data.sublist(12, 12 + dataLen);
|
oriDataList = data.sublist(12, 12 + dataLen);
|
||||||
AppLog.log("不加密 :$oriDataList");
|
AppLog.log('不加密 :$oriDataList');
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//AES128
|
//AES128
|
||||||
@ -83,7 +83,7 @@ class CommandReciverManager {
|
|||||||
case 2:
|
case 2:
|
||||||
// SM4(事先约定密钥)
|
// SM4(事先约定密钥)
|
||||||
// 获取的加密数组
|
// 获取的加密数组
|
||||||
var getDataList = data.sublist(12, 12 + dataLen);
|
final List<int> getDataList = data.sublist(12, 12 + dataLen);
|
||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
// String key = SM4.createHexKey(key: IoManager().getCurrentDeviceLockId);
|
// String key = SM4.createHexKey(key: IoManager().getCurrentDeviceLockId);
|
||||||
@ -91,39 +91,39 @@ class CommandReciverManager {
|
|||||||
key: utf8.encode(BlueManage().connectDeviceName),
|
key: utf8.encode(BlueManage().connectDeviceName),
|
||||||
mode: SM4CryptoMode.ECB);
|
mode: SM4CryptoMode.ECB);
|
||||||
oriDataList = oriDataList.sublist(0, oriLen);
|
oriDataList = oriDataList.sublist(0, oriLen);
|
||||||
AppLog.log("APP收到的解密后的数据:$oriDataList");
|
AppLog.log('APP收到的解密后的数据:$oriDataList');
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//SM4(设备指定密钥)
|
//SM4(设备指定密钥)
|
||||||
// 获取的加密数组
|
// 获取的加密数组
|
||||||
var getDataList = data.sublist(12, 12 + dataLen);
|
final List<int> getDataList = data.sublist(12, 12 + dataLen);
|
||||||
|
|
||||||
var res = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? res = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(res!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(res!);
|
||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
oriDataList = SM4.decrypt(getDataList,
|
oriDataList = SM4.decrypt(getDataList,
|
||||||
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
||||||
oriDataList = oriDataList.sublist(0, oriLen);
|
oriDataList = oriDataList.sublist(0, oriLen);
|
||||||
AppLog.log("APP收到的解密后的数据:$oriDataList");
|
AppLog.log('APP收到的解密后的数据:$oriDataList data:$data');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parseData(oriDataList).then((Reply? value) async {
|
parseData(oriDataList).then((Reply? value) async {
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
await EventBusManager().eventBusFir(value);
|
await EventBusManager().eventBusFir(value);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
AppLog.log("APP解析数据时发生错误: $error");
|
AppLog.log('APP解析数据时发生错误: $error');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Reply?> parseData(List<int> data) async {
|
static Future<Reply?> parseData(List<int> data) async {
|
||||||
if (data.isNotEmpty) {
|
if (data.isNotEmpty) {
|
||||||
var cmd = data[0] * 256 + data[1];
|
final int cmd = data[0] * 256 + data[1];
|
||||||
CommandType commandType = ExtensionCommandType.getCommandType(cmd);
|
final CommandType commandType = ExtensionCommandType.getCommandType(cmd);
|
||||||
await IoManager().increaseCommandIndex();
|
await IoManager().increaseCommandIndex();
|
||||||
// data.removeRange(0, 2);
|
// data.removeRange(0, 2);
|
||||||
var reply;
|
Reply? reply;
|
||||||
switch (commandType) {
|
switch (commandType) {
|
||||||
case CommandType.getLockPublicKey:
|
case CommandType.getLockPublicKey:
|
||||||
{
|
{
|
||||||
@ -204,7 +204,7 @@ class CommandReciverManager {
|
|||||||
case CommandType.generalExtendedCommond:
|
case CommandType.generalExtendedCommond:
|
||||||
{
|
{
|
||||||
// 子命令类型
|
// 子命令类型
|
||||||
int subType = data[3];
|
final int subType = data[3];
|
||||||
switch (subType) {
|
switch (subType) {
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
@ -437,5 +437,6 @@ class CommandReciverManager {
|
|||||||
}
|
}
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,4 +70,13 @@ class XSConstantMacro {
|
|||||||
static int catEyeWorkModeStayCapture = 2; //逗留抓拍模式
|
static int catEyeWorkModeStayCapture = 2; //逗留抓拍模式
|
||||||
static int catEyeWorkModeRealTimeMonitoring = 3; //实时监控模式
|
static int catEyeWorkModeRealTimeMonitoring = 3; //实时监控模式
|
||||||
static int catEyeWorkModeCustom = 4; //自定义模式
|
static int catEyeWorkModeCustom = 4; //自定义模式
|
||||||
|
|
||||||
|
//管理员类型
|
||||||
|
static int userTypeSuperAdmin = 110301; //超级管理员
|
||||||
|
static int userTypeAuthorizedAdmin = 110302; //授权管理员
|
||||||
|
|
||||||
|
|
||||||
|
//电子钥匙类型
|
||||||
|
static int keyRightAdmin = 1; //管理钥匙
|
||||||
|
static int keyRightOrdinary = 2; //普通钥匙
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/blue/blue_manage.dart';
|
||||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -47,11 +48,10 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
Storage.saveLoginData(entity.data);
|
Storage.saveLoginData(entity.data);
|
||||||
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
||||||
eventBus.fire(MineInfoChangeRefreshUI());
|
eventBus.fire(MineInfoChangeRefreshUI());
|
||||||
// Get.back();
|
|
||||||
// Get.toNamed(Routers.starLockMain);
|
|
||||||
XSJPushProvider().initJPushService();
|
XSJPushProvider().initJPushService();
|
||||||
XSJPushProvider().initLocalNotification(false);
|
XSJPushProvider().initLocalNotification(false);
|
||||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||||
|
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 转移权限
|
// 转移权限
|
||||||
Future<void> transferPermissionsAction() async {
|
Future<void> transferPermissionsAction() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
Get.close(1);
|
Get.close(1);
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
@ -193,7 +193,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 取消添加指纹
|
// 取消添加指纹
|
||||||
Future<void> senderCancelAddCardCommand() async {
|
Future<void> senderCancelAddCardCommand() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class CardDetailLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -229,7 +229,7 @@ class CardListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -257,7 +257,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
@ -313,7 +313,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -259,7 +259,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
@ -315,7 +315,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
|
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSet/checkingInSet_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/baseGetXController.dart';
|
import '../../../../tools/baseGetXController.dart';
|
||||||
@ -9,96 +11,94 @@ import '../../../../tools/dateTool.dart';
|
|||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import 'checkingInSet_state.dart';
|
import 'checkingInSet_state.dart';
|
||||||
|
|
||||||
class CheckingInSetLogic extends BaseGetXController{
|
class CheckingInSetLogic extends BaseGetXController {
|
||||||
CheckingInSetState state = CheckingInSetState();
|
CheckingInSetState state = CheckingInSetState();
|
||||||
|
|
||||||
// 开启考勤获取是否有公司
|
// 开启考勤获取是否有公司
|
||||||
void openCheckingInData() async{
|
Future<void> openCheckingInData() async {
|
||||||
var entity = await ApiRepository.to.openCheckingInData(
|
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
|
||||||
lockId:state.getKeyInfosData.value.lockId.toString(),
|
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.companyId.value = entity.data!.companyId.toString();
|
state.companyId.value = entity.data!.companyId.toString();
|
||||||
getCheckInSetInfoData();
|
getCheckInSetInfoData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取获取考勤设置信息
|
// 获取获取考勤设置信息
|
||||||
void getCheckInSetInfoData() async{
|
Future<void> getCheckInSetInfoData() async {
|
||||||
var entity = await ApiRepository.to.getCheckInSetInfoData(
|
final CheckingInSetEntity entity = await ApiRepository.to.getCheckInSetInfoData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.checkingInSetInfo.value = entity.data!;
|
state.checkingInSetInfo.value = entity.data!;
|
||||||
|
|
||||||
state.beginTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workStartTime.toString());
|
state.beginTime.value = DateTool().dateToHNString(
|
||||||
state.endTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workEndTime.toString());
|
state.checkingInSetInfo.value.workStartTime.toString());
|
||||||
state.beginTimeTimestamp.value = state.checkingInSetInfo.value.workStartTime.toString();
|
state.endTime.value = DateTool()
|
||||||
state.endTimeTimestamp.value = state.checkingInSetInfo.value.workEndTime.toString();
|
.dateToHNString(state.checkingInSetInfo.value.workEndTime.toString());
|
||||||
|
state.beginTimeTimestamp.value =
|
||||||
|
state.checkingInSetInfo.value.workStartTime.toString();
|
||||||
|
state.endTimeTimestamp.value =
|
||||||
|
state.checkingInSetInfo.value.workEndTime.toString();
|
||||||
|
|
||||||
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
||||||
state.weekDaysStr.value = state.weekDays.value.join(",");
|
state.weekDaysStr.value = state.weekDays.join(',');
|
||||||
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
state.isCustom.value = state.checkingInSetInfo.value.attendanceType! == 0;
|
||||||
|
|
||||||
state.staffNumber.value = state.checkingInSetInfo.value.staffNum!.toString();
|
state.staffNumber.value =
|
||||||
|
state.checkingInSetInfo.value.staffNum!.toString();
|
||||||
state.companyName.value = state.checkingInSetInfo.value.companyName!;
|
state.companyName.value = state.checkingInSetInfo.value.companyName!;
|
||||||
state.changeNameController.text = state.companyName.value;
|
state.changeNameController.text = state.companyName.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑考勤设置信息
|
// 编辑考勤设置信息
|
||||||
void editCheckInSetInfoData() async{
|
Future<void> editCheckInSetInfoData() async {
|
||||||
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||||
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
|
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
|
||||||
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
||||||
type: "1",
|
type: '1',
|
||||||
companyName: state.changeNameController.text,
|
companyName: state.changeNameController.text,
|
||||||
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
||||||
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
||||||
workDay:state.checkingInSetInfo.value.workDay!,
|
workDay: state.checkingInSetInfo.value.workDay!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.companyName.value = state.changeNameController.text;
|
state.companyName.value = state.changeNameController.text;
|
||||||
showToast("修改成功");
|
showToast('修改成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除公司
|
// 删除公司
|
||||||
void deletCompanyData() async{
|
Future<void> deletCompanyData() async {
|
||||||
var entity = await ApiRepository.to.deletCompanyData(
|
final CheckingInInfoDataEntity entity = await ApiRepository.to.deletCompanyData(
|
||||||
companyId:state.checkingInSetInfo.value.companyId!,
|
companyId: state.checkingInSetInfo.value.companyId!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "0"));
|
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '0'));
|
||||||
Get.close(2);
|
Get.close(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
|
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((RefreshCheckInSetDataEvent event) {
|
||||||
getCheckInSetInfoData();
|
getCheckInSetInfoData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initLoadDataAction();
|
_initLoadDataAction();
|
||||||
openCheckingInData();
|
openCheckingInData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,13 +73,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
'checkingInSetInfo': state.checkingInSetInfo.value,
|
'checkingInSetInfo': state.checkingInSetInfo.value,
|
||||||
});
|
});
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
setState(() {
|
setState(logic.getCheckInSetInfoData);
|
||||||
// state.beginTime.value = data["beginTime"];
|
|
||||||
// state.endTime.value = data["endTime"];
|
|
||||||
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
|
||||||
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
|
||||||
logic.getCheckInSetInfoData();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
@ -98,7 +92,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
if(data != null) {
|
if(data != null) {
|
||||||
state.isCustom.value = data['attendanceType'];
|
state.isCustom.value = data['attendanceType'];
|
||||||
state.weekDays.value = data['weekDays'];
|
state.weekDays.value = data['weekDays'];
|
||||||
state.weekDaysStr.value = state.weekDays.value.join(',');
|
state.weekDaysStr.value = state.weekDays.join(',');
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
@ -125,9 +119,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () {
|
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, logic.deletCompanyData);
|
||||||
logic.deletCompanyData();
|
|
||||||
});
|
|
||||||
// showDeletCompanyAlertDialog(context);
|
// showDeletCompanyAlertDialog(context);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
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 'package:star_lock/login/login/entity/LoginEntity.dart';
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -72,7 +70,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.keyEntity.value = entity.data!;
|
state.keyEntity.value = entity.data!;
|
||||||
kyClickCallback(state.keyEntity.value);
|
kyClickCallback(state.keyEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +80,11 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
if (state.appUnHaveAccount.value && state.staffAccount.contains('@')) {
|
||||||
usernameType = '2';
|
usernameType = '2';
|
||||||
}
|
}
|
||||||
|
// 当是app且没有钥匙时,直接把账号赋值给attendanceWayNumber
|
||||||
|
if (state.appUnHaveAccount.value &&
|
||||||
|
state.selectPrintingMethodType.value == '1') {
|
||||||
|
state.attendanceWayNumber.value = state.staffAccountController.text;
|
||||||
|
}
|
||||||
|
|
||||||
final LoginEntity entity = await ApiRepository.to.editStaffData(
|
final LoginEntity entity = await ApiRepository.to.editStaffData(
|
||||||
attendanceType: state.selectPrintingMethodType.value,
|
attendanceType: state.selectPrintingMethodType.value,
|
||||||
@ -151,25 +154,15 @@ class CheckingInAddStaffLogic extends BaseGetXController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
_initLoadDataAction();
|
_initLoadDataAction();
|
||||||
|
|
||||||
changeInput(state.staffNameController);
|
changeInput(state.staffNameController);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_getNumberEvent!.cancel();
|
_getNumberEvent!.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -214,15 +214,18 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 25.w, right: 25.w, top: 2.h),
|
left: 25.w,
|
||||||
|
right: 25.w,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.mainColor,
|
color: AppColors.mainColor,
|
||||||
borderRadius: BorderRadius.circular(20.h),
|
borderRadius: BorderRadius.circular(20.h),
|
||||||
),
|
),
|
||||||
child: Text(addStaffSelectKeyType(),
|
child: Center(
|
||||||
textAlign: TextAlign.center,
|
child: Text(addStaffSelectKeyType(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white, fontSize: 22.sp)),
|
color: Colors.white, fontSize: 22.sp)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -145,9 +145,21 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
|
if (staffListItem.headurl == null || staffListItem.headurl == '')
|
||||||
Image.asset(getTypeIcon(staffListItem.attendanceType!),
|
Image.asset(
|
||||||
width: 60.w, height: 60.w),
|
getTypeIcon(staffListItem.attendanceType!),
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(100.w),
|
||||||
|
child: Image.network(
|
||||||
|
staffListItem.headurl!,
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -106,7 +106,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState connectionStateState) async {
|
(BluetoothConnectionState connectionStateState) async {
|
||||||
if (connectionStateState == BluetoothConnectionState.connected) {
|
if (connectionStateState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -255,16 +255,18 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<void> openModalBottomSheet(BuildContext context) async {
|
Future<void> openModalBottomSheet(BuildContext context) async {
|
||||||
List<String> textList = <String>[];
|
List<String> textList = <String>[];
|
||||||
if (state.itemData.value.keyRight == 1) {
|
final bool isAdminKey = state.itemData.value.keyRight == 1;
|
||||||
|
final bool isLockOwner = CommonDataManage().currentKeyInfo.isLockOwner == 1;
|
||||||
|
if (isAdminKey) {
|
||||||
// 授权管理员
|
// 授权管理员
|
||||||
textList = <String>[
|
textList = <String>[
|
||||||
if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen)
|
if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen)
|
||||||
'取消冻结'.tr
|
'取消冻结'.tr
|
||||||
else
|
else
|
||||||
'冻结'.tr,
|
'冻结'.tr,
|
||||||
// '取消授权'.tr
|
if (isLockOwner) '取消授权'.tr
|
||||||
];
|
];
|
||||||
} else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) {
|
} else if (isLockOwner) {
|
||||||
// 锁拥有者
|
// 锁拥有者
|
||||||
if (state.keyType.value == 1 || state.keyType.value == 2) {
|
if (state.keyType.value == 1 || state.keyType.value == 2) {
|
||||||
textList = <String>[
|
textList = <String>[
|
||||||
|
|||||||
@ -186,7 +186,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
Get.close(1);
|
Get.close(1);
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
@ -231,7 +231,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 取消添加指纹
|
// 取消添加指纹
|
||||||
Future<void> senderCancelAddFaceCommand() async {
|
Future<void> senderCancelAddFaceCommand() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class FaceDetailLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -256,7 +256,7 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
Get.close(1);
|
Get.close(1);
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -227,7 +227,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 取消添加指纹
|
// 取消添加指纹
|
||||||
Future<void> senderCancelAddFingerprintCommand() async {
|
Future<void> senderCancelAddFingerprintCommand() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|||||||
@ -189,7 +189,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
// 获取指纹状态
|
// 获取指纹状态
|
||||||
Future<void> senderQueryingFingerprintStatus() async {
|
Future<void> senderQueryingFingerprintStatus() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -217,7 +217,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
Future<void> senderCheckingUserInfoCount() async {
|
Future<void> senderCheckingUserInfoCount() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -248,7 +248,7 @@ class FingerprintListLogic extends BaseGetXController{
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class IrisDetailLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
|||||||
@ -189,7 +189,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取人脸状态
|
// 获取人脸状态
|
||||||
Future<void> senderQueryingFaceStatus() async {
|
Future<void> senderQueryingFaceStatus() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -218,7 +218,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
Future<void> senderCheckingUserInfoCount() async {
|
Future<void> senderCheckingUserInfoCount() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -250,7 +250,7 @@ class IrisListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
|||||||
@ -37,17 +37,17 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
void initReplySubscription() {
|
void initReplySubscription() {
|
||||||
state.replySubscription =
|
state.replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 开门
|
// 开门
|
||||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||||
_replyOpenLock(reply);
|
_replyOpenLock(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开完锁之后上传记录
|
// 开完锁之后上传记录
|
||||||
if (reply is SenderReferEventRecordTimeReply &&
|
if (reply is SenderReferEventRecordTimeReply &&
|
||||||
state.ifCurrentScreen.value == true) {
|
state.ifCurrentScreen.value == true) {
|
||||||
_replyReferEventRecordTime(reply);
|
_replyReferEventRecordTime(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开门数据解析
|
// 开门数据解析
|
||||||
@ -56,19 +56,18 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
// _showFullScreenOverlay(Get.context!);
|
// _showFullScreenOverlay(Get.context!);
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
|
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = true;
|
state.iSClosedUnlockSuccessfulPopup.value = true;
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
state.closedUnlockSuccessfulTimer?.cancel();
|
state.closedUnlockSuccessfulTimer?.cancel();
|
||||||
// 如果没有点击关闭弹窗,3秒后自动关闭
|
// 如果没有点击关闭弹窗,3秒后自动关闭
|
||||||
state.closedUnlockSuccessfulTimer =
|
state.closedUnlockSuccessfulTimer =
|
||||||
Timer.periodic(3.seconds, (Timer timer) {
|
Timer.periodic(3.seconds, (Timer timer) {
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
|
|
||||||
// 电量
|
// 电量
|
||||||
final int power = reply.data[7];
|
final int power = reply.data[7];
|
||||||
@ -81,19 +80,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
// 更新电量
|
// 更新电量
|
||||||
uploadElectricQuantityRequest();
|
uploadElectricQuantityRequest();
|
||||||
|
//锁数据更新
|
||||||
getLockRecordLastUploadDataTime();
|
getLockRecordLastUploadDataTime();
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
|
state.animationController!.stop();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey =
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList =
|
final List<int> getPrivateKeyList =
|
||||||
changeStringListToIntList(privateKey!);
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey =
|
final List<String>? signKey =
|
||||||
await Storage.getStringList(saveBlueSignKey);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<int> tokenData = reply.data.sublist(2, 6);
|
final List<int> tokenData = reply.data.sublist(2, 6);
|
||||||
@ -113,71 +113,58 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 0x16:
|
case 0x16:
|
||||||
// 正在开锁中...
|
// 正在开锁中...
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
showToast('正在开锁中...'.tr, something: () {
|
showToast('正在开锁中...'.tr, something: () {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
// 钥匙无效
|
// 钥匙无效
|
||||||
showToast('钥匙无效'.tr);
|
showToast('钥匙无效'.tr);
|
||||||
// state.animationController!.stop();
|
openDoorError();
|
||||||
resetOpenDoorState();
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
case 0x0b:
|
case 0x0b:
|
||||||
// 钥匙无效
|
// 钥匙无效
|
||||||
showToast('钥匙过期'.tr);
|
showToast('钥匙过期'.tr);
|
||||||
resetOpenDoorState();
|
openDoorError();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
// 钥匙不存在
|
// 钥匙不存在
|
||||||
showToast('钥匙不存在');
|
showToast('钥匙不存在');
|
||||||
resetOpenDoorState();
|
openDoorError();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
// 钥匙数量已到上限
|
// 钥匙数量已到上限
|
||||||
showToast('钥匙数量已到上限');
|
showToast('钥匙数量已到上限');
|
||||||
resetOpenDoorState();
|
openDoorError();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
case 0x0e:
|
case 0x0e:
|
||||||
// 钥匙已存在
|
// 钥匙已存在
|
||||||
showToast('钥匙已存在');
|
showToast('钥匙已存在');
|
||||||
resetOpenDoorState();
|
openDoorError();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// 用户已存在
|
// 用户已存在
|
||||||
showToast('用户已存在');
|
showToast('用户已存在');
|
||||||
resetOpenDoorState();
|
openDoorError();
|
||||||
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//失败
|
//失败
|
||||||
AppLog.log('开锁失败');
|
AppLog.log('开锁失败');
|
||||||
// state.animationController!.stop();
|
openDoorError();
|
||||||
resetOpenDoorState();
|
|
||||||
cancelBlueConnetctToastTimer();
|
|
||||||
BlueManage().disconnect();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//开门指令失败
|
||||||
|
void openDoorError() {
|
||||||
|
resetOpenDoorState();
|
||||||
|
state.animationController!.stop();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
BlueManage().disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
//清除开锁动画以及状态
|
//清除开锁动画以及状态
|
||||||
void closeLuckStatus() {
|
void closeLuckStatus() {
|
||||||
state.openLockBtnState.value = 0;
|
state.openLockBtnState.value = 0;
|
||||||
@ -190,67 +177,67 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
final int dataLength = (reply.data[5] << 8) + reply.data[6];
|
final int dataLength = (reply.data[5] << 8) + reply.data[6];
|
||||||
// AppLog.log("dataLength:$dataLength");
|
// AppLog.log("dataLength:$dataLength");
|
||||||
if (dataLength > 0) {
|
if (dataLength > 0) {
|
||||||
reply.data.removeRange(0, 7);
|
reply.data.removeRange(0, 7);
|
||||||
// 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面
|
// 把得到的数据按17个字节分割成数组 然后塞进一个新的数组里面
|
||||||
if (reply.data.length < 17) {
|
if (reply.data.length < 17) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final List<List<int>> getList = splitList(reply.data, 17);
|
final List<List<int>> getList = splitList(reply.data, 17);
|
||||||
// AppLog.log("getList:$getList");
|
// AppLog.log("getList:$getList");
|
||||||
final List uploadList = [];
|
final List uploadList = [];
|
||||||
for (int i = 0; i < getList.length; i++) {
|
for (int i = 0; i < getList.length; i++) {
|
||||||
final List<int> indexList = getList[i];
|
final List<int> indexList = getList[i];
|
||||||
// AppLog.log("indexList:$indexList");
|
// AppLog.log("indexList:$indexList");
|
||||||
final Map indexMap = {};
|
final Map indexMap = {};
|
||||||
indexMap['type'] = indexList[0].toString();
|
indexMap['type'] = indexList[0].toString();
|
||||||
int operateDate = 0;
|
int operateDate = 0;
|
||||||
if (indexList[0] == 2) {
|
if (indexList[0] == 2) {
|
||||||
final List<int> passwordData = reply.data.sublist(7, 17);
|
final List<int> passwordData = reply.data.sublist(7, 17);
|
||||||
final String password = utf8String(passwordData);
|
final String password = utf8String(passwordData);
|
||||||
indexMap['user'] = password.toString();
|
indexMap['user'] = password.toString();
|
||||||
} else {
|
} else {
|
||||||
final int userNo = (indexList[1] * 256) + indexList[2];
|
final int userNo = (indexList[1] * 256) + indexList[2];
|
||||||
indexMap['user'] = userNo.toString();
|
indexMap['user'] = userNo.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
indexMap['success'] = '1';
|
indexMap['success'] = '1';
|
||||||
|
|
||||||
final int time = ((0xff & indexList[(3)]) << 24 |
|
final int time = ((0xff & indexList[(3)]) << 24 |
|
||||||
(0xff & indexList[4]) << 16 |
|
(0xff & indexList[4]) << 16 |
|
||||||
(0xff & indexList[5]) << 8 |
|
(0xff & indexList[5]) << 8 |
|
||||||
(0xFF & indexList[6]));
|
(0xFF & indexList[6]));
|
||||||
operateDate = time * 1000;
|
operateDate = time * 1000;
|
||||||
indexMap['date'] = '$operateDate';
|
indexMap['date'] = '$operateDate';
|
||||||
uploadList.add(indexMap);
|
uploadList.add(indexMap);
|
||||||
|
|
||||||
if (i == getList.length - 1) {
|
if (i == getList.length - 1) {
|
||||||
//设置最后的时间戳
|
//设置最后的时间戳
|
||||||
state.operateDate = operateDate;
|
state.operateDate = operateDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lockRecordUploadData(uploadList);
|
lockRecordUploadData(uploadList);
|
||||||
|
|
||||||
if (dataLength == state.logCountPage) {
|
if (dataLength == state.logCountPage) {
|
||||||
senderReferEventRecordTime();
|
senderReferEventRecordTime();
|
||||||
} else {
|
} else {
|
||||||
await BlueManage().disconnect();
|
await BlueManage().disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,11 +245,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
Future<void> openDoorAction() async {
|
Future<void> openDoorAction() async {
|
||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
// BlueManage().stopScan();
|
closeLuckStatus();
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
});
|
});
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey =
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
@ -272,89 +259,84 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
BlueManage()
|
BlueManage()
|
||||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
.blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
openMode: state.openDoorModel,
|
openMode: state.openDoorModel,
|
||||||
openTime: getUTCNetTime(),
|
openTime: getUTCNetTime(),
|
||||||
onlineToken: state.lockNetToken,
|
onlineToken: state.lockNetToken,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState ==
|
||||||
BluetoothConnectionState.disconnected) {
|
BluetoothConnectionState.disconnected) {
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
if (state.ifCurrentScreen.value == true) {
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
|
|
||||||
resetOpenDoorState();
|
resetOpenDoorState();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询事件记录(时间查询)
|
// 查询事件记录(时间查询)
|
||||||
Future<void> senderReferEventRecordTime() async {
|
void senderReferEventRecordTime() {
|
||||||
showBlueConnetctToastTimer(
|
showBlueConnetctToastTimer(
|
||||||
isShowBlueConnetctToast: false,
|
isShowBlueConnetctToast: false,
|
||||||
outTimer: 10,
|
|
||||||
action: () {
|
action: () {
|
||||||
|
closeLuckStatus();
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState connectionState) async {
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey =
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList =
|
final List<int> getPrivateKeyList =
|
||||||
changeStringListToIntList(privateKey!);
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
saveBlueToken);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
|
||||||
|
|
||||||
final List<String>? publicKey =
|
final List<String>? publicKey =
|
||||||
await Storage.getStringList(saveBluePublicKey);
|
await Storage.getStringList(saveBluePublicKey);
|
||||||
final List<int> getPublicKeyList =
|
final List<int> getPublicKeyList =
|
||||||
changeStringListToIntList(publicKey!);
|
changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
IoSenderManage.senderReferEventRecordTimeCommand(
|
IoSenderManage.senderReferEventRecordTimeCommand(
|
||||||
keyID: BlueManage().connectDeviceName,
|
keyID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
logsCount: state.logCountPage,
|
logsCount: state.logCountPage,
|
||||||
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
// time:DateTime.now().millisecondsSinceEpoch~/1000,
|
||||||
time: state.operateDate,
|
time: state.operateDate,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: getPublicKeyList,
|
publicKey: getPublicKeyList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
void getServerDatetime() async {
|
void getServerDatetime() async {
|
||||||
final GetServerDatetimeEntity entity =
|
final GetServerDatetimeEntity entity =
|
||||||
await ApiRepository.to.getServerDatetimeData();
|
await ApiRepository.to.getServerDatetimeData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.differentialTime = entity.data!.date! ~/ 1000 -
|
||||||
DateTime
|
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
.now()
|
|
||||||
.millisecondsSinceEpoch ~/ 1000;
|
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getUTCNetTime() {
|
int getUTCNetTime() {
|
||||||
return DateTime
|
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
||||||
.now()
|
|
||||||
.millisecondsSinceEpoch ~/ 1000 +
|
|
||||||
state.differentialTime;
|
state.differentialTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,11 +362,11 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
Future<void> uploadElectricQuantityRequest() async {
|
Future<void> uploadElectricQuantityRequest() async {
|
||||||
final KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.uploadElectricQuantity(
|
.uploadElectricQuantity(
|
||||||
electricQuantity: state.electricQuantity.value.toString(),
|
electricQuantity: state.electricQuantity.value.toString(),
|
||||||
electricQuantityStandby:
|
electricQuantityStandby:
|
||||||
state.electricQuantityStandby.value.toString(),
|
state.electricQuantityStandby.value.toString(),
|
||||||
lockId: state.keyInfos.value.lockId.toString(),
|
lockId: state.keyInfos.value.lockId.toString(),
|
||||||
isUnShowLoading: true);
|
isUnShowLoading: true);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
|
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
|
||||||
@ -395,8 +377,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 查询锁记录最后时间
|
// 查询锁记录最后时间
|
||||||
void getLockRecordLastUploadDataTime() async {
|
void getLockRecordLastUploadDataTime() async {
|
||||||
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
final LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||||
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||||
lockId: state.keyInfos.value.lockId.toString());
|
lockId: state.keyInfos.value.lockId.toString());
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||||
senderReferEventRecordTime();
|
senderReferEventRecordTime();
|
||||||
@ -407,7 +389,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
Future<void> lockRecordUploadData(List list) async {
|
Future<void> lockRecordUploadData(List list) async {
|
||||||
final KeyOperationRecordEntity entity = await ApiRepository.to
|
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
.lockRecordUploadData(
|
.lockRecordUploadData(
|
||||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// mockNetworkDataRequest();
|
// mockNetworkDataRequest();
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
@ -423,7 +405,7 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
void deletKeyData() async {
|
void deletKeyData() async {
|
||||||
final ElectronicKeyListEntity entity = await ApiRepository.to
|
final ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
.deleteElectronicKey(
|
.deleteElectronicKey(
|
||||||
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
BlueManage().connectDeviceMacAddress = '';
|
BlueManage().connectDeviceMacAddress = '';
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
@ -440,51 +422,50 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
eventBus
|
eventBus
|
||||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||||
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
|
||||||
if (event.type == 0) {
|
if (event.type == 0) {
|
||||||
// 0考勤
|
// 0考勤
|
||||||
state.isAttendance.value = int.parse(event.setResult);
|
state.isAttendance.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.attendance =
|
state.keyInfos.value.lockSetting!.attendance =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
} else if (event.type == 1) {
|
} else if (event.type == 1) {
|
||||||
// 1 开锁时是否需联网
|
// 1 开锁时是否需联网
|
||||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token
|
state.lockNetToken = ''; // 改变开锁时是否联网状态的时候清空token
|
||||||
} else if (event.type == 2) {
|
} else if (event.type == 2) {
|
||||||
// 2 常开模式
|
// 2 常开模式
|
||||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.passageMode = int.parse(event.setResult);
|
state.keyInfos.value.passageMode = int.parse(event.setResult);
|
||||||
} else if (event.type == 3) {
|
} else if (event.type == 3) {
|
||||||
// 3 修改了锁名字
|
// 3 修改了锁名字
|
||||||
state.lockAlias.value = event.setResult;
|
state.lockAlias.value = event.setResult;
|
||||||
state.keyInfos.value.lockAlias = event.setResult;
|
state.keyInfos.value.lockAlias = event.setResult;
|
||||||
Storage.setString(saveLockAlias, state.lockAlias.value);
|
Storage.setString(saveLockAlias, state.lockAlias.value);
|
||||||
} else if (event.type == 4) {
|
} else if (event.type == 4) {
|
||||||
// 4 更新了电量
|
// 4 更新了电量
|
||||||
state.electricQuantity.value = int.parse(event.setResult);
|
state.electricQuantity.value = int.parse(event.setResult);
|
||||||
state.keyInfos.value.electricQuantity = int.parse(event.setResult);
|
state.keyInfos.value.electricQuantity = int.parse(event.setResult);
|
||||||
} else if (event.type == 5) {
|
} else if (event.type == 5) {
|
||||||
// 5 远程开锁
|
// 5 远程开锁
|
||||||
state.keyInfos.value.lockSetting!.remoteUnlock =
|
state.keyInfos.value.lockSetting!.remoteUnlock =
|
||||||
int.parse(event.setResult);
|
int.parse(event.setResult);
|
||||||
}
|
}
|
||||||
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
CommonDataManage().currentKeyInfo = state.keyInfos.value;
|
||||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKeyStatusTextAndShow() {
|
String getKeyStatusTextAndShow() {
|
||||||
String text = '';
|
String text = '';
|
||||||
if (state.keyInfos.value.keyStatus ==
|
if (state.keyInfos.value.keyStatus ==
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
||||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
||||||
text =
|
text =
|
||||||
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(
|
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||||
state.keyInfos.value.keyStatus!)}";
|
|
||||||
} else {
|
} else {
|
||||||
text = state.isOpenPassageMode.value == 1
|
text = state.isOpenPassageMode.value == 1
|
||||||
? '常开模式启动!长按闭锁'.tr
|
? '常开模式启动!长按闭锁'.tr
|
||||||
@ -517,8 +498,8 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
await PermissionDialog.request(Permission.location);
|
await PermissionDialog.request(Permission.location);
|
||||||
await PermissionDialog.requestBluetooth();
|
await PermissionDialog.requestBluetooth();
|
||||||
|
|
||||||
final String connectDeviceName = state.keyInfos.value.bluetooth!
|
final String connectDeviceName =
|
||||||
.bluetoothDeviceName!;
|
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
|
||||||
if (!BlueManage().isExistScanDevices(connectDeviceName)) {
|
if (!BlueManage().isExistScanDevices(connectDeviceName)) {
|
||||||
BlueManage().startScanSingle(
|
BlueManage().startScanSingle(
|
||||||
connectDeviceName, 15, (List<ScanResult> p0) => null);
|
connectDeviceName, 15, (List<ScanResult> p0) => null);
|
||||||
@ -528,6 +509,5 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1249,9 +1249,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 180.h,
|
top: 180.h,
|
||||||
left: 55.w,
|
width: 358.w,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
state.keyInfos.value.lockAlias!,
|
state.keyInfos.value.lockAlias!,
|
||||||
@ -1318,15 +1319,13 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startOpenLock() {
|
void startOpenLock() {
|
||||||
if (state.openLockBtnState.value == 1) {
|
if (state.openLockBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.iSOpenLock.value = true;
|
state.iSOpenLock.value = true;
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
|
||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
AppLog.log('点击开锁');
|
AppLog.log('点击开锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
// 不需要联网
|
// 不需要联网
|
||||||
@ -1346,10 +1345,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.iSOpenLock.value = false;
|
state.iSOpenLock.value = false;
|
||||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
|
||||||
state.openLockBtnState.value = 1;
|
state.openLockBtnState.value = 1;
|
||||||
state.animationController!.forward();
|
state.animationController!.forward();
|
||||||
|
|
||||||
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
|
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
|
||||||
AppLog.log('长按闭锁');
|
AppLog.log('长按闭锁');
|
||||||
if (state.isOpenLockNeedOnline.value == 0) {
|
if (state.isOpenLockNeedOnline.value == 0) {
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
|
||||||
if (connectionStateState == BluetoothConnectionState.connected) {
|
if (connectionStateState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -188,7 +188,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
|
|||||||
@ -99,7 +99,7 @@ class BurglarAlarmLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -136,7 +136,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected){
|
if (connectionState == BluetoothConnectionState.connected){
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class WifiListLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected){
|
if (connectionState == BluetoothConnectionState.connected){
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//蓝牙操作 ota 升级
|
//蓝牙操作 ota 升级
|
||||||
void blueOTAUpgrade(Map data, List<int> token) {
|
void blueOTAUpgrade(Map data, List<int> token) {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -245,7 +245,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
showDeletAlertTipDialog();
|
showDeletAlertTipDialog();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -306,7 +306,7 @@ class LockSetLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class LockSoundSetLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class MotorPowerLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 读取支持功能-带参数
|
// 读取支持功能-带参数
|
||||||
Future<void> _readSupportFunctionsNoParameters() async {
|
Future<void> _readSupportFunctionsNoParameters() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
@ -110,7 +110,7 @@ class MotorPowerLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 设置支持功能(带参数)
|
// 设置支持功能(带参数)
|
||||||
Future<void> sendOpenDoorDirection() async {
|
Future<void> sendOpenDoorDirection() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
|
|||||||
// 设置支持功能(带参数)
|
// 设置支持功能(带参数)
|
||||||
Future<void> sendOpenDoorDirection() async {
|
Future<void> sendOpenDoorDirection() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -109,7 +109,7 @@ class RemoteUnlockingLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState connectionState) async {
|
(BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
|||||||
@ -98,7 +98,7 @@ class ResetButtonLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class PalmDetailLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class PalmListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取人脸状态
|
// 获取人脸状态
|
||||||
Future<void> senderQueryingFaceStatus() async {
|
Future<void> senderQueryingFaceStatus() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -214,7 +214,7 @@ class PalmListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
// 查询用户、指纹、密码、卡片数量(用于判断是否同步)
|
||||||
Future<void> senderCheckingUserInfoCount() async {
|
Future<void> senderCheckingUserInfoCount() async {
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -246,7 +246,7 @@ class PalmListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: () {
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
|
|||||||
@ -127,7 +127,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -128,7 +128,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
@ -177,7 +177,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -342,7 +342,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|||||||
@ -252,6 +252,11 @@ class LockListInfoItemEntity {
|
|||||||
data['hasGateway'] = hasGateway;
|
data['hasGateway'] = hasGateway;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//是否是锁拥有者 也代表是超级管理员
|
||||||
|
bool isLockOwnerBool(){
|
||||||
|
return isLockOwner== 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Bluetooth {
|
class Bluetooth {
|
||||||
|
|||||||
@ -181,7 +181,7 @@ class LockListLogic extends BaseGetXController{
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
showDeletAlertTipDialog();
|
showDeletAlertTipDialog();
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
|
BlueManage().blueSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
|
||||||
if (connectionState == BluetoothConnectionState.connected) {
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>();
|
List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>();
|
||||||
var saveStrList = changeIntListToStringList(publicKeyData);
|
var saveStrList = changeIntListToStringList(publicKeyData);
|
||||||
|
|||||||
@ -108,7 +108,7 @@ class DebugConsoleController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
@ -179,7 +179,7 @@ class DebugConsoleController {
|
|||||||
tokenList = changeStringListToIntList(tokenKey!);
|
tokenList = changeStringListToIntList(tokenKey!);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
IoSenderManage.senderCleanUpUsersCommand(
|
IoSenderManage.senderCleanUpUsersCommand(
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
// state.sureBtnState.value = 0;
|
// state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(deviceName,
|
BlueManage().blueSendData(deviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
AppLog.log("点击要添加的设备了");
|
AppLog.log("点击要添加的设备了");
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
@ -415,7 +415,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
void oTAUpgrade(String deviceName) {
|
void oTAUpgrade(String deviceName) {
|
||||||
showTitleEasyLoading("连接设备中...");
|
showTitleEasyLoading("连接设备中...");
|
||||||
this.deviceName = deviceName;
|
this.deviceName = deviceName;
|
||||||
BlueManage().bludSendData(deviceName,
|
BlueManage().blueSendData(deviceName,
|
||||||
(BluetoothConnectionState state) async {
|
(BluetoothConnectionState state) async {
|
||||||
AppLog.log("连接设备");
|
AppLog.log("连接设备");
|
||||||
if (state == BluetoothConnectionState.connected) {
|
if (state == BluetoothConnectionState.connected) {
|
||||||
@ -460,7 +460,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
AppLog.log('blueOTAUpgrade:设备名字为 null');
|
AppLog.log('blueOTAUpgrade:设备名字为 null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BlueManage().bludSendData(deviceName!,
|
BlueManage().blueSendData(deviceName!,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
String uid = await Storage.getUid() ?? '';
|
String uid = await Storage.getUid() ?? '';
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
// 私钥
|
// 私钥
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class ExpireCardLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(state.deletExpireCardItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(state.deletExpireCardItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class ExpireFingerprintLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().bludSendData(state.deletExpireFingerprintItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(state.deletExpireFingerprintItemEntity.lockInfo!.btDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected){
|
if (deviceConnectionState == BluetoothConnectionState.connected){
|
||||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart';
|
|||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
|
|
||||||
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
|
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
|
||||||
AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
|
// AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
|
||||||
EasyLoading.dismiss(animation: true);
|
EasyLoading.dismiss(animation: true);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,8 +54,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.44+2024052002:打包给公司测试
|
# 1.0.44+2024052002:打包给公司测试
|
||||||
# 1.0.45+2024052003:打包给公司测试
|
# 1.0.45+2024052003:打包给公司测试
|
||||||
# 1.0.46+2024052004:打包给公司测试
|
# 1.0.46+2024052004:打包给公司测试
|
||||||
|
# 1.0.47+2024052101:打包给欧阳回归测试
|
||||||
|
|
||||||
version: 1.0.46+2024052004
|
version: 1.0.47+2024052101
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user