Example #1
0
 protected virtual void OnPositionChanged(PositionEventArgs e)
 {
     if (e.status == PositionEventArgs.PositionStatus.Valid)
         LastPos = e.position;
     else
         LastPos = null;
     if (PositionChanged != null)
         PositionChanged(this, e);
 }
Example #2
0
 private void RILPositionChanged(object sender, PositionEventArgs pe)
 {
     PositionChanged(sender, pe);
     ril.Enabled = false; // got a location through RIL, stop before we loop again
 }
Example #3
0
 private void PositionChanged(object sender, PositionEventArgs pe)
 {
     if (LocationReady != null)
     {
         if (pe.status == PositionEventArgs.PositionStatus.Valid)
         {
             position = pe.position;
             LocationReady(position, sender== ril ? LocationSource.RIL : LocationSource.GPS);
         }
     }
 }
Example #4
0
        protected void RILPositionThread()
        {
            try
            {
                while (true)
                {
                    GetCellTowerInfo();
                    if (rilCellTowerInfo.dwCellID != 0)
                    {
                        GeoCoord pos = GoogleFindLocationOfCell(rilCellTowerInfo.dwCellID, rilCellTowerInfo.dwMobileCountryCode, rilCellTowerInfo.dwMobileNetworkCode, rilCellTowerInfo.dwLocationAreaCode, rilCellTowerInfo.dwRxLevel, rilCellTowerInfo.dwTimingAdvance);
                        PositionEventArgs pe;
                        if (pos != null)
                            pe = new PositionEventArgs(PositionEventArgs.PositionStatus.Valid, pos, DateTime.UtcNow);
                        else
                            pe = new PositionEventArgs(PositionEventArgs.PositionStatus.Invalid, null, DateTime.UtcNow);
                        OnPositionChanged(pe);
                    }
                    Thread.Sleep(30000);

                }
            }
            catch (ThreadAbortException /*tae*/)
            {
                // thread aborted
            }
        }