add method

  1. @override
Future<DeviceUser> add({
  1. required String? deviceId,
  2. String? deviceName,
  3. String? wifiName,
  4. String? wifiPassword,
})
override

添加设备方法

deviceName 给设备命名

deviceId 需要添加设备的设备ID

wifiName wifi 名称

wifiPassword wifi 密码

call 添加的回调

Implementation

@override
Future<DeviceUser> add(
    {required String? deviceId,
    String? deviceName,
    String? wifiName,
    String? wifiPassword}) {
  return _channel.invokeMethod("add", {
    "deviceName": deviceName,
    "deviceId": deviceId,
    "wifiName": wifiName,
    "wifiPassword": wifiPassword
  }).then((value) {
    Map<String, dynamic> map = json.decode(value);
    return DeviceUser.fromJson(map);
    // return DeviceUser(
    //   deviceName: map["deviceName"],
    //   userUuid: map["userUuid"],
    //   freeze: map["freeze"],
    //   authType: map["authType"],
    //   startDate: map["startDate"],
    //   endDate: map["endDate"],
    //   grade: map["grade"],
    //   sender: map["sender"],
    //   sort: map["sort"],
    //   device: Device(
    //     mac: map["device"]["mac"],
    //     years: map["device"]["years"],
    //     model: map["device"]["model"],
    //     softwareCode: map["device"]["softwareCode"],
    //     battery: map["device"]["battery"],
    //     deviceId: map["device"]["deviceId"],
    //     volume: map["device"]["volume"],
    //     deviceName: map["device"]["deviceName"],
    //     statusCode: map["device"]["statusCode"],
    //     rssi: map["device"]["rssi"],
    //     version: map["device"]["version"],
    //     createdTime: map["device"]["createdTime"],
    //     onLine: map["device"]["onLine"],
    //     deviceKey: map["device"]["deviceKey"],
    //   ),
    // );
  });
}