public PTPCommunication(PTPDevice dev)
        {
            _device = dev;

            reqres       = new PTPReqRes();
            reqres.data  = new byte[484];
            ptpdata      = new PTPData();
            ptpdata.data = new byte[500];
            p_reqres     = Marshal.AllocHGlobal(Marshal.SizeOf(reqres));
            p_ptpdata    = Marshal.AllocHGlobal(Marshal.SizeOf(ptpdata));

            ResetAll();
        }
        private void ReceiveResponse()
        {
            int       len;
            ErrorCode err;

            ResetParams();

            err = _device.Reader.Read(p_reqres, 0, Marshal.SizeOf(reqres), 5000, out len);

            CheckError(err);

            reqres = (PTPReqRes)Marshal.PtrToStructure(p_reqres, typeof(PTPReqRes));
        }
        public PTPCommunication(PTPDevice dev)
        {
            _device = dev;

            reqres = new PTPReqRes();
            reqres.data = new byte[484];
            ptpdata = new PTPData();
            ptpdata.data = new byte[500];
            p_reqres = Marshal.AllocHGlobal(Marshal.SizeOf(reqres));
            p_ptpdata = Marshal.AllocHGlobal(Marshal.SizeOf(ptpdata));

            ResetAll();
        }
        public PTPCommunication(PTPDevice dev)
        {
            this.device = dev;

            this.reqres = new PTPReqRes();
            this.reqres.data = new byte[484];
            this.ptpdata = new PTPData();
            this.ptpdata.data = new byte[500];
            this.p_reqres = Marshal.AllocHGlobal(Marshal.SizeOf(this.reqres));
            this.p_ptpdata = Marshal.AllocHGlobal(Marshal.SizeOf(this.ptpdata));

            this.ResetAll();
        }
        private void ReceiveResponse()
        {
            int len;
            ErrorCode err;

            ResetParams();

            err = _device.Reader.Read(p_reqres, 0, Marshal.SizeOf(reqres), 5000, out len);

            CheckError(err);

            reqres = (PTPReqRes) Marshal.PtrToStructure(p_reqres, typeof(PTPReqRes));
        }