Example #1
0
        private MferChannel ParseChannel(byte[] attrdata)
        {
            var ch  = new MferChannel();
            int idx = 0;

            while (idx < attrdata.Length)
            {
                int cmdbyt = attrdata[idx];
                idx++;
                int lenbyt = attrdata[idx];
                idx++;
                byte[] data = new byte[lenbyt];
                for (int i = 0; i < lenbyt; i++)
                {
                    data[i] = attrdata[idx];
                    idx++;
                }
                switch (cmdbyt)
                {
                case 0x09:          //MWF_LDN
                    System.Diagnostics.Debug.Print("  MWF_LDN:{0}", BitConverter.ToString(data));
                    break;

                case 0x12:          //MWF_NUL
                    System.Diagnostics.Debug.Print("  MWF_NUL:{0}", BitConverter.ToString(data));
                    break;

                case 0x0A:          //MWF_DTP
                    System.Diagnostics.Debug.Print("  MWF_DTP:{0}", data[0]);
                    ch.DataType = data[0];
                    break;

                case 0x0B:          //MWF_IVL
                    if (data[0] != 1 || data[1] != 0xFD)
                    {
                        System.Diagnostics.Debug.Print("  MWF_SEN:NOT msec {0}", BitConverter.ToString(data));
                    }
                    else
                    {
                        int ivl = this.GetInt32_LE(data, 2, data.Length - 2);
                        System.Diagnostics.Debug.Print("  MWF_IVL:{0} msec", ivl);
                        ch.SamplingInterval = ivl;
                    }
                    break;

                case 0x04:          //MWF_BLK
                    int blk = this.GetInt32_LE(data);
                    System.Diagnostics.Debug.Print("  MWF_BLK:{0}", blk);
                    ch.BlockSize = blk;
                    break;

                default:
                    break;
                }
            }
            return(ch);
        }
Example #2
0
 public void AddChannel(int chno, MferChannel ch)
 {
     this.ChannelList.Add(chno, ch);
 }