setDeviceName method

Future<bool> setDeviceName(
  1. String name, {
  2. int timeout = 5,
})
inherited

修改设备名字

Implementation

Future<bool> setDeviceName(String name, {int timeout = 5}) async {
  bool ret = await writeCgi("set_alias.cgi?alias=$name&", timeout: timeout);
  if (ret) {
    CommandResult result = await waitCommandResult((int cmd, Uint8List data) {
      return cmd == 24591;
    }, timeout);
    if (result.isSuccess) {
      Map data = result.getMap();
      return data["result"] == "0";
    }
  }
  return false;
}