public MTPDataResponse ExecuteReadBigData(uint code,Stream stream, StillImageDevice.TransferCallback callback, params uint[] parameters) { lock (_locker) { var cmd = new CmdRequest(code) { Parameters = parameters }; _client.Write(cmd); var res1 = _client.Read(); var response = res1 as CmdResponse; if (response != null) { return new MTPDataResponse() { ErrorCode = (uint)response.Code }; } var response1 = res1 as StartDataPacket; var res2 = _client.Read(callback); var res3 = (EndDataPacket)res2; var res4 = _client.Read(); return new MTPDataResponse() { Data = res3.Data }; } }
public uint ExecuteWriteData(uint code, byte[] data, params uint[] parameters) { //6-> //9-> //7<- lock (_locker) { var cmd = new CmdRequest(code,2) {Parameters = parameters}; _client.Write(cmd); _client.Write(new StartDataPacket() {Data = data, TransactionID = cmd.TransactionID}); var res1 = _client.Read(); var response = res1 as CmdResponse; if (response != null) { return (uint) response.Code; } } return 0; }