优化蓝牙,未完善功能添加弹窗提示
This commit is contained in:
parent
35d35c545d
commit
239466ac09
@ -70,8 +70,8 @@ post_install do |installer|
|
||||
## dart: PermissionGroup.photos
|
||||
# 'PERMISSION_PHOTOS=1',
|
||||
|
||||
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
|
||||
# 'PERMISSION_LOCATION=1',
|
||||
# dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
|
||||
'PERMISSION_LOCATION=1',
|
||||
|
||||
## dart: PermissionGroup.notification
|
||||
# 'PERMISSION_NOTIFICATIONS=1',
|
||||
@ -83,7 +83,7 @@ post_install do |installer|
|
||||
# 'PERMISSION_SENSORS=1',
|
||||
|
||||
## dart: PermissionGroup.bluetooth
|
||||
# 'PERMISSION_BLUETOOTH=1',
|
||||
'PERMISSION_BLUETOOTH=1',
|
||||
|
||||
## dart: PermissionGroup.appTrackingTransparency
|
||||
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
|
||||
|
||||
@ -163,6 +163,6 @@ SPEC CHECKSUMS:
|
||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
||||
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
|
||||
|
||||
PODFILE CHECKSUM: 99f32fc524867f7069762a97e548b5edf4ebf43f
|
||||
PODFILE CHECKSUM: 25020dfb9636b328cc2c56b27dc72344b9af6474
|
||||
|
||||
COCOAPODS: 1.12.1
|
||||
|
||||
@ -32,7 +32,7 @@ class LoginData {
|
||||
String? email;
|
||||
String? nickname;
|
||||
bool? haveSafeAnswer;
|
||||
int? uid;
|
||||
String? uid;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
|
||||
@ -71,7 +71,7 @@ class KeyRecordDataItem {
|
||||
String? recordTypeName;
|
||||
int? success;
|
||||
String? username;
|
||||
String? lockDate;
|
||||
int? lockDate;
|
||||
int? operateDate;
|
||||
String? keyboardPwd;
|
||||
|
||||
|
||||
@ -418,7 +418,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
// ),
|
||||
SizedBox(height: 30.h),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 30.h),
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||
isDelete: true,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
@ -8,6 +9,7 @@ import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_factoryDataReset.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_getLockStatu.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
|
||||
@ -86,17 +88,13 @@ class LockDetailLogic extends BaseGetXController{
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
String? userId = '';
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data != null && data.isNotEmpty) {
|
||||
userId = LoginData.fromJson(jsonDecode(data)).userid.toString();
|
||||
}
|
||||
|
||||
print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: "1",
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
token: tokenData,
|
||||
needAuthor: 1,
|
||||
signKey: signKeyDataList,
|
||||
@ -395,6 +393,10 @@ class LockDetailLogic extends BaseGetXController{
|
||||
|
||||
// 点击开门事件
|
||||
Future<void> openDoorAction() async {
|
||||
if(BlueManage().connectDeviceMacAddress.isEmpty){
|
||||
Toast.show(msg: "正在连接设备,请稍等。");
|
||||
return;
|
||||
}
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState state) async {
|
||||
if (state == DeviceConnectionState.connected){
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
@ -403,13 +405,19 @@ class LockDetailLogic extends BaseGetXController{
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
bool isHave = await Storage.ifHaveKey(saveBlueToken);
|
||||
List<int> getTokenList;
|
||||
if(isHave){
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
getTokenList = changeStringListToIntList(token!);
|
||||
}else{
|
||||
getTokenList = [0,0,0,0];
|
||||
}
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
print("millisecondsSinceEpoch/1000:${DateTime.now().millisecondsSinceEpoch~/1000}");
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: "1",
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
openMode: 1,
|
||||
openTime: DateTime.now().millisecondsSinceEpoch~/1000,
|
||||
@ -523,16 +531,21 @@ class LockDetailLogic extends BaseGetXController{
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
_initReplySubscription();
|
||||
getMicrophonePermission()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
// 有权限
|
||||
startScanAction();
|
||||
}else{
|
||||
//没有权限
|
||||
openAppSettings();//打开app系统设置
|
||||
}
|
||||
});
|
||||
|
||||
if(Platform.isIOS){
|
||||
startScanAction();
|
||||
}else{
|
||||
getMicrophonePermission()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
// 有权限
|
||||
startScanAction();
|
||||
}else{
|
||||
//没有权限
|
||||
openAppSettings();//打开app系统设置
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -10,6 +10,7 @@ import '../../../blue/io_tool/io_manager.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../tools/toast.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import '../../lockMian/entity/lockInfoEntity.dart';
|
||||
import 'lockDetail_logic.dart';
|
||||
@ -63,7 +64,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
Storage.setStringList(saveBlueSignKey, saveSignKeyList);
|
||||
|
||||
// token
|
||||
Storage.setStringList(saveBlueToken, ["0", "0", "0", "0"]);
|
||||
// Storage.setStringList(saveBlueToken, ["0", "0", "0", "0"]);
|
||||
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
|
||||
|
||||
// logic.startScanAction();
|
||||
@ -296,10 +297,11 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
|
||||
// 遥控
|
||||
bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () {
|
||||
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||
"lockId": widget.keyInfo.lockId,
|
||||
"fromType": 2
|
||||
});
|
||||
// Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||
// "lockId": widget.keyInfo.lockId,
|
||||
// "fromType": 2
|
||||
// });
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
];
|
||||
showWidgetArr.addAll(defaultWidgetArr);
|
||||
@ -309,6 +311,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
bottomItem('images/main/icon_face.png', '人脸', () {
|
||||
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
|
||||
// arguments: 1);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
);
|
||||
|
||||
@ -317,6 +320,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
bottomItem('images/main/icon_catEyes.png', '监控', () {
|
||||
// Navigator.pushNamed(context, Routers.otherTypeKeyListPage,
|
||||
// arguments: 1);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@ -30,8 +30,7 @@ class Data {
|
||||
String? lockId;
|
||||
int? operateDate;
|
||||
|
||||
Data(
|
||||
{this.lockId, this.operateDate});
|
||||
Data({this.lockId, this.operateDate});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
lockId = json['lockId'];
|
||||
|
||||
@ -28,9 +28,9 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
if(reply is SenderReferEventRecordNumberReply) {
|
||||
_replyReferEventRecordNumber(reply);
|
||||
}
|
||||
// if(reply is SenderReferEventRecordNumberReply) {
|
||||
// _replyReferEventRecordNumber(reply);
|
||||
// }
|
||||
|
||||
if(reply is SenderReferEventRecordTimeReply) {
|
||||
_replyReferEventRecordTime(reply);
|
||||
@ -39,36 +39,36 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
// 根据数量查解析数据
|
||||
Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
// _getLockStatus();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Future<void> _replyReferEventRecordNumber(Reply reply) async {
|
||||
// int status = reply.data[2];
|
||||
// switch(status){
|
||||
// case 0x00:
|
||||
// //成功
|
||||
// print("${reply.commandType}数据解析成功");
|
||||
// // _getLockStatus();
|
||||
// break;
|
||||
// case 0x06:
|
||||
// //无权限
|
||||
// print("${reply.commandType}需要鉴权");
|
||||
//
|
||||
// break;
|
||||
// case 0x07:
|
||||
// //无权限
|
||||
// print("${reply.commandType}用户无权限");
|
||||
//
|
||||
// break;
|
||||
// case 0x09:
|
||||
// // 权限校验错误
|
||||
// print("${reply.commandType}权限校验错误");
|
||||
//
|
||||
// break;
|
||||
// default:
|
||||
// //失败
|
||||
// print("${reply.commandType}失败");
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 根据时间查解析数据
|
||||
Future<void> _replyReferEventRecordTime(Reply reply) async {
|
||||
@ -98,7 +98,7 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
// indexMap["date"] = DateTool().dateToYMDHNSString("$value");
|
||||
// print("value:${DateTool().dateToYMDHNSString("$value")}");
|
||||
|
||||
indexMap["date"] = value.toString();
|
||||
indexMap["date"] = "${value*1000}";
|
||||
uploadList.add(indexMap);
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
@ -129,31 +129,31 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
// 查询事件记录(页数查询)
|
||||
Future<void> senderReferEventRecordNumber() async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||
if (state == DeviceConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.senderReferEventRecordNumberCommand(
|
||||
keyID:BlueManage().connectDeviceName,
|
||||
userID:await Storage.getUid(),
|
||||
logsCount:20,
|
||||
logsNo:1,
|
||||
token:getTokenList,
|
||||
needAuthor:1,
|
||||
publicKey:getPublicKeyList,
|
||||
privateKey:getPrivateKeyList,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Future<void> senderReferEventRecordNumber() async {
|
||||
// BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||
// if (state == DeviceConnectionState.connected) {
|
||||
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
//
|
||||
// var token = await Storage.getStringList(saveBlueToken);
|
||||
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||
//
|
||||
// var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
// List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
//
|
||||
// IoSenderManage.senderReferEventRecordNumberCommand(
|
||||
// keyID:BlueManage().connectDeviceName,
|
||||
// userID:await Storage.getUid(),
|
||||
// logsCount:20,
|
||||
// logsNo:1,
|
||||
// token:getTokenList,
|
||||
// needAuthor:1,
|
||||
// publicKey:getPublicKeyList,
|
||||
// privateKey:getPrivateKeyList,
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
Future<void> senderReferEventRecordTime(int time) async {
|
||||
@ -187,14 +187,14 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
//请求操作记录列表
|
||||
void mockNetworkDataRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
|
||||
'0',
|
||||
state.keyInfos.value.keyId.toString(),
|
||||
'',
|
||||
"",
|
||||
'0',
|
||||
state.keyInfos.value.lockId.toString(),
|
||||
'1',
|
||||
'1',
|
||||
'20',
|
||||
'0',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
@ -214,7 +214,7 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
LockOperatingRecordGetLastRecordTimeEntity entity =
|
||||
await ApiRepository.to.getLockRecordLastUploadDataTime(lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
senderReferEventRecordTime(entity.data!.operateDate!);
|
||||
senderReferEventRecordTime(entity.data!.operateDate!~/1000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,4 +266,5 @@ class LockOperatingRecordLogic extends BaseGetXController{
|
||||
super.onClose();
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,9 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/jh_pop_menus.dart';
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -71,24 +73,27 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
borderRadius: 20.w,
|
||||
onClick: () {
|
||||
getMicrophonePermission()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
// 有权限
|
||||
Navigator.pushNamed(context, Routers.nearbyLockPage);
|
||||
}else{
|
||||
//没有权限
|
||||
openAppSettings();//打开app系统设置
|
||||
}
|
||||
});
|
||||
|
||||
if(Platform.isIOS){
|
||||
Navigator.pushNamed(context, Routers.nearbyLockPage);
|
||||
}else {
|
||||
getMicrophonePermission()
|
||||
.then((value) {
|
||||
if (value) {
|
||||
// 有权限
|
||||
Navigator.pushNamed(context, Routers.nearbyLockPage);
|
||||
}else{
|
||||
//没有权限
|
||||
openAppSettings();//打开app系统设置
|
||||
}
|
||||
});
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///请求录音相机权限
|
||||
///请求权限
|
||||
Future<bool> getMicrophonePermission() async {
|
||||
// You can request multiple permissions at once.
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:amap_flutter_location/amap_flutter_location.dart';
|
||||
import 'package:amap_flutter_location/amap_location_option.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -50,6 +51,13 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>{
|
||||
|
||||
AMapFlutterLocation.setApiKey("11d49b3f4fc09c04a02bbb7500925ba2", "883a3355d2d77c2fdc2667030dc97ffe");
|
||||
|
||||
EasyLoading.show();
|
||||
Future.delayed(const Duration(seconds: 10), () { //asynchronous delay
|
||||
print("10s之后 菊花没有隐藏的话,强制隐藏菊花");
|
||||
if(EasyLoading.isShow){
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
});
|
||||
requestLocation();
|
||||
}
|
||||
|
||||
@ -78,6 +86,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>{
|
||||
Future<void> requestLocation() async {
|
||||
location.onLocationChanged().listen((event) {
|
||||
print("listenLocationChanged$event");
|
||||
EasyLoading.dismiss();
|
||||
if (event.isNotEmpty) {
|
||||
setState(() {
|
||||
addressInfo = event;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -249,29 +250,29 @@ class SaveLockLogic extends BaseGetXController {
|
||||
// 有效时间
|
||||
var indate = reply.data.sublist(149, 153);
|
||||
int indateValue = ((0xff & restoreDate[(0)]) << 24 | (0xff & restoreDate[1]) << 16 | (0xff & restoreDate[2]) << 8 | (0xFF & restoreDate[3]));
|
||||
String indateStr = DateTool().dateToYMDHNSString(indateValue.toString());
|
||||
String indateStr = DateTool().dateToYMDHNSString("$indateValue");
|
||||
print("indate:$indate indateStr:$indateStr");
|
||||
|
||||
var index = 153;
|
||||
// 锁特征值字符串长度
|
||||
var featureValueLength = reply.data[153];
|
||||
// 锁特征值说明(本机能支持的功能)
|
||||
// 获取到锁给的字符数组
|
||||
var featureValue = reply.data.sublist(index+1, index + featureValueLength+1);
|
||||
List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
||||
// print("featureValueLength:$featureValueLength featureValue:$featureValue \n allFeatureValueTwoList:$allFeatureValueTwoList");
|
||||
index = index + featureValueLength + 1;
|
||||
// var index = 153;
|
||||
// // 锁特征值字符串长度
|
||||
// var featureValueLength = reply.data[153];
|
||||
// // 锁特征值说明(本机能支持的功能)
|
||||
// // 获取到锁给的字符数组
|
||||
// var featureValue = reply.data.sublist(index+1, index + featureValueLength+1);
|
||||
// List allFeatureValueTwoList = charListChangeIntList(featureValue);
|
||||
// // print("featureValueLength:$featureValueLength featureValue:$featureValue \n allFeatureValueTwoList:$allFeatureValueTwoList");
|
||||
// index = index + featureValueLength + 1;
|
||||
|
||||
// 使能特征值字符串长度
|
||||
var featureEnValLength = reply.data[index];
|
||||
// 使能锁特征值说明(本机启用的功能)
|
||||
var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1);
|
||||
List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
||||
// print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n allFeatureEnValTwoList:$allFeatureEnValTwoList");
|
||||
index = index + featureEnValLength + 1;
|
||||
// // 使能特征值字符串长度
|
||||
// var featureEnValLength = reply.data[index];
|
||||
// // 使能锁特征值说明(本机启用的功能)
|
||||
// var featureEnVal = reply.data.sublist(index+1, index + featureEnValLength+1);
|
||||
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
|
||||
// // print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n allFeatureEnValTwoList:$allFeatureEnValTwoList");
|
||||
// index = index + featureEnValLength + 1;
|
||||
|
||||
// 支持的带参数特征值的总条目数
|
||||
var featureParaTotal = reply.data[index];
|
||||
// // 支持的带参数特征值的总条目数
|
||||
// var featureParaTotal = reply.data[index];
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
@ -357,7 +358,7 @@ class SaveLockLogic extends BaseGetXController {
|
||||
void bindBlueAdmin() async{
|
||||
var lockDataMap = {};
|
||||
lockDataMap['lockName'] = BlueManage().connectDeviceName;
|
||||
lockDataMap['lockMac'] = BlueManage().connectDeviceMacAddress;
|
||||
lockDataMap['lockMac'] = getRandomNumber();
|
||||
// lockDataMap['lockMac'] = BlueManage().connectDeviceMacAddress;
|
||||
|
||||
var positionMap = {};
|
||||
@ -407,6 +408,17 @@ class SaveLockLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
String getRandomNumber(){
|
||||
String str = "";
|
||||
for(int i = 0; i<6; i++){
|
||||
var a = Random().nextInt(99);
|
||||
str = "$str$a:";
|
||||
}
|
||||
String result = str.substring(0, str.length - 1);
|
||||
print("result:$result");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 获取锁状态
|
||||
Future<void> _getLockStatus() async {
|
||||
print("connectDeviceMacAddress:${BlueManage().connectDeviceMacAddress} connectDeviceName:${BlueManage().connectDeviceName}");
|
||||
|
||||
@ -7,6 +7,7 @@ import '../../../app_settings/app_colors.dart';
|
||||
import '../../../baseWidget.dart';
|
||||
// import '../../../tools/store_service.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../tools/toast.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
|
||||
class SeletLockTypePage extends StatefulWidget {
|
||||
@ -43,24 +44,29 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_NFCLock.png',
|
||||
TranslationLoader.lanKeys!.NFCPassiveLock!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_padlock.png',
|
||||
TranslationLoader.lanKeys!.padlock!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_safeLock.png',
|
||||
TranslationLoader.lanKeys!.safeLock!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_parkingLock.png',
|
||||
TranslationLoader.lanKeys!.parkingLock!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_entranceGuardLock.png',
|
||||
TranslationLoader.lanKeys!.itelligentAccessControl!.tr,
|
||||
() {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
|
||||
// lockTypeItem('images/lockType/lockType_bicycleLock.png',
|
||||
@ -69,7 +75,8 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
|
||||
// }),
|
||||
lockTypeItem('images/lockType/lockType_gatewayLock.png',
|
||||
TranslationLoader.lanKeys!.gateway!.tr, () {
|
||||
Navigator.pushNamed(context, Routers.gatewayListPage);
|
||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -82,7 +89,9 @@ class _SeletLockTypePageState extends State<SeletLockTypePage> with BaseWidget {
|
||||
|
||||
Widget allLock() {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.addLockPage);
|
||||
},
|
||||
child: Container(
|
||||
height: 150.h,
|
||||
color: Colors.white,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
abstract class Api {
|
||||
final String baseUrl = "https://pre.lock.star-lock.cn:8093/api"; //曾工本地
|
||||
// final String baseUrl = "http://test.lock.star-lock.cn/api"; // 葛工
|
||||
// final String baseUrl = "https://lock.star-lock.cn/api"; // 测试环境
|
||||
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //曾工
|
||||
final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地
|
||||
// final String baseUrl = "http://192.168.56.101:8099/api"; //曾工本地
|
||||
// final String baseUrl = "http://192.168.1.14:8099/api"; //葛工开发环境地址
|
||||
final String baseWebURL = 'http://192.168.56.101:8099'; //关于网页网址前缀
|
||||
|
||||
|
||||
@ -107,6 +107,14 @@ class Storage {
|
||||
return sp.getStringList(key);
|
||||
}
|
||||
|
||||
// 判断本地是否包含某个key
|
||||
static Future<bool> ifHaveKey(key) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
bool isContainKey = sp.containsKey(key) ?? false;
|
||||
print(isContainKey);
|
||||
return isContainKey;
|
||||
}
|
||||
|
||||
// 移除数据
|
||||
static Future<void> removeData(key) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user