Example #1
0
        private bool ParseJsonInner(string json, float offsetX, float offsetY)
        {
            PositionJson p = JsonConvert.DeserializeObject <PositionJson>(json);

            Code = p.tag_id;
            X    = p.x.ToFloat() * AppSetting.PositionPower;
            Y    = p.z.ToFloat() * AppSetting.PositionPower;
            Z    = p.y.ToFloat() * AppSetting.PositionPower;

            //Y = p.y.ToFloat() * 10;
            //Z = p.z.ToFloat() * 10;
            X += offsetX;
            Z += offsetY;

            DateTimeStamp = p.timestamp.ToLong();
            DateTime      = DateTimeStamp.ToDateTime();
            Number        = p.sn.ToInt();
            Power         = (int)(p.bettery.ToFloat() * 100);
            EventType     = 0;
            if (p.events != null && p.events.Count() > 0)
            {
                for (int i = 0; i < p.events.Count(); i++)
                {
                    string strEventType = p.events[i].event_type;
                    if (strEventType == "SOS")
                    {
                        EventType = 1;
                    }
                }
            }
            return(true);
        }
Example #2
0
        //public string DateTime_Date;
        //public string DateTime_Hour;

        //public int Year;
        //public int Month;
        //public int Day;
        //public int Hour;

        public void ParseTimeStamp()
        {
            DateTime = DateTimeStamp.ToDateTime();
            ////DateTime_Date = DateTime.ToString("yyyy-MM-dd");
            ////DateTime_Hour = DateTime.ToString("yyyy-MM-dd HH");

            //Year = DateTime.Year;
            //Month = DateTime.Year;
            //Day = DateTime.Year;
            //Hour = DateTime.Year;
        }
Example #3
0
 public override string ToString()
 => $"{DateTimeStamp.ToDateTime():G} {EventTypeCase}";