コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public override byte[] ConvertToBytes(object obj)
 {
     int[]  timeControlLine = obj as int[];
     byte[] bs = new byte[TIME_COUNT];
     for (int i = 0; i < TIME_COUNT; i++)
     {
         // TODO: check range
         //
         // 温度范围 -9.9 ~ 10 ℃
         //
         byte t = ByteRealValueConverter.RealValueToByteValue(timeControlLine[i]);
         bs[i] = t;
     }
     return(bs);
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override byte[] ConvertToBytes(object obj)
        {
            byte[] bs = new byte[2 * POINT_COUNT];
            KeyValuePair <int, int>[] values = (KeyValuePair <int, int>[])(obj);
            for (int i = 0; i < POINT_COUNT; i++)
            {
                int index = i * 2;

                bs[index]     = ByteRealValueConverter.RealValueToByteValue(values[i].Key);
                bs[index + 1] = (byte)(values[i].Value);
            }
            // 2010-08-31
            //
            //return base.ConvertToBytes(obj);
            return(bs);
        }