private bool ExcuteSNWriteCmd(out string error, string sn) { CommandResultReceiver receiver = new CommandResultReceiver(); receiver.TrimLines = true; error = null; bool success; for (int i = 0; i <= 10; i++) { if (isCanceled) { error = null; return(false); } success = true; try { AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress)[0].ExecuteShellCommand("tcmd-subcase.sh update-mrd-sn " + sn, receiver); } catch (Exception) { success = false; Thread.Sleep(1000); } if (success) { break; } } if (receiver.ResultLines != null && receiver.ResultLines.Length > 0) { string result = receiver.ResultLines[receiver.ResultLines.Length - 1]; if (result.Contains("ret")) { if (result.Contains("0")) { return(true); } } return(false); } else { return(false); } }
private string ExcuteBtAddressReadCmd(out string error) { CommandResultReceiver receiver = new CommandResultReceiver(); receiver.TrimLines = true; bool success; for (int i = 0; i <= 10; i++) { if (isCanceled) { error = null; return(null); } success = true; try { AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress)[0].ExecuteShellCommand("tcmd-subcase.sh bt-get-mac", receiver); } catch (Exception) { success = false; Thread.Sleep(1000); } if (success) { break; } } if (receiver.ResultLines != null && receiver.ResultLines.Length > 0) { string result = receiver.ResultLines[receiver.ResultLines.Length - 1]; string bt = null; if (result.Contains("ret")) { if (result.Contains("0")) { bt = receiver.ResultLines[0].Replace(":", "").ToUpper();; } } error = null; return(bt); } else { error = null; return(null); } }
private string ExcuteSNReadCmd(out string error) { CommandResultReceiver receiver = new CommandResultReceiver(); receiver.TrimLines = true; bool success; for (int i = 0; i <= 10; i++) { if (isCanceled) { error = null; return(null); } success = true; try { AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress)[0].ExecuteShellCommand("tcmd-subcase.sh read-mrd-sn", receiver); } catch (Exception) { success = false; Thread.Sleep(1000); } if (success) { break; } } if (receiver.ResultLines != null && receiver.ResultLines.Length > 1) { string result = receiver.ResultLines[receiver.ResultLines.Length - 1]; string sn = null; if (result.Contains("ret")) { if (result.Contains("0")) { sn = receiver.ResultLines[1].Substring(receiver.ResultLines[1].LastIndexOf(',') + 1); } } error = null; return(sn); } else { error = null; return(null); } }
private string ExcuteSWVersionReadCmd(out string error) { CommandResultReceiver receiver = new CommandResultReceiver(); receiver.TrimLines = true; bool success; for (int i = 0; i <= 10; i++) { if (isCanceled) { error = null; return(null); } success = true; try { AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress)[0].ExecuteShellCommand("getprop ro.build.display.id", receiver); } catch (Exception) { success = false; Thread.Sleep(1000); } if (success) { break; } } if (receiver.ResultLines != null && receiver.ResultLines.Length > 0) { string result = receiver.ResultLines[0]; String vesion = result; error = null; return(vesion); } else { error = null; return(null); } }