Example #1
0
        public override IECGFormat Read(Stream input, int offset, ECGConfig cfg)
        {
            LastError = 0;
            IECGFormat ret = null;

            if ((input != null) &&
                input.CanRead &&
                (_nrleads != -1) &&
                (_nrsamplesperlead != -1))
            {
                RawECGFormat MyFormat = new RawECGFormat();
                MyFormat.setNrLeads(_nrleads);
                MyFormat.setNrOfSamplePerLead(_nrsamplesperlead);
                MyFormat.setLitteEndian(_littleEndian);
                MyFormat.setSampleRate(_samplerate);
                MyFormat.setECGLSBperMV(_ECGLSBperMV);
                MyFormat.setIsADCFormat(_bIsADCFormat);
                MyFormat.setLeadConfiguration(_theLeadConfig);

                if (ret.Config != null)
                {
                    ret.Config.Set(cfg);

                    if (!ret.Config.ConfigurationWorks())
                    {
                        LastError = 3;

                        return(null);
                    }
                }

                ret = (IECGFormat)MyFormat;
                if (ret.CheckFormat(input, offset))
                {
                    LastError = (ret.Read(input, offset) << 2);
                }

                if (!ret.Works())
                {
                    LastError = 2;
                    ret       = null;
                }
            }
            else
            {
                LastError = 1;
            }
            return(ret);
        }
Example #2
0
        public override IECGFormat Read(byte[] buffer, int offset, ECGConfig cfg)
        {
            LastError = 0;
            IECGFormat ret = null;

            if (buffer != null)
            {
                ret = new RawECGFormat();

                if (ret.Config != null)
                {
                    ret.Config.Set(cfg);

                    if (!ret.Config.ConfigurationWorks())
                    {
                        LastError = 3;

                        return(null);
                    }
                }

                if (ret.CheckFormat(buffer, offset))
                {
                    LastError = (ret.Read(buffer, offset) << 2);
                }

                if (!ret.Works())
                {
                    LastError = 2;
                    ret       = null;
                }
            }
            else
            {
                LastError = 1;
            }
            return(ret);
        }