コード例 #1
0
        public GPSData ModifyLaLon(ref GPSData data, double lonOffset, double latOffset)
        {
            GPSData temp = data;

            temp.lon = temp.lon + lonOffset;
            temp.lat = temp.lat + latOffset;
            return(temp);
        }
コード例 #2
0
ファイル: Plugin.cs プロジェクト: linqiang69672187/GPSTRAN
        private byte[] PacketForNeiMeng(GPSData temp)
        {
            neimengTBody.lat = temp.lat;
            neimengTBody.lon = temp.lon;

            neimengTBody.speed = (ushort)System.Net.IPAddress.HostToNetworkOrder(temp.speed);

            neimengTBody.height    = (ushort)System.Net.IPAddress.HostToNetworkOrder(temp.height);
            neimengTBody.precision = 0;



            neimengTBody.dir = (ushort)System.Net.IPAddress.HostToNetworkOrder(temp.dir);
            neimengTBody.id  = new char[20];
            now = DateTime.Now;

            neimengTBody.year   = (ushort)System.Net.IPAddress.HostToNetworkOrder(Convert.ToInt16(now.Year));
            neimengTBody.month  = Convert.ToByte(now.Month);
            neimengTBody.day    = Convert.ToByte(now.Day);
            neimengTBody.hour   = Convert.ToByte(now.Hour);
            neimengTBody.minute = Convert.ToByte(now.Minute);
            neimengTBody.second = Convert.ToByte(now.Second);

            int leng = temp.id.Length;

            for (int i = 0; i < 20; i++)
            {
                if (i < leng)
                {
                    neimengTBody.id[i] = temp.id.ElementAt <char>(i);
                }
                else
                {
                    neimengTBody.id[i] = '\0';
                }
            }
            byte[] result  = null;
            string content = "";

            neimengGPS.neimengTHead = neimengTHead;
            neimengGPS.neimengTBody = neimengTBody;
            result = neimengpro.GetByte(neimengGPS);
            for (int i = 0; i < result.Length; i++)
            {
                content = content + result[i] + "\r\n";
            }

            return(result);
        }
コード例 #3
0
        //cloen a GPSData
        public GPSData GPSDataClone(GPSData data)
        {
            GPSData temp = new GPSData();

            temp.id       = data.id;
            temp.lat      = data.lat;
            temp.lon      = data.lon;
            temp.speed    = data.speed;
            temp.dir      = data.dir;
            temp.state    = data.state;
            temp.nMsgtype = data.nMsgtype;
            temp.time     = data.time;
            temp.height   = data.height;
            return(temp);
        }
コード例 #4
0
        //convert to type of GPSData from TBody
        public GPSData ToGPSData(TBody body)
        {
            GPSData data = new GPSData();

            data.id       = GetIssi(body);
            data.lat      = body.lat;
            data.lon      = body.lon;
            data.speed    = body.speed;
            data.dir      = body.dir;
            data.state    = body.state;
            data.nMsgtype = body.nMsgtype;
            data.time     = Convert.ToString(body.time);
            data.height   = body.height;

            return(data);
        }
コード例 #5
0
 //get issi from GPSData object
 public string GetIssi(GPSData data)
 {
     return(data.id);
 }