public virtual MtpResponse Execute(ushort code, DataPhase dataPhase, uint[] param, byte[] data = null, bool noReadResponseParam = false) { if (param == null) { param = new uint[5]; } sem.WaitOne(); MtpResponse res; try { if (IsOpened()) { res = MtpOperation.ExecuteCommand(device, code, dataPhase, param, data, noReadResponseParam); } else { Debug.WriteLine("[WpdCommand.Execute] device is null."); res = new MtpResponse((ushort)MtpResponseCode.Error, param, data); } } catch (COMException e) { Debug.WriteLine("[WpdCommand.Execute] COM Error occured. ErrorCode: 0x" + e.ErrorCode.ToString("x")); res = new MtpResponse((ushort)MtpResponseCode.Error, param, data); } finally { sem.Release(); } return(res); }
/// <summary> /// MTPオペレーションを実行する /// </summary> /// <param name="code"></param> /// <param name="param"></param> /// <returns></returns> public MtpResponse Execute(ushort code, DataPhase dataPhase, uint[] param, byte[] data = null) { if (param == null) { param = new uint[5]; } sem.WaitOne(); MtpResponse res; try { res = MtpOperation.ExecuteCommand(device, code, dataPhase, param, data); } catch (COMException e) { Debug.WriteLine("[WpdCommand.Execute] COM Error occured. ErrorCode: 0x" + e.ErrorCode.ToString("x")); res = new MtpResponse((ushort)MtpResponseCode.Error, param, data); } sem.Release(); return(res); }