Exemplo n.º 1
0
 public IPtpIpCommand Read(StillImageDevice.TransferCallback callback=null)
 {
     var header = new PtpIpHeader();
     header.Read(_inerStream);
     switch ((PtpIpContainerType) header.Type)
     {
         case PtpIpContainerType.Init_Command_Request:
             break;
         case PtpIpContainerType.Init_Command_Ack:
             var initcommand = new InitCommandAck() {Header = header};
             initcommand.Read(_inerStream);
             return initcommand;
         case PtpIpContainerType.Init_Event_Request:
             break;
         case PtpIpContainerType.Init_Event_Ack:
             break;
         case PtpIpContainerType.Init_Fail:
             break;
         case PtpIpContainerType.Cmd_Request:
             break;
         case PtpIpContainerType.Cmd_Response:
             var cmdresp = new CmdResponse() {Header = header};
             cmdresp.Read(_inerStream);
             return cmdresp;
         case PtpIpContainerType.Event:
             break;
         case PtpIpContainerType.Start_Data_Packet:
             var stardatares = new StartDataPacket() {Header = header};
             stardatares.Read(_inerStream);
             return stardatares;
         case PtpIpContainerType.Data_Packet:
             var data = new DataPacket() {Header = header};
             data.Read(_inerStream);
             return data;
         case PtpIpContainerType.Cancel_Transaction:
             break;
         case PtpIpContainerType.End_Data_Packet:
             var enddata = new EndDataPacket() {Header = header};
             enddata.Read(_inerStream, callback);
             return enddata;
         case PtpIpContainerType.Ping:
             break;
         case PtpIpContainerType.Pong:
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     return null;
 }