getVoiceInfo method

Future<bool> getVoiceInfo(
  1. int voiceType, {
  2. int timeout = 10,
})

获取报警声音 voicetype 0---人脸侦测报警提 示音 1---人形侦测报警提 示音 2---烟感报警提示音 3---移动侦测报警提 示音 4---离岗检测提示音 5---哭声检测提示音 6---在岗监测提示音 7---烟火相机火焰提示音 8---烟火相机烟雾提示音

Implementation

Future<bool> getVoiceInfo(int voiceType, {int timeout = 10}) async {
  String cgi =
      "trans_cmd_string.cgi?cmd=2135&command=1&voicetype=$voiceType&";
  bool ret = await _command.writeCgi(cgi, timeout: timeout);
  if (ret) {
    CommandResult result =
        await _command.waitCommandResult((int cmd, Uint8List data) {
      if (cmd == 24785) {
        String str = utf8.decode(data);
        return str.contains("cmd=2135;") && str.contains("command=1;");
      }
      return false;
    }, timeout);
    if (result.isSuccess == true) {
      Map data = result.getMap();
      print('==>>getVoiceInfo获取到的数据:${data}');
      soundData = data;
      return data["result"] == "0";
    }
  }
  return false;
}