Exemple #1
0
        public void SetValue(TBody gpsbody)
        {
            var tmpbytes = gpsbody.GetASCIIBytes(gpsbody.GetIssi());

            this.Issi = new Byte[33];
            for (var i = 0; i < 33; i++)
            {
                if (i < tmpbytes.Length)
                {
                    this.Issi[i] = tmpbytes[i];
                }
                else
                {
                    this.Issi[i] = 0;
                }
            }
            ///取小数点后5位
            this.Lon         = Convert.ToDouble(String.Format("{0:N5}", gpsbody.lon));
            this.Lat         = Convert.ToDouble(String.Format("{0:N5}", gpsbody.lat));
            this.Hight       = gpsbody.height;
            this.Speed       = gpsbody.speed;
            this.Dir         = gpsbody.dir;
            this.Year        = IPAddress.HostToNetworkOrder(Convert.ToInt16(DateTime.Now.Year));
            this.Month       = Convert.ToByte(DateTime.Now.Month);
            this.Day         = Convert.ToByte(DateTime.Now.Day);
            this.Hour        = Convert.ToByte(DateTime.Now.Hour);
            this.Minute      = Convert.ToByte(DateTime.Now.Minute);
            this.Second      = Convert.ToByte(DateTime.Now.Second);
            this.Cdatalength = IPAddress.HostToNetworkOrder(Convert.ToInt16(12));
            this.Cdata       = gpsbody.GetASCIIBytes("hello world!");
        }
        public void SetValue(TBody body)
        {
            var issi = body.GetASCIIBytes(body.GetIssi());

            ID = Enumerable.Repeat <Byte>(0x00, 38).ToArray();
            Array.Copy(issi, ID, issi.Length);
            Lon   = body.lon;
            Lat   = body.lat;
            Heigh = body.height;
            Dir   = body.dir;
            Speed = body.speed;
        }
Exemple #3
0
        public void SetValue(TBody body)
        {
            Issi = Enumerable.Repeat <Byte>(0x25, 20).ToArray();
            var bodyssi = body.GetASCIIBytes(body.GetIssi());

            Array.Copy(bodyssi, Issi, bodyssi.Length);
            //var bodyssi = body.GetASCIIBytes(body.GetIssi());
            //Issi = new Byte[20];
            //for (var i = 0; i < bodyssi.Length; i++)
            //{
            //    Issi[i] = bodyssi[i];
            //}
            //for (var i = bodyssi.Length; i <20 ; i++)
            //{
            //    Issi[i] = 0x25;
            //}
            CC    = 0x26;
            Time  = body.GetASCIIBytes(new DateTime(1899, 12, 30).AddDays(body.time).ToString("yyMMddHHmmss"));
            Lon   = body.lon;
            Lat   = body.lat;
            Speed = Convert.ToDouble(body.speed);
            Dir   = IPAddress.HostToNetworkOrder(body.dir);
        }