getDeviceSoftwareFunction method
获得设备软件的支持信息
Implementation
Future<DeviceSoftwareInfo?> getDeviceSoftwareFunction(String deviceId) async {
String info = await methodChannel
.invokeMethod("getDeviceSoftwareFunction", {"deviceId": deviceId});
if (info == "") return Future.value();
var decode = convert.json.decode(info);
return Future.value(DeviceSoftwareInfo(
deviceType: decode["deviceType"],
passwordSum: decode["passwordSum"],
//先吧枚举类型转成集合由于转换的集合不支持修改,所以把转换好的集合添加代新集合然后在刷选出包含枚举每次的数据,下面的几个类型都是这么实现的
passwordType: [...PasswordType.values]..retainWhere(
(element) => decode["passwordType"].contains((element).name)),
cardSum: decode["cardSum"],
cardType: [...CardType.values]
..retainWhere((element) => decode["cardType"].contains((element).name)),
markSum: decode["markSum"],
markType: [...MarkType.values]
..retainWhere((element) => decode["markType"].contains((element).name)),
faceSum: decode["faceSum"],
faceType: [...FaceType.values]
..retainWhere((element) => decode["faceType"].contains((element).name)),
modelType: [
...DeviceModel.values
]..retainWhere((element) => decode["modelType"].contains((element).name)),
connectionNumber: decode["connectionNumber"],
otherFunction: [...DeviceOtherFunction.values]..retainWhere(
(element) => decode["otherFunction"].contains((element).name)),
));
}