Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release

This commit is contained in:
Daisy 2024-05-22 09:16:36 +08:00
commit e9681e01a3
61 changed files with 468 additions and 569 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -17,6 +17,12 @@ typedef ConnectStateCallBack = Function(
typedef ScanDevicesCallBack = Function(List<ScanResult>);
class BlueManage {
factory BlueManage() => shareManager()!;
BlueManage._init() {
_initBlue();
}
final List<ScanResult> scanDevices = <ScanResult>[];
// id
@ -34,12 +40,6 @@ class BlueManage {
//
StreamSubscription<EventSendModel>? _sendStreamSubscription;
//
// StreamSubscription? _scanSubscription;
//
// StreamSubscription<dynamic>? _currentConnectionStream;
// StreamSubscription<List<ScanResult>>? _scanResultsSubscription;
StreamSubscription<BluetoothConnectionState>? _connectionStateSubscription;
StreamSubscription<int>? _mtuSubscription;
@ -64,11 +64,14 @@ class BlueManage {
BluetoothAdapterState? _adapterState = BluetoothAdapterState.unknown;
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() {
_manager ??= BlueManage._init();
@ -76,16 +79,12 @@ class BlueManage {
return _manager;
}
factory BlueManage() => shareManager()!;
BlueManage? get manager => shareManager();
void _initBlue() {
FlutterBluePlus.setLogLevel(LogLevel.error, color: true);
_initSendStreamSubscription();
_initAdapterStateStateSubscription();
// _initListenscanResults();
// _initListenConnectionState();
}
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() {
_connectionStateSubscription?.cancel();
_connectionStateSubscription = null;
@ -185,7 +145,7 @@ class BlueManage {
if (_adapterState == BluetoothAdapterState.on) {
try {
//android 8
final int divisor = Platform.isAndroid ? 8 : 1;
final int divisor = Platform.isAndroid ? 3 : 1;
FlutterBluePlus.startScan(
continuousDivisor: divisor,
continuousUpdates: true,
@ -316,7 +276,7 @@ class BlueManage {
}
/// List senderData,
Future<void> bludSendData(
Future<void> blueSendData(
String deviceName, ConnectStateCallBack stateCallBack,
{bool isAddEquipment = false}) 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) =>
element.device.platformName == connectDeviceName ||
element.device.platformName == connectDeviceName ||
element.advertisementData.advName == connectDeviceName);
return isExistDevice;
}
Future<void> _connectDevice(List<ScanResult> devicesList, String deviceName,
ConnectStateCallBack connectStateCallBack,
{bool isAddEquipment = false}) async {
@ -400,13 +359,9 @@ class BlueManage {
_initGetMtuSubscription();
_initListenConnectionState();
}
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
// stopScan();
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
// connectStateCallBack(BluetoothConnectionState.disconnected!);
return;
}
// AppLog.log("调用了停止扫描的方法");
await stopScan();
@ -438,28 +393,18 @@ class BlueManage {
connectStateCallBack(BluetoothConnectionState.disconnected);
}
// await bluetoothConnectDevice!.connect();
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
try {
bluetoothConnectDevice!
.discoverServices()
.then((List<BluetoothService> 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) {
for (final BluetoothCharacteristic characteristic
in service.characteristics) {
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
// " characteristic.uuid:${characteristic.uuid}"
// " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}"
// " characteristic.characteristicUuid:${characteristic.characteristicUuid}");
if (characteristic.characteristicUuid ==
_characteristicIdSubscription) {
_subScribeToCharacteristic(characteristic);
// AppLog.log('Discovering services finished');
bluetoothConnectionState = BluetoothConnectionState.connected;
connectStateCallBack(bluetoothConnectionState!);
}
@ -477,49 +422,41 @@ class BlueManage {
}
}
// ,
List<int> allData = <int>[];
//
List<int> lastTimeData = <int>[];
int? dataLen;
Future<void> _subScribeToCharacteristic(
BluetoothCharacteristic characteristic) async {
final StreamSubscription<List<int>> subscription =
characteristic.onValueReceived.listen((List<int> data) {
// AppLog.log("订阅获取的数据:$data");
AppLog.log('订阅获取的数据: $data ');
if (data == lastTimeData || data.isEmpty) {
return;
} else {
lastTimeData = data;
}
// code to handle incoming data
// AppLog.log("subscribeToCharacteristic: deviceId = ${characteristic.deviceId} characteristicId =${characteristic.characteristicId}---上报来的数据data = $data");
if ((data[0] == 0xEF) &&
(data[1] == 0x01) &&
(data[2] == 0xEE) &&
(data[3] == 0x02)) {
final bool dataHeadCorrect = isDataHeadCorrect(data);
final bool allDataHeadCorrect = isDataHeadCorrect(allData);
if (dataHeadCorrect && allDataHeadCorrect) {
//
allData = <int>[];
}
if (dataHeadCorrect) {
//
//
dataLen = data[8] * 256 + data[9]; // 16
// AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
if (dataLen! + 14 > data.length) {
//
allData.addAll(data);
} else {
//
allData.addAll(data);
// AppLog.log("dataLen2222:$dataLen getDataLength:${data.length}");
CommandReciverManager.appDataReceive(allData);
//
allData = <int>[];
}
} else {
} else if (allDataHeadCorrect) {
//
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) {
//
CommandReciverManager.appDataReceive(allData);
@ -532,24 +469,30 @@ class BlueManage {
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 {
final List<BluetoothService> services =
await bluetoothConnectDevice!.discoverServices();
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) {
for (final BluetoothCharacteristic characteristic
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) {
try {
final List<int> valueList = value;
@ -558,22 +501,10 @@ class BlueManage {
for (int i = 0; i < subData.length; i++) {
if (characteristic.properties.writeWithoutResponse) {
// 使WRITE_NO_RESPONSE属性写入值
await characteristic
.write(subData[i], withoutResponse: true)
.then((value) async {
// await Future.delayed(const Duration(milliseconds: 1)).then((
// value) async {
// AppLog.log('分包发送成功了');
// });
});
await characteristic.write(subData[i], withoutResponse: true);
} else if (characteristic.properties.write) {
// 使WRITE属性写入值
await characteristic.write(subData[i]).then((value) async {
// await Future.delayed(const Duration(milliseconds: 1)).then((
// value) async {
// AppLog.log('分包发送成功了');
// });
});
await characteristic.write(subData[i]);
} else {
//
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 {
try {
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
connectDeviceMacAddress = '';
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('断开连接成功');
}
// }
} on Exception catch (e, _) {
AppLog.log('断开连接失败: $e');
} finally {
@ -641,7 +546,7 @@ class BlueManage {
}
}
openBlue() async {
Future<void> openBlue() async {
if (Platform.isAndroid) {
await FlutterBluePlus.turnOn();
}
@ -650,10 +555,9 @@ class BlueManage {
}
}
disposed() {
void disposed() {
_sendStreamSubscription?.cancel();
_mtuSubscription!.cancel();
// _scanResultsSubscription!.cancel();
_adapterStateStateSubscription!.cancel();
_connectionStateSubscription!.cancel();
}

View File

@ -6,6 +6,7 @@ import '../app_settings/app_settings.dart';
import 'io_type.dart';
abstract class Reply{
Reply.parseData(this.commandType, List<int> dataDetail);
CommandType? commandType;
@ -13,122 +14,121 @@ abstract class Reply{
int status = 0;
List<int> data = [];
static String logTag= '锁 -> App指令订阅类型 :';
Reply.parseData(this.commandType, List<int> dataDetail);
void errorWithStstus(int status){
switch(status){
case 0x00:
//
AppLog.log("$logTag ${commandType?.typeName} 0x00 成功");
AppLog.log('$logTag ${commandType?.typeName} 0x00 成功');
break;
case 0x01:
//
AppLog.log("$logTag ${commandType!.typeName} 0x01 包格式错误");
showErrorMessage("包格式错误");
AppLog.log('$logTag ${commandType!.typeName} 0x01 包格式错误');
showErrorMessage('包格式错误');
break;
case 0x02:
//
AppLog.log("$logTag ${commandType!.typeName} 0x02 密码错误");
showErrorMessage("密码错误");
AppLog.log('$logTag ${commandType!.typeName} 0x02 密码错误');
showErrorMessage('密码错误');
break;
case 0x03:
//
AppLog.log("$logTag ${commandType!.typeName} 0x03 网络中断");
showErrorMessage("网络中断");
AppLog.log('$logTag ${commandType!.typeName} 0x03 网络中断');
showErrorMessage('网络中断');
break;
case 0x04:
//
AppLog.log("$logTag ${commandType!.typeName} 0x04 用户未登记");
showErrorMessage("用户未登记");
AppLog.log('$logTag ${commandType!.typeName} 0x04 用户未登记');
showErrorMessage('用户未登记');
break;
case 0x05:
//
AppLog.log("$logTag ${commandType!.typeName} 0x05 参数错误");
showErrorMessage("参数错误");
AppLog.log('$logTag ${commandType!.typeName} 0x05 参数错误');
showErrorMessage('参数错误');
break;
case 0x06:
//
AppLog.log("$logTag ${commandType!.typeName} 0x06 需要鉴权");
AppLog.log('$logTag ${commandType!.typeName} 0x06 需要鉴权');
// showErrorMessage("需要鉴权");
break;
case 0x07:
//
AppLog.log("$logTag ${commandType!.typeName} 0x07 无权限");
AppLog.log('$logTag ${commandType!.typeName} 0x07 无权限');
// showErrorMessage("无权限");
break;
case 0x08:
//
AppLog.log("$logTag ${commandType!.typeName} 0x08 应答超时");
showErrorMessage("应答超时");
AppLog.log('$logTag ${commandType!.typeName} 0x08 应答超时');
showErrorMessage('应答超时');
break;
case 0x09:
//
AppLog.log("$logTag ${commandType!.typeName} 0x09 权限校验错误");
showErrorMessage("权限校验错误");
AppLog.log('$logTag ${commandType!.typeName} 0x09 权限校验错误');
showErrorMessage('权限校验错误');
break;
case 0x0a:
//
showErrorMessage("钥匙不存在");
AppLog.log("$logTag ${commandType!.typeName} 0x0a 钥匙不存在");
showErrorMessage('钥匙不存在');
AppLog.log('$logTag ${commandType!.typeName} 0x0a 钥匙不存在');
break;
case 0x0b:
//
showErrorMessage("钥匙过期");
AppLog.log("$logTag ${commandType!.typeName} 0x0b 钥匙过期");
showErrorMessage('钥匙过期');
AppLog.log('$logTag ${commandType!.typeName} 0x0b 钥匙过期');
break;
case 0x0c:
//
showErrorMessage("钥匙数量已到上限");
AppLog.log("$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限");
showErrorMessage('钥匙数量已到上限');
AppLog.log('$logTag ${commandType!.typeName} 0x0c 钥匙数量已到上限');
break;
case 0x0d:
//
showErrorMessage("钥匙无效");
AppLog.log("$logTag ${commandType!.typeName} 0x0d 钥匙无效");
showErrorMessage('钥匙无效');
AppLog.log('$logTag ${commandType!.typeName} 0x0d 钥匙无效');
break;
case 0x0e:
//
showErrorMessage("钥匙已存在");
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙已存在");
showErrorMessage('钥匙已存在');
AppLog.log('$logTag ${commandType!.typeName} 0x0e 钥匙已存在');
break;
case 0x0f:
//
AppLog.log("$logTag ${commandType!.typeName} 0x0f 用户已存在");
showErrorMessage("用户已存在");
AppLog.log('$logTag ${commandType!.typeName} 0x0f 用户已存在');
showErrorMessage('用户已存在');
break;
case 0x10:
//
AppLog.log("$logTag ${commandType!.typeName} 0x11 密码失效");
showErrorMessage("密码失效");
AppLog.log('$logTag ${commandType!.typeName} 0x11 密码失效');
showErrorMessage('密码失效');
break;
case 0x11:
//
AppLog.log("$logTag ${commandType!.typeName} 0x11 无效指令");
showErrorMessage("无效指令");
AppLog.log('$logTag ${commandType!.typeName} 0x11 无效指令');
showErrorMessage('无效指令');
break;
case 0x12:
//
AppLog.log("$logTag ${commandType!.typeName} 0x12 门锁时间异常");
showErrorMessage("门锁时间异常");
AppLog.log('$logTag ${commandType!.typeName} 0x12 门锁时间异常');
showErrorMessage('门锁时间异常');
break;
case 0x15:
// APP()
AppLog.log("$logTag ${commandType!.typeName} 0x15 APP(手机)未联网");
showErrorMessage("APP(手机)未联网");
AppLog.log('$logTag ${commandType!.typeName} 0x15 APP(手机)未联网');
showErrorMessage('APP(手机)未联网');
break;
case 0x16:
// ...
AppLog.log("$logTag ${commandType!.typeName} $status 正在开锁中...");
showErrorMessage("正在开锁中...");
AppLog.log('$logTag ${commandType!.typeName} $status 正在开锁中...');
showErrorMessage('正在开锁中...');
break;
case 0xff:
//
AppLog.log("$logTag ${commandType!.typeName} 0xff 异常,未知错误");
showErrorMessage("异常,未知错误");
AppLog.log('$logTag ${commandType!.typeName} 0xff 异常,未知错误');
showErrorMessage('异常,未知错误');
break;
default:
//
AppLog.log("$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题");
AppLog.log('$logTag ${commandType!.typeName} $status 蓝牙返回其他错误问题');
break;
}
}

View File

@ -39,7 +39,7 @@ abstract class SenderProtocol extends IOData {
? '子命令:${data[3]}' : ''} \n参数是:\n${toString()} \n加密之前数据是:\n$data :${data.length}");
}
//TODO:Ï
//TODO:
List<int> packageData() {
commandData = messageDetail();
List<int> commandList = [];

View File

@ -47,12 +47,12 @@ import 'io_tool/manager_event_bus.dart';
import 'sm4Encipher/sm4.dart';
class CommandReciverManager {
static void appDataReceive(List<int> data) async {
static Future<void> appDataReceive(List<int> data) async {
///
if (data.isEmpty) {
return;
}
int dataSize = data.length;
final int dataSize = data.length;
// 13
if (dataSize < 13) {
return;
@ -62,20 +62,20 @@ class CommandReciverManager {
(data[1] == 0x01) &&
(data[2] == 0xEE) &&
(data[3] == 0x02)) {
var tmpType = (data[7] & 0x0f); //
// AppLog.log("temType:$tmpType");
final int tmpType = data[7] & 0x0f; //
// AppLog.log('temType:$tmpType');
var dataLen = data[8] * 256 + data[9]; // 16
var oriLen = data[10] * 256 + data[11]; // 16
final int dataLen = data[8] * 256 + data[9]; // 16
final int oriLen = data[10] * 256 + data[11]; // 16
// AppLog.log("dataLen:$dataLen oriLen:$oriLen");
List<int> oriDataList = [];
List<int> oriDataList = <int>[];
switch (tmpType) {
case 0: //
// for (var i = 0; i < oriLen ; i++) {
// oriDataList.add(data[12 + i]);
// }
oriDataList = data.sublist(12, 12 + dataLen);
AppLog.log("不加密 :$oriDataList");
AppLog.log('不加密 :$oriDataList');
break;
case 1:
//AES128
@ -83,7 +83,7 @@ class CommandReciverManager {
case 2:
// SM4
//
var getDataList = data.sublist(12, 12 + dataLen);
final List<int> getDataList = data.sublist(12, 12 + dataLen);
//
// String key = SM4.createHexKey(key: IoManager().getCurrentDeviceLockId);
@ -91,39 +91,39 @@ class CommandReciverManager {
key: utf8.encode(BlueManage().connectDeviceName),
mode: SM4CryptoMode.ECB);
oriDataList = oriDataList.sublist(0, oriLen);
AppLog.log("APP收到的解密后的数据:$oriDataList");
AppLog.log('APP收到的解密后的数据:$oriDataList');
break;
case 3:
//SM4
//
var getDataList = data.sublist(12, 12 + dataLen);
final List<int> getDataList = data.sublist(12, 12 + dataLen);
var res = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(res!);
final List<String>? res = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(res!);
//
oriDataList = SM4.decrypt(getDataList,
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
oriDataList = oriDataList.sublist(0, oriLen);
AppLog.log("APP收到的解密后的数据:$oriDataList");
AppLog.log('APP收到的解密后的数据:$oriDataList data:$data');
break;
}
parseData(oriDataList).then((Reply? value) async {
EasyLoading.dismiss();
await EventBusManager().eventBusFir(value);
}).catchError((error) {
AppLog.log("APP解析数据时发生错误: $error");
AppLog.log('APP解析数据时发生错误: $error');
});
}
}
static Future<Reply?> parseData(List<int> data) async {
if (data.isNotEmpty) {
var cmd = data[0] * 256 + data[1];
CommandType commandType = ExtensionCommandType.getCommandType(cmd);
final int cmd = data[0] * 256 + data[1];
final CommandType commandType = ExtensionCommandType.getCommandType(cmd);
await IoManager().increaseCommandIndex();
// data.removeRange(0, 2);
var reply;
Reply? reply;
switch (commandType) {
case CommandType.getLockPublicKey:
{
@ -204,7 +204,7 @@ class CommandReciverManager {
case CommandType.generalExtendedCommond:
{
//
int subType = data[3];
final int subType = data[3];
switch (subType) {
case 2:
{
@ -437,5 +437,6 @@ class CommandReciverManager {
}
return reply;
}
return null;
}
}

View File

@ -70,4 +70,13 @@ class XSConstantMacro {
static int catEyeWorkModeStayCapture = 2; //
static int catEyeWorkModeRealTimeMonitoring = 3; //
static int catEyeWorkModeCustom = 4; //
//
static int userTypeSuperAdmin = 110301; //
static int userTypeAuthorizedAdmin = 110302; //
//
static int keyRightAdmin = 1; //
static int keyRightOrdinary = 2; //
}

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
import 'package:get/get.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/mine/mine/starLockMine_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
@ -47,11 +48,10 @@ class StarLockLoginLogic extends BaseGetXController {
Storage.saveLoginData(entity.data);
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
eventBus.fire(MineInfoChangeRefreshUI());
// Get.back();
// Get.toNamed(Routers.starLockMain);
XSJPushProvider().initJPushService();
XSJPushProvider().initLocalNotification(false);
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
BlueManage().scanDevices.clear(); //
}
}

View File

@ -73,7 +73,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
//
Future<void> transferPermissionsAction() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -147,7 +147,7 @@ class AddICCardLogic extends BaseGetXController{
showBlueConnetctToastTimer(action: (){
Get.close(1);
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
cancelBlueConnetctToastTimer();
// var publicKey = await Storage.getStringList(saveBluePublicKey);
@ -193,7 +193,7 @@ class AddICCardLogic extends BaseGetXController{
//
Future<void> senderCancelAddCardCommand() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -100,7 +100,7 @@ class CardDetailLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -229,7 +229,7 @@ class CardListLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);

View File

@ -105,7 +105,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -257,7 +257,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
@ -313,7 +313,7 @@ class OtherTypeKeyChangeDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var signKey = await Storage.getStringList(saveBlueSignKey);

View File

@ -107,7 +107,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -259,7 +259,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
@ -315,7 +315,7 @@ class OtherTypeKeyChangeValidityDateLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var signKey = await Storage.getStringList(saveBlueSignKey);

View File

@ -1,7 +1,9 @@
import 'dart:async';
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 '../../../../tools/baseGetXController.dart';
@ -9,96 +11,94 @@ import '../../../../tools/dateTool.dart';
import '../../../../tools/eventBusEventManage.dart';
import 'checkingInSet_state.dart';
class CheckingInSetLogic extends BaseGetXController{
class CheckingInSetLogic extends BaseGetXController {
CheckingInSetState state = CheckingInSetState();
//
void openCheckingInData() async{
var entity = await ApiRepository.to.openCheckingInData(
lockId:state.getKeyInfosData.value.lockId.toString(),
Future<void> openCheckingInData() async {
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
lockId: state.getKeyInfosData.value.lockId.toString(),
);
if(entity.errorCode!.codeIsSuccessful){
if (entity.errorCode!.codeIsSuccessful) {
state.companyId.value = entity.data!.companyId.toString();
getCheckInSetInfoData();
}
}
//
void getCheckInSetInfoData() async{
var entity = await ApiRepository.to.getCheckInSetInfoData(
Future<void> getCheckInSetInfoData() async {
final CheckingInSetEntity entity = await ApiRepository.to.getCheckInSetInfoData(
companyId: state.companyId.value,
);
if(entity.errorCode!.codeIsSuccessful){
if (entity.errorCode!.codeIsSuccessful) {
state.checkingInSetInfo.value = entity.data!;
state.beginTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workStartTime.toString());
state.endTime.value = DateTool().dateToHNString(state.checkingInSetInfo.value.workEndTime.toString());
state.beginTimeTimestamp.value = state.checkingInSetInfo.value.workStartTime.toString();
state.endTimeTimestamp.value = state.checkingInSetInfo.value.workEndTime.toString();
state.beginTime.value = DateTool().dateToHNString(
state.checkingInSetInfo.value.workStartTime.toString());
state.endTime.value = DateTool()
.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.weekDaysStr.value = state.weekDays.value.join(",");
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false;
state.weekDaysStr.value = state.weekDays.join(',');
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.changeNameController.text = state.companyName.value;
}
}
//
void editCheckInSetInfoData() async{
var entity = await ApiRepository.to.editCheckInSetInfoData(
Future<void> editCheckInSetInfoData() async {
final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData(
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
companyId: state.checkingInSetInfo.value.companyId.toString(),
type: "1",
type: '1',
companyName: state.changeNameController.text,
workEndTime: state.checkingInSetInfo.value.workEndTime.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;
showToast("修改成功");
showToast('修改成功');
}
}
//
void deletCompanyData() async{
var entity = await ApiRepository.to.deletCompanyData(
companyId:state.checkingInSetInfo.value.companyId!,
Future<void> deletCompanyData() async {
final CheckingInInfoDataEntity entity = await ApiRepository.to.deletCompanyData(
companyId: state.checkingInSetInfo.value.companyId!,
);
if(entity.errorCode!.codeIsSuccessful){
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, "0"));
if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(0, '0'));
Get.close(2);
}
}
late StreamSubscription _teamEvent;
void _initLoadDataAction() {
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((event) {
_teamEvent = eventBus.on<RefreshCheckInSetDataEvent>().listen((RefreshCheckInSetDataEvent event) {
getCheckInSetInfoData();
});
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initLoadDataAction();
openCheckingInData();
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
_teamEvent.cancel();
}
}
}

View File

@ -73,13 +73,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
'checkingInSetInfo': state.checkingInSetInfo.value,
});
if(data != null) {
setState(() {
// state.beginTime.value = data["beginTime"];
// state.endTime.value = data["endTime"];
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
logic.getCheckInSetInfoData();
});
setState(logic.getCheckInSetInfoData);
}
})),
Obx(() => CommonItem(
@ -98,7 +92,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
if(data != null) {
state.isCustom.value = data['attendanceType'];
state.weekDays.value = data['weekDays'];
state.weekDaysStr.value = state.weekDays.value.join(',');
state.weekDaysStr.value = state.weekDays.join(',');
}
})),
CommonItem(
@ -125,9 +119,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
onClick: () {
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, () {
logic.deletCompanyData();
});
ShowTipView().showIosTipWithContentDialog('是否删除?'.tr, logic.deletCompanyData);
// showDeletCompanyAlertDialog(context);
}),
),

View File

@ -1,9 +1,7 @@
import 'dart:async';
import 'dart:ffi';
import 'package:flutter/material.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/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart';
@ -72,7 +70,7 @@ class CheckingInAddStaffLogic extends BaseGetXController {
);
if (entity.errorCode!.codeIsSuccessful) {
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('@')) {
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(
attendanceType: state.selectPrintingMethodType.value,
@ -151,25 +154,15 @@ class CheckingInAddStaffLogic extends BaseGetXController {
@override
void onReady() {
// TODO: implement onReady
super.onReady();
_initLoadDataAction();
changeInput(state.staffNameController);
}
@override
void onInit() {
super.onInit();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
_getNumberEvent!.cancel();
}
}

View File

@ -214,15 +214,18 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
child: Container(
height: 40.h,
padding: EdgeInsets.only(
left: 25.w, right: 25.w, top: 2.h),
left: 25.w,
right: 25.w,
),
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(20.h),
),
child: Text(addStaffSelectKeyType(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white, fontSize: 22.sp)),
child: Center(
child: Text(addStaffSelectKeyType(),
style: TextStyle(
color: Colors.white, fontSize: 22.sp)),
),
),
),
],

View File

@ -145,9 +145,21 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
SizedBox(
width: 20.w,
),
// CustomNetworkImage(url: staffListItem.headurl!, width: 40.w , height: 40.w),
Image.asset(getTypeIcon(staffListItem.attendanceType!),
width: 60.w, height: 60.w),
if (staffListItem.headurl == null || staffListItem.headurl == '')
Image.asset(
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(
width: 20.w,
),

View File

@ -106,7 +106,7 @@ class DoorLockLogLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -255,16 +255,18 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
Future<void> openModalBottomSheet(BuildContext context) async {
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>[
if (state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen)
'取消冻结'.tr
else
'冻结'.tr,
// '取消授权'.tr
if (isLockOwner) '取消授权'.tr
];
} else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) {
} else if (isLockOwner) {
//
if (state.keyType.value == 1 || state.keyType.value == 2) {
textList = <String>[

View File

@ -186,7 +186,7 @@ class AddFaceLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () {
Get.close(1);
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
cancelBlueConnetctToastTimer();
@ -231,7 +231,7 @@ class AddFaceLogic extends BaseGetXController {
//
Future<void> senderCancelAddFaceCommand() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -97,7 +97,7 @@ class FaceDetailLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -256,7 +256,7 @@ class FaceListLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {

View File

@ -185,7 +185,7 @@ class AddFingerprintLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: (){
Get.close(1);
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -227,7 +227,7 @@ class AddFingerprintLogic extends BaseGetXController {
//
Future<void> senderCancelAddFingerprintCommand() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -98,7 +98,7 @@ class FingerprintDetailLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);

View File

@ -189,7 +189,7 @@ class FingerprintListLogic extends BaseGetXController{
}
//
Future<void> senderQueryingFingerprintStatus() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async {
BlueManage().blueSendData(BlueManage().connectDeviceName,(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -217,7 +217,7 @@ class FingerprintListLogic extends BaseGetXController{
// ()
Future<void> senderCheckingUserInfoCount() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -248,7 +248,7 @@ class FingerprintListLogic extends BaseGetXController{
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);

View File

@ -90,7 +90,7 @@ class IrisDetailLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
// var publicKey = await Storage.getStringList(saveBluePublicKey);

View File

@ -189,7 +189,7 @@ class IrisListLogic extends BaseGetXController {
//
Future<void> senderQueryingFaceStatus() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -218,7 +218,7 @@ class IrisListLogic extends BaseGetXController {
// ()
Future<void> senderCheckingUserInfoCount() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -250,7 +250,7 @@ class IrisListLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);

View File

@ -37,17 +37,17 @@ class LockDetailLogic extends BaseGetXController {
void initReplySubscription() {
state.replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
//
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
_replyOpenLock(reply);
}
//
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
_replyOpenLock(reply);
}
//
if (reply is SenderReferEventRecordTimeReply &&
state.ifCurrentScreen.value == true) {
_replyReferEventRecordTime(reply);
}
});
//
if (reply is SenderReferEventRecordTimeReply &&
state.ifCurrentScreen.value == true) {
_replyReferEventRecordTime(reply);
}
});
}
//
@ -56,19 +56,18 @@ class LockDetailLogic extends BaseGetXController {
switch (status) {
case 0x00:
//
// _showFullScreenOverlay(Get.context!);
cancelBlueConnetctToastTimer();
//
// _showFullScreenOverlay(Get.context!);
state.iSClosedUnlockSuccessfulPopup.value = true;
cancelBlueConnetctToastTimer();
state.closedUnlockSuccessfulTimer?.cancel();
// 3
state.closedUnlockSuccessfulTimer =
Timer.periodic(3.seconds, (Timer timer) {
state.iSClosedUnlockSuccessfulPopup.value = false;
timer.cancel();
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
state.iSClosedUnlockSuccessfulPopup.value = false;
timer.cancel();
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
//
final int power = reply.data[7];
@ -81,19 +80,20 @@ class LockDetailLogic extends BaseGetXController {
}
//
uploadElectricQuantityRequest();
//
getLockRecordLastUploadDataTime();
resetOpenDoorState();
state.animationController!.stop();
break;
case 0x06:
//
//
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
changeStringListToIntList(privateKey!);
final List<String>? signKey =
await Storage.getStringList(saveBlueSignKey);
await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<int> tokenData = reply.data.sublist(2, 6);
@ -113,71 +113,58 @@ class LockDetailLogic extends BaseGetXController {
);
break;
case 0x16:
// ...
// ...
resetOpenDoorState();
showToast('正在开锁中...'.tr, something: () {
cancelBlueConnetctToastTimer();
});
break;
case 0x0d:
//
//
showToast('钥匙无效'.tr);
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
case 0x0b:
//
//
showToast('钥匙过期'.tr);
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
case 0x0a:
//
//
showToast('钥匙不存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
case 0x0c:
//
//
showToast('钥匙数量已到上限');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
case 0x0e:
//
//
showToast('钥匙已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
case 0x0f:
//
//
showToast('用户已存在');
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
default:
//
//
AppLog.log('开锁失败');
// state.animationController!.stop();
resetOpenDoorState();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
openDoorError();
break;
}
}
//
void openDoorError() {
resetOpenDoorState();
state.animationController!.stop();
cancelBlueConnetctToastTimer();
BlueManage().disconnect();
}
//
void closeLuckStatus() {
state.openLockBtnState.value = 0;
@ -190,67 +177,67 @@ class LockDetailLogic extends BaseGetXController {
Future<void> _replyReferEventRecordTime(Reply reply) async {
final int status = reply.data[2];
switch (status) {
case 0x00:
//
final int dataLength = (reply.data[5] << 8) + reply.data[6];
// AppLog.log("dataLength:$dataLength");
if (dataLength > 0) {
reply.data.removeRange(0, 7);
// 17
if (reply.data.length < 17) {
return;
}
final List<List<int>> getList = splitList(reply.data, 17);
// AppLog.log("getList:$getList");
final List uploadList = [];
for (int i = 0; i < getList.length; i++) {
final List<int> indexList = getList[i];
// AppLog.log("indexList:$indexList");
final Map indexMap = {};
indexMap['type'] = indexList[0].toString();
int operateDate = 0;
if (indexList[0] == 2) {
final List<int> passwordData = reply.data.sublist(7, 17);
final String password = utf8String(passwordData);
indexMap['user'] = password.toString();
} else {
final int userNo = (indexList[1] * 256) + indexList[2];
indexMap['user'] = userNo.toString();
}
case 0x00:
//
final int dataLength = (reply.data[5] << 8) + reply.data[6];
// AppLog.log("dataLength:$dataLength");
if (dataLength > 0) {
reply.data.removeRange(0, 7);
// 17
if (reply.data.length < 17) {
return;
}
final List<List<int>> getList = splitList(reply.data, 17);
// AppLog.log("getList:$getList");
final List uploadList = [];
for (int i = 0; i < getList.length; i++) {
final List<int> indexList = getList[i];
// AppLog.log("indexList:$indexList");
final Map indexMap = {};
indexMap['type'] = indexList[0].toString();
int operateDate = 0;
if (indexList[0] == 2) {
final List<int> passwordData = reply.data.sublist(7, 17);
final String password = utf8String(passwordData);
indexMap['user'] = password.toString();
} else {
final int userNo = (indexList[1] * 256) + indexList[2];
indexMap['user'] = userNo.toString();
}
indexMap['success'] = '1';
indexMap['success'] = '1';
final int time = ((0xff & indexList[(3)]) << 24 |
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
operateDate = time * 1000;
indexMap['date'] = '$operateDate';
uploadList.add(indexMap);
final int time = ((0xff & indexList[(3)]) << 24 |
(0xff & indexList[4]) << 16 |
(0xff & indexList[5]) << 8 |
(0xFF & indexList[6]));
operateDate = time * 1000;
indexMap['date'] = '$operateDate';
uploadList.add(indexMap);
if (i == getList.length - 1) {
//
state.operateDate = operateDate;
}
}
lockRecordUploadData(uploadList);
if (i == getList.length - 1) {
//
state.operateDate = operateDate;
}
}
lockRecordUploadData(uploadList);
if (dataLength == state.logCountPage) {
senderReferEventRecordTime();
} else {
await BlueManage().disconnect();
}
}
break;
case 0x06:
//
BlueManage().disconnect();
cancelBlueConnetctToastTimer();
break;
default:
BlueManage().disconnect();
cancelBlueConnetctToastTimer();
break;
if (dataLength == state.logCountPage) {
senderReferEventRecordTime();
} else {
await BlueManage().disconnect();
}
}
break;
case 0x06:
//
BlueManage().disconnect();
cancelBlueConnetctToastTimer();
break;
default:
BlueManage().disconnect();
cancelBlueConnetctToastTimer();
break;
}
}
@ -258,11 +245,11 @@ class LockDetailLogic extends BaseGetXController {
Future<void> openDoorAction() async {
showBlueConnetctToastTimer(action: () {
resetOpenDoorState();
// BlueManage().stopScan();
closeLuckStatus();
BlueManage().disconnect();
});
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
@ -272,89 +259,84 @@ class LockDetailLogic extends BaseGetXController {
final List<int> getTokenList = changeStringListToIntList(token!);
BlueManage()
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
.blueSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderOpenLock(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
openMode: state.openDoorModel,
openTime: getUTCNetTime(),
onlineToken: state.lockNetToken,
token: getTokenList,
needAuthor: 1,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
);
} else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
cancelBlueConnetctToastTimer();
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
if (deviceConnectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderOpenLock(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
openMode: state.openDoorModel,
openTime: getUTCNetTime(),
onlineToken: state.lockNetToken,
token: getTokenList,
needAuthor: 1,
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
);
} else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
cancelBlueConnetctToastTimer();
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
resetOpenDoorState();
}
});
resetOpenDoorState();
}
});
}
// ()
Future<void> senderReferEventRecordTime() async {
void senderReferEventRecordTime() {
showBlueConnetctToastTimer(
isShowBlueConnetctToast: false,
outTimer: 10,
action: () {
closeLuckStatus();
BlueManage().disconnect();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey =
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
final List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(
saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? publicKey =
final List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
final List<int> getPublicKeyList =
final List<int> getPublicKeyList =
changeStringListToIntList(publicKey!);
IoSenderManage.senderReferEventRecordTimeCommand(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
logsCount: state.logCountPage,
// time:DateTime.now().millisecondsSinceEpoch~/1000,
time: state.operateDate,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
}
});
IoSenderManage.senderReferEventRecordTimeCommand(
keyID: BlueManage().connectDeviceName,
userID: await Storage.getUid(),
logsCount: state.logCountPage,
// time:DateTime.now().millisecondsSinceEpoch~/1000,
time: state.operateDate,
token: getTokenList,
needAuthor: 1,
publicKey: getPublicKeyList,
privateKey: getPrivateKeyList,
);
}
});
}
//
void getServerDatetime() async {
final GetServerDatetimeEntity entity =
await ApiRepository.to.getServerDatetimeData();
await ApiRepository.to.getServerDatetimeData();
if (entity.errorCode!.codeIsSuccessful) {
state.differentialTime = entity.data!.date! ~/ 1000 -
DateTime
.now()
.millisecondsSinceEpoch ~/ 1000;
DateTime.now().millisecondsSinceEpoch ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
}
}
int getUTCNetTime() {
return DateTime
.now()
.millisecondsSinceEpoch ~/ 1000 +
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
state.differentialTime;
}
@ -380,11 +362,11 @@ class LockDetailLogic extends BaseGetXController {
Future<void> uploadElectricQuantityRequest() async {
final KeyOperationRecordEntity entity = await ApiRepository.to
.uploadElectricQuantity(
electricQuantity: state.electricQuantity.value.toString(),
electricQuantityStandby:
state.electricQuantityStandby.value.toString(),
lockId: state.keyInfos.value.lockId.toString(),
isUnShowLoading: true);
electricQuantity: state.electricQuantity.value.toString(),
electricQuantityStandby:
state.electricQuantityStandby.value.toString(),
lockId: state.keyInfos.value.lockId.toString(),
isUnShowLoading: true);
if (entity.errorCode!.codeIsSuccessful) {
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent(isUnShowLoading: true));
@ -395,8 +377,8 @@ class LockDetailLogic extends BaseGetXController {
//
void getLockRecordLastUploadDataTime() async {
final LockOperatingRecordGetLastRecordTimeEntity entity =
await ApiRepository.to.getLockRecordLastUploadDataTime(
lockId: state.keyInfos.value.lockId.toString());
await ApiRepository.to.getLockRecordLastUploadDataTime(
lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) {
state.operateDate = entity.data!.operateDate! ~/ 1000;
senderReferEventRecordTime();
@ -407,7 +389,7 @@ class LockDetailLogic extends BaseGetXController {
Future<void> lockRecordUploadData(List list) async {
final KeyOperationRecordEntity entity = await ApiRepository.to
.lockRecordUploadData(
lockId: state.keyInfos.value.lockId.toString(), records: list);
lockId: state.keyInfos.value.lockId.toString(), records: list);
if (entity.errorCode!.codeIsSuccessful) {
// mockNetworkDataRequest();
AppLog.log(
@ -423,7 +405,7 @@ class LockDetailLogic extends BaseGetXController {
void deletKeyData() async {
final ElectronicKeyListEntity entity = await ApiRepository.to
.deleteElectronicKey(
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) {
@ -440,51 +422,50 @@ class LockDetailLogic extends BaseGetXController {
eventBus
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
if (event.type == 0) {
// 0
state.isAttendance.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.attendance =
int.parse(event.setResult);
} else if (event.type == 1) {
// 1
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline =
int.parse(event.setResult);
state.lockNetToken = ''; // token
} else if (event.type == 2) {
// 2
state.isOpenPassageMode.value = int.parse(event.setResult);
state.keyInfos.value.passageMode = int.parse(event.setResult);
} else if (event.type == 3) {
// 3
state.lockAlias.value = event.setResult;
state.keyInfos.value.lockAlias = event.setResult;
Storage.setString(saveLockAlias, state.lockAlias.value);
} else if (event.type == 4) {
// 4
state.electricQuantity.value = int.parse(event.setResult);
state.keyInfos.value.electricQuantity = int.parse(event.setResult);
} else if (event.type == 5) {
// 5
state.keyInfos.value.lockSetting!.remoteUnlock =
int.parse(event.setResult);
}
CommonDataManage().currentKeyInfo = state.keyInfos.value;
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
if (event.type == 0) {
// 0
state.isAttendance.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.attendance =
int.parse(event.setResult);
} else if (event.type == 1) {
// 1
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline =
int.parse(event.setResult);
state.lockNetToken = ''; // token
} else if (event.type == 2) {
// 2
state.isOpenPassageMode.value = int.parse(event.setResult);
state.keyInfos.value.passageMode = int.parse(event.setResult);
} else if (event.type == 3) {
// 3
state.lockAlias.value = event.setResult;
state.keyInfos.value.lockAlias = event.setResult;
Storage.setString(saveLockAlias, state.lockAlias.value);
} else if (event.type == 4) {
// 4
state.electricQuantity.value = int.parse(event.setResult);
state.keyInfos.value.electricQuantity = int.parse(event.setResult);
} else if (event.type == 5) {
// 5
state.keyInfos.value.lockSetting!.remoteUnlock =
int.parse(event.setResult);
}
CommonDataManage().currentKeyInfo = state.keyInfos.value;
eventBus.fire(RefreshLockDetailInfoDataEvent());
});
}
String getKeyStatusTextAndShow() {
String text = '';
if (state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective ||
XSConstantMacro.keyStatusWaitIneffective ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
text =
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(
state.keyInfos.value.keyStatus!)}";
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
} else {
text = state.isOpenPassageMode.value == 1
? '常开模式启动!长按闭锁'.tr
@ -517,8 +498,8 @@ class LockDetailLogic extends BaseGetXController {
await PermissionDialog.request(Permission.location);
await PermissionDialog.requestBluetooth();
final String connectDeviceName = state.keyInfos.value.bluetooth!
.bluetoothDeviceName!;
final String connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
if (!BlueManage().isExistScanDevices(connectDeviceName)) {
BlueManage().startScanSingle(
connectDeviceName, 15, (List<ScanResult> p0) => null);
@ -528,6 +509,5 @@ class LockDetailLogic extends BaseGetXController {
@override
void onInit() {
super.onInit();
}
}

View File

@ -1249,9 +1249,10 @@ class _LockDetailPageState extends State<LockDetailPage>
),
Positioned(
top: 180.h,
left: 55.w,
width: 358.w,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
state.keyInfos.value.lockAlias!,
@ -1318,15 +1319,13 @@ class _LockDetailPageState extends State<LockDetailPage>
}
}
void startOpenLock() {
void startOpenLock() {
if (state.openLockBtnState.value == 1) {
return;
}
state.iSOpenLock.value = true;
state.iSClosedUnlockSuccessfulPopup.value = false;
state.openLockBtnState.value = 1;
state.animationController!.forward();
AppLog.log('点击开锁');
if (state.isOpenLockNeedOnline.value == 0) {
//
@ -1346,10 +1345,8 @@ class _LockDetailPageState extends State<LockDetailPage>
return;
}
state.iSOpenLock.value = false;
state.iSClosedUnlockSuccessfulPopup.value = false;
state.openLockBtnState.value = 1;
state.animationController!.forward();
EasyLoading.showToast('正在尝试闭锁……'.tr, duration: 2000.milliseconds);
AppLog.log('长按闭锁');
if (state.isOpenLockNeedOnline.value == 0) {

View File

@ -97,7 +97,7 @@ class LockOperatingRecordLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionStateState) async {
if (connectionStateState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -116,7 +116,7 @@ class AutomaticBlockingLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -188,7 +188,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -50,7 +50,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading();

View File

@ -99,7 +99,7 @@ class BurglarAlarmLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -136,7 +136,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected){
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -113,7 +113,7 @@ class WifiListLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected){
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);

View File

@ -80,7 +80,7 @@ class LockEscalationLogic extends BaseGetXController {
// ota
void blueOTAUpgrade(Map data, List<int> token) {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -245,7 +245,7 @@ class LockSetLogic extends BaseGetXController {
dismissEasyLoading();
showDeletAlertTipDialog();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -306,7 +306,7 @@ class LockSetLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -103,7 +103,7 @@ class LockSoundSetLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -103,7 +103,7 @@ class LockTimeLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -84,7 +84,7 @@ class MotorPowerLogic extends BaseGetXController {
// -
Future<void> _readSupportFunctionsNoParameters() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -110,7 +110,7 @@ class MotorPowerLogic extends BaseGetXController {
// ()
Future<void> sendOpenDoorDirection() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -120,7 +120,7 @@ class NormallyOpenModeLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -86,7 +86,7 @@ class OpenDoorDirectionLogic extends BaseGetXController {
// ()
Future<void> sendOpenDoorDirection() async {
showEasyLoading();
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
dismissEasyLoading();
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -109,7 +109,7 @@ class RemoteUnlockingLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);

View File

@ -98,7 +98,7 @@ class ResetButtonLogic extends BaseGetXController{
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);

View File

@ -89,7 +89,7 @@ class PalmDetailLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
// var publicKey = await Storage.getStringList(saveBluePublicKey);

View File

@ -185,7 +185,7 @@ class PalmListLogic extends BaseGetXController {
//
Future<void> senderQueryingFaceStatus() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -214,7 +214,7 @@ class PalmListLogic extends BaseGetXController {
// ()
Future<void> senderCheckingUserInfoCount() async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState state) async {
if (state == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -246,7 +246,7 @@ class PalmListLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: () {
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);

View File

@ -127,7 +127,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -121,7 +121,7 @@ class PasswordKeyDetailChangeDateLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -128,7 +128,7 @@ class PasswordKeyListLogic extends BaseGetXController {
showBlueConnetctToastTimer(action: (){
dismissEasyLoading();
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);
@ -177,7 +177,7 @@ class PasswordKeyListLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -342,7 +342,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
dismissEasyLoading();
state.sureBtnState.value = 0;
});
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!);

View File

@ -252,6 +252,11 @@ class LockListInfoItemEntity {
data['hasGateway'] = hasGateway;
return data;
}
//
bool isLockOwnerBool(){
return isLockOwner== 1;
}
}
class Bluetooth {

View File

@ -181,7 +181,7 @@ class LockListLogic extends BaseGetXController{
dismissEasyLoading();
showDeletAlertTipDialog();
});
BlueManage().bludSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
BlueManage().blueSendData(state.lockListInfoItemEntity.lockName!, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
List<int> publicKeyData = state.lockListInfoItemEntity.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);

View File

@ -108,7 +108,7 @@ class DebugConsoleController {
return;
}
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey);
@ -179,7 +179,7 @@ class DebugConsoleController {
tokenList = changeStringListToIntList(tokenKey!);
}
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderCleanUpUsersCommand(

View File

@ -54,7 +54,7 @@ class NearbyLockLogic extends BaseGetXController {
dismissEasyLoading();
// state.sureBtnState.value = 0;
});
BlueManage().bludSendData(deviceName,
BlueManage().blueSendData(deviceName,
(BluetoothConnectionState state) async {
AppLog.log("点击要添加的设备了");
if (state == BluetoothConnectionState.connected) {
@ -415,7 +415,7 @@ class NearbyLockLogic extends BaseGetXController {
void oTAUpgrade(String deviceName) {
showTitleEasyLoading("连接设备中...");
this.deviceName = deviceName;
BlueManage().bludSendData(deviceName,
BlueManage().blueSendData(deviceName,
(BluetoothConnectionState state) async {
AppLog.log("连接设备");
if (state == BluetoothConnectionState.connected) {
@ -460,7 +460,7 @@ class NearbyLockLogic extends BaseGetXController {
AppLog.log('blueOTAUpgrade:设备名字为 null');
return;
}
BlueManage().bludSendData(deviceName!,
BlueManage().blueSendData(deviceName!,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
String uid = await Storage.getUid() ?? '';

View File

@ -212,7 +212,7 @@ class SaveLockLogic extends BaseGetXController {
showBlueConnetctToast();
}
});
BlueManage().bludSendData(BlueManage().connectDeviceName,
BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) {
//

View File

@ -94,7 +94,7 @@ class ExpireCardLogic extends BaseGetXController {
dismissEasyLoading();
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){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);

View File

@ -95,7 +95,7 @@ class ExpireFingerprintLogic extends BaseGetXController {
dismissEasyLoading();
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){
// var publicKey = await Storage.getStringList(saveBluePublicKey);
// List<int> publicKeyDataList = changeStringListToIntList(publicKey!);

View File

@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart';
import 'package:star_lock/app_settings/app_settings.dart';
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);
return response;
}

View File

@ -54,8 +54,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.44+2024052002打包给公司测试
# 1.0.45+2024052003打包给公司测试
# 1.0.46+2024052004打包给公司测试
# 1.0.47+2024052101打包给欧阳回归测试
version: 1.0.46+2024052004
version: 1.0.47+2024052101
environment:
sdk: '>=2.12.0 <3.0.0'