示例#1
0
        public CodeineMessageIPs(byte subType, PackedDeviceInformations pdi)
        {
            if (pdi == null)
                throw new ArgumentException("PackedDeviceInformations must not be null");

            if (subType == (byte)_t_MSGSUBTYPE.kMSGSetIPs)
            {
                this.msgType = _t_CDMSG.kMSGIPs;
                this.subType = subType;
                this.pdi = pdi;
            }
            else
                throw new ArgumentException("Can only call this constructor with type _t_MSGSET.kMSGSetIPs");
        }
示例#2
0
        public CodeineMessageIPs(byte[] data)
            : base(data)
        {
            if (this.msgType != _t_CDMSG.kMSGIPs)
                throw new ArgumentException("Data does not represent a CodeineMessageIPs");
            if (this.subType == (byte)_t_MSGSUBTYPE.kMSGGetIPs)
            {
                this.pdi = null;
            }
            if (this.subType == (byte)_t_MSGSUBTYPE.kMSGSetIPs)
            {
                byte[] bytes = new byte[data.Length - 2];

                Array.Copy(data, 2, bytes, 0, data.Length - 2);

                this.pdi = new PackedDeviceInformations(bytes);
            }
        }