Пример #1
0
        public new static MSG_GET_REPORT FromBitArray(ref BitArray bit_array, ref int cursor, int length)
        {
            if (cursor > length) return null;

            int field_len = 0;
            object obj_val;
            ArrayList param_list = new ArrayList();

            MSG_GET_REPORT obj = new MSG_GET_REPORT();

            int msg_type = 0;
            cursor += 6;
            msg_type = (int)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 10);

            if (msg_type != obj.msgType)
            {
                cursor -= 16;
                return null;
            }

            obj.msgLen = (UInt32)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 32);
            obj.msgID = (UInt32)(UInt64)Util.CalculateVal(ref bit_array, ref cursor, 32);


            return obj;
        }
Пример #2
0
        public new static MSG_GET_REPORT FromString(string str)
        {
            string val;

            XmlDocument xdoc = new XmlDocument();
            xdoc.LoadXml(str);
            XmlNode node = (XmlNode)xdoc.DocumentElement;

            MSG_GET_REPORT msg = new MSG_GET_REPORT();
            try { msg.MSG_ID = Convert.ToUInt32(XmlUtil.GetNodeAttrValue(node, "MessageID")); }
            catch { }


            return msg;
        }
Пример #3
0
        public void GET_REPORT(MSG_GET_REPORT msg, out MSG_ERROR_MESSAGE msg_err, int time_out)
        {
            msg_err = null;
            _event_ERROR_MESSAGE = new ClientManualResetEvent(false);

            bool[] bit_array = msg.ToBitArray();
            byte[] data = Util.ConvertBitArrayToByteArray(bit_array);

            cI.Send(data);

            bool wait_result = _event_ERROR_MESSAGE.evt.WaitOne(time_out, false);
            if (wait_result)
            {
                BitArray bArr = Util.ConvertByteArrayToBitArray(_event_ENABLE_EVENTS_AND_REPORTS.data);
                int cursor = 0;
                int length = bArr.Count;
                msg_err = MSG_ERROR_MESSAGE.FromBitArray(ref bArr, ref cursor, length);
                return;
            }
        }