Ejemplo n.º 1
0
        public override byte[] GetData()
        {
            var data = new byte[527];

            data[0]  = (byte)Command;
            data[1]  = 0;
            data[2]  = 0;
            data[3]  = 0;
            data[4]  = (byte)((int)_operation & 0xFF);
            data[5]  = 0;
            data[6]  = 0;
            data[7]  = 0;
            data[8]  = (byte)(_scope & 0xFF);
            data[9]  = 0;
            data[10] = 0;
            data[11] = 0;
            // length
            data[12] = 0;
            data[13] = 0x10;
            data[14] = 0;
            data[15] = 0;

            foreach (var enableLog in _enabledLogIds)
            {
                var ind = (int)enableLog;
                if (ind > 0)
                {
                    var offset = ind - 0x1000;
                    BitsUtils.SetBitAsBool(data, 16, offset, true);
                }
            }
            return(data);
        }
        public override byte[] GetData()
        {
            var maskLength = (MaxMaskBitsCount + 7) / 8;
            var data       = new byte[6 + maskLength];

            data[0] = (byte)Command;
            data[1] = 0;
            data[2] = 0;
            data[3] = 0;
            data[4] = (byte)(MaxMaskBitsCount & 0xFF);
            data[5] = (byte)((MaxMaskBitsCount >> 8) & 0xFF);
            foreach (var enableEvent in _enableEvents)
            {
                BitsUtils.SetBitAsBool(data, 6, (int)enableEvent, true);
            }
            return(data);
        }
Ejemplo n.º 3
0
        private byte[] GetSetMaskData()
        {
            var size       = ((int)_range.Item2 - (int)_range.Item1) / 8 + 16;
            var scopeDelta = _scope * 0x1000;
            var begin      = (int)_range.Item1 < scopeDelta ? _range.Item1 : _range.Item1 - scopeDelta;
            var end        = (int)_range.Item2 < scopeDelta ? _range.Item2 : _range.Item2 - scopeDelta;
            var data       = new byte[size];

            data[0]  = (byte)Command;
            data[1]  = 0;
            data[2]  = 0;
            data[3]  = 0;
            data[4]  = (byte)((int)_operation & 0xFF);
            data[5]  = 0;
            data[6]  = 0;
            data[7]  = 0;
            data[8]  = (byte)(_scope & 0xFF);
            data[9]  = 0;
            data[10] = (byte)((int)begin & 0xFF);
            data[11] = (byte)(((int)begin >> 8) & 0xFF);
            data[12] = (byte)((int)end & 0xFF);
            data[13] = (byte)(((int)end >> 8) & 0xFF);
            data[14] = 0;
            data[15] = 0;

            if (_enabledLogIds.Count > 0)
            {
                for (var id = begin; id <= end; ++id)
                {
                    if (_enabledLogIds.Contains(id + scopeDelta))
                    {
                        BitsUtils.SetBitAsBool(data, 16, (int)id, true);
                    }
                }
            }

            return(data);
        }