Beispiel #1
0
        public static int GetFullResponseLength(ResponseCodes response, byte[] buffer, int offset)
        {
            switch (response)
            {
            case ResponseCodes.Setting:
            {
                SettingValue setting = (SettingValue)(buffer[offset] & 0xF);
                return(GetSettingResponseLength(setting));
            }

            case ResponseCodes.Pixels:
            {
                PixelFormat format;
                byte        width;
                byte        height;
                byte        bufferLength;
                int         headerLen = BadgeResponses.DecodePixels(buffer, offset, out format, out width, out height, out bufferLength);
                return(headerLen + bufferLength);
            }

            case ResponseCodes.Memory:
            {
                byte  numDWords;
                short address;
                byte  bufferLength;
                int   headerLen = BadgeResponses.DecodeMemory(buffer, offset, out numDWords, out address, out bufferLength);
                return(headerLen + bufferLength);
            }

            default: return(GetMinResponseLength(response));
            }
        }