Research Article
ECOPS: Energy-Efficient Collaborative Opportunistic Positioning for Heterogeneous Mobile Devices
Algorithm 3
ECOPS: CollaborativePR().
1: while non-GPS device ∣∣ (GPS-equipped device & ) do | 2: sleep until the device needs to update location information | 3: numofPBs = 0; | 4: check the list of available PBs; | 5: make connection to each PB and request GPS location | information sequentially; | 6: calculate the distance to each PB using the obtained | RSSI value; | 7: set numofPBs to the number of the detected PBs | 8: if numofPBs == 1∣∣ one of PBs is within the near field | threshold ( meters) then | 9: use the received GPS location information immediately | without trilateration; | 10: continue; | 11: end if | 12: if numofPBs == 2 then | 13: calculate two possible locations (PR) and get the | middle location between the two possible locations; | 14: end if | 15: if numofPBs >= 3 then | 16: select three PBs randomly and calculate the its cur- | rent location (PR) with the GPS coordinates and | distance information of the selected PBs; | 17: end if | 18: if GPS-equipped device then | 19: check the residual power (); | 20: end if | 21: end while | 22: execute CollaborativePB(); |
|