Exemplo n.º 1
0
        public static int DecodeRTCStatus(System.IO.Stream buffer, out UInt16 CycleCounter, out DataStatus DataStatus, out TransferStatus TransferStatus)
        {
            int  ret = 0;
            byte tmp;

            ret           += DCP.DecodeU16(buffer, out CycleCounter);
            ret           += DCP.DecodeU8(buffer, out tmp);
            DataStatus     = (DataStatus)tmp;
            ret           += DCP.DecodeU8(buffer, out tmp);
            TransferStatus = (TransferStatus)tmp;

            return(ret);
        }
Exemplo n.º 2
0
        public static int DecodeHeader(System.IO.Stream buffer, out PacketTypes type, out Flags1 flags1, out Flags2 flags2, out Encodings encoding, out UInt16 serial_high_low, out Guid object_id, out Guid interface_id, out Guid activity_id, out UInt32 server_boot_time, out UInt32 sequence_no, out Operations op, out UInt16 body_length, out UInt16 fragment_no)
        {
            int    ret = 0;
            byte   tmp1;
            UInt16 tmp2;
            UInt32 tmp3;

            serial_high_low = 0;

            ret += DCP.DecodeU8(buffer, out tmp1);             //RPCVersion
            if (tmp1 != 4)
            {
                throw new Exception("Wrong protocol");
            }
            ret             += DCP.DecodeU8(buffer, out tmp1);
            type             = (PacketTypes)tmp1;
            ret             += DCP.DecodeU8(buffer, out tmp1);
            flags1           = (Flags1)tmp1;
            ret             += DCP.DecodeU8(buffer, out tmp1);
            flags2           = (Flags2)tmp1;
            ret             += DCP.DecodeU16(buffer, out tmp2);
            encoding         = (Encodings)tmp2;
            ret             += DCP.DecodeU8(buffer, out tmp1); //pad
            ret             += DCP.DecodeU8(buffer, out tmp1);
            serial_high_low |= (UInt16)(tmp1 << 8);
            ret             += DecodeGuid(buffer, encoding, out object_id);
            ret             += DecodeGuid(buffer, encoding, out interface_id);
            ret             += DecodeGuid(buffer, encoding, out activity_id);
            ret             += DecodeU32(buffer, encoding, out server_boot_time);
            ret             += DecodeU32(buffer, encoding, out tmp3);   //interface version
            if ((tmp3 & 0xFFFF) != 1)
            {
                throw new Exception("Wrong protocol version");
            }
            ret             += DecodeU32(buffer, encoding, out sequence_no);
            ret             += DecodeU16(buffer, encoding, out tmp2);
            op               = (Operations)tmp2;
            ret             += DecodeU16(buffer, encoding, out tmp2);     //interface hint
            ret             += DecodeU16(buffer, encoding, out tmp2);     //activity hint
            ret             += DecodeU16(buffer, encoding, out body_length);
            ret             += DecodeU16(buffer, encoding, out fragment_no);
            ret             += DCP.DecodeU8(buffer, out tmp1); //authentication protocol
            ret             += DCP.DecodeU8(buffer, out tmp1);
            serial_high_low |= tmp1;

            return(ret);
        }
Exemplo n.º 3
0
        public static int DecodeRTAHeader(System.IO.Stream buffer, out UInt16 AlarmDestinationEndpoint, out UInt16 AlarmSourceEndpoint, out PDUTypes PDUType, out AddFlags AddFlags, out UInt16 SendSeqNum, out UInt16 AckSeqNum, out UInt16 VarPartLen)
        {
            int  ret = 0;
            byte tmp;

            ret     += DCP.DecodeU16(buffer, out AlarmDestinationEndpoint);
            ret     += DCP.DecodeU16(buffer, out AlarmSourceEndpoint);
            ret     += DCP.DecodeU8(buffer, out tmp);
            PDUType  = (PDUTypes)tmp;
            ret     += DCP.DecodeU8(buffer, out tmp);
            AddFlags = (AddFlags)tmp;
            ret     += DCP.DecodeU16(buffer, out SendSeqNum);
            ret     += DCP.DecodeU16(buffer, out AckSeqNum);
            ret     += DCP.DecodeU16(buffer, out VarPartLen);

            return(ret);
        }