public void Serialize(ByteArrayBuilder cmd)
        {
            cmd.AddUInt16((int)Id);
            cmd.AddString(20, LongName);
            cmd.AddString(4, ShortName);
            cmd.AddByte(0x00);                             // Xa
            cmd.Pad();                                     // ??
            cmd.AddByte((byte)(IsExternal ? 0x00 : 0x01)); // Xb

            if (ExternalPorts == null)
            {
                cmd.AddBoolArray(false); // Is an external type, so no port options
            }
            else
            {
                cmd.AddBoolArray(ExternalPorts.Contains(ExternalPortType.SDI),
                                 ExternalPorts.Contains(ExternalPortType.HDMI),
                                 ExternalPorts.Contains(ExternalPortType.Component),
                                 ExternalPorts.Contains(ExternalPortType.Composite),
                                 ExternalPorts.Contains(ExternalPortType.SVideo));
            }

            cmd.AddByte((byte)(IsExternal ? 0x00 : 0x01)); // Xd
            cmd.AddUInt8((int)ExternalPortType);           // Xe
            cmd.AddUInt8((int)InternalPortType);
            cmd.Pad();                                     //Xg ??
            cmd.AddUInt8((uint)SourceAvailability);        // Xh
            cmd.AddUInt8((uint)MeAvailability);            // Xi
        }
 public void Serialize(ByteArrayBuilder cmd)
 {
     cmd.AddString(32, Name);
     // TODO figure out what this is. It might mean something, or nothing. By blanking out after the name seems to cause the client to lose input names on the buttons
     cmd.AddByte(0x28, 0x36, 0x9B, 0x60, 0x4C, 0x08, 0x11, 0x60);
     cmd.AddUInt8((uint)Model);
     cmd.AddByte(0x3D, 0xA4, 0x60);
 }
Example #3
0
        public void Serialize(ByteArrayBuilder cmd)
        {
            cmd.AddUInt16((int)Id);
            cmd.AddString(20, LongName);
            cmd.AddString(4, ShortName);
            cmd.AddByte(0x00);                             // Xa
            cmd.Pad();                                     // ??
            cmd.AddByte((byte)(IsExternal ? 0x00 : 0x01)); // Xb

            cmd.AddUInt8((uint)AvailableExternalPorts);

            cmd.AddByte((byte)(IsExternal ? 0x00 : 0x01)); // Xd
            cmd.AddUInt8((int)ExternalPortType);           // Xe
            cmd.AddUInt8((int)InternalPortType);
            cmd.Pad();                                     //Xg ??
            cmd.AddUInt8((uint)SourceAvailability);        // Xh
            cmd.AddUInt8((uint)MeAvailability);            // Xi
        }
Example #4
0
        public void Serialize(ByteArrayBuilder cmd)
        {
            cmd.AddUInt8((uint)Input);
            cmd.AddUInt8(Category);
            cmd.AddUInt8(Parameter);
            SerializeType(cmd);

            switch (Type)
            {
            case CameraControlDataType.Bool:
            {
                bool[] data = BoolData ?? Array.Empty <bool>();
                cmd.AddUInt16(data.Length);
                cmd.Pad(6);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (bool val in data)
                {
                    cmd.AddBoolArray(val);
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            case CameraControlDataType.SInt8:
            {
                int[] data = IntData ?? Array.Empty <int>();
                cmd.AddUInt16(data.Length);
                cmd.Pad(6);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (int val in data)
                {
                    cmd.AddInt8(val);
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            case CameraControlDataType.SInt16:
            {
                int[] data = IntData ?? Array.Empty <int>();
                cmd.Pad(2);
                cmd.AddUInt16(data.Length);
                cmd.Pad(4);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (int val in data)
                {
                    cmd.AddInt16(val);
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            case CameraControlDataType.SInt32:
            {
                int[] data = IntData ?? Array.Empty <int>();
                cmd.Pad(4);
                cmd.AddUInt16(data.Length);
                cmd.Pad(2);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (int val in data)
                {
                    cmd.AddInt32(val);
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            case CameraControlDataType.SInt64:
            {
                long[] data = LongData ?? Array.Empty <long>();
                cmd.Pad(6);
                cmd.AddUInt16(data.Length);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (long val in data)
                {
                    cmd.AddInt64(val);
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            case CameraControlDataType.String:
            {
                string str = StringData ?? string.Empty;
                cmd.AddUInt16(str.Length);
                cmd.Pad(6);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                cmd.AddString(str);
                cmd.PadToNearestMultipleOf8();
                break;
            }

            case CameraControlDataType.Float:
            {
                double[] data = FloatData ?? Array.Empty <double>();
                cmd.Pad(2);
                cmd.AddUInt16(data.Length);
                cmd.Pad(4);

                SerializePostLength(cmd);
                cmd.PadToNearestMultipleOf8();

                foreach (double val in data)
                {
                    cmd.AddInt16(0x7ff, val);     // TODO
                }
                cmd.PadToNearestMultipleOf8();

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }