示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bs"></param>
        /// <returns></returns>
        static public XD221ModbusConfigObject Parse(byte[] bs)
        {
            if (bs.Length == 7)
            {
                int begin     = GetModbusWord(bs, 0);
                int wordCount = GetModbusWord(bs, 2);
                int byteCount = bs[4];
                // TODO: wordindex converter
                //
                XD221ConfigDefine ci = XD221ConfigDefineCollection.Find(begin + 1);

                // TODO: ci == null
                //
                IBytesConverter         ibc = BytesConverterManager.CreateBytesConverter(ci.Converter, null);
                object                  obj = ibc.ConvertToObject(bs);
                XD221ModbusConfigObject mpo = new XD221ModbusConfigObject(ci.Name, obj);
                return(mpo);
            }
            return(null);
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public XD221ConfigDefine GetXD221ConfigDefine()
 {
     return(XD221ConfigDefineCollection.Find(this.Name));
 }