xcEditDeviceInfo method

Future<bool> xcEditDeviceInfo({
  1. required String deviceId,
  2. String? userName,
  3. String? nickName,
  4. String? port,
})

编辑设备信息 仅编辑服务器上存储的设备信息的 可以编辑

Implementation

Future<bool> xcEditDeviceInfo(
    {required String deviceId,String? userName, String? nickName, String? port}) async {
  Map rMap = {};
  if (userName == null && nickName == null && port == null) {
    Future.value(true);
  }
  if (deviceId.isNotEmpty) {
    rMap['uuid'] = deviceId;
  }
  if (userName != null) {
    rMap['username'] = userName;
  }
  if (nickName != null) {
    rMap['nickname'] = nickName;
  }
  if (port != null) {
    rMap['port'] = port;
  }
  final jsStr = jsonEncode(rMap);
  final result = await _api.xcEditDeviceInfo(jsStr, ApiSeq.instance.getSeq());
  XCloudResponse response = XCloudResponse.fromOriginResponse(result);
  if (!response.success) {
    return Future.error(XCloudAPIException(code: response.code,commandId: result.commandId));
  }
  return Future.value(response.success);
}