-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate sceUsbGps with Android Location API
- Loading branch information
1 parent
393b369
commit 50fb98c
Showing
17 changed files
with
391 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) 2012- PPSSPP Project. | ||
|
||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, version 2.0 or later versions. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License 2.0 for more details. | ||
|
||
// A copy of the GPL 2.0 should have been included with the program. | ||
// If not, see http://www.gnu.org/licenses/ | ||
|
||
// Official git repository and contact information can be found at | ||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. | ||
|
||
#include <time.h> | ||
#include "Core/GPS.h" | ||
|
||
GpsData gpsData; | ||
SatData satData; | ||
|
||
void GPS::init() { | ||
time_t currentTime; | ||
time(¤tTime); | ||
setGpsTime(¤tTime); | ||
|
||
gpsData.hdop = 1.0f; | ||
gpsData.latitude = 51.510357f; | ||
gpsData.longitude = -0.116773f; | ||
gpsData.altitude = 19.0f; | ||
gpsData.speed = 3.0f; | ||
gpsData.bearing = 35.0f; | ||
|
||
satData.satellites_in_view = 6; | ||
for (int i = 0; i < satData.satellites_in_view; i++) { | ||
satData.satInfo[i].id = i + 1; // 1 .. 32 | ||
satData.satInfo[i].elevation = i * 10; | ||
satData.satInfo[i].azimuth = i * 50; | ||
satData.satInfo[i].snr = 0; | ||
satData.satInfo[i].good = 1; | ||
} | ||
} | ||
|
||
void GPS::setGpsTime(time_t *time) { | ||
struct tm *gpsTime; | ||
gpsTime = localtime(time); | ||
|
||
gpsData.year = (short)(gpsTime->tm_year + 1900); | ||
gpsData.month = (short)(gpsTime->tm_mon + 1); | ||
gpsData.date = (short)gpsTime->tm_mday; | ||
gpsData.hour = (short)gpsTime->tm_hour; | ||
gpsData.minute = (short)gpsTime->tm_min; | ||
gpsData.second = (short)gpsTime->tm_sec; | ||
} | ||
|
||
void GPS::setGpsData(float latitude, float longitude, float altitude, float speed, float bearing, long long gpsTime) { | ||
setGpsTime((time_t*)&gpsTime); | ||
|
||
gpsData.latitude = latitude; | ||
gpsData.longitude = longitude; | ||
gpsData.altitude = altitude; | ||
gpsData.speed = speed; | ||
gpsData.bearing = bearing; | ||
} | ||
|
||
GpsData* GPS::getGpsData() { | ||
return &gpsData; | ||
} | ||
|
||
SatData* GPS::getSatData() { | ||
return &satData; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) 2012- PPSSPP Project. | ||
|
||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, version 2.0 or later versions. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License 2.0 for more details. | ||
|
||
// A copy of the GPL 2.0 should have been included with the program. | ||
// If not, see http://www.gnu.org/licenses/ | ||
|
||
// Official git repository and contact information can be found at | ||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. | ||
|
||
#pragma once | ||
|
||
#pragma pack(push) | ||
#pragma pack(1) | ||
|
||
typedef struct { | ||
short year; | ||
short month; | ||
short date; | ||
short hour; | ||
short minute; | ||
short second; | ||
float garbage1; | ||
float hdop; | ||
float garbage2; | ||
float latitude; | ||
float longitude; | ||
float altitude; | ||
float garbage3; | ||
float speed; | ||
float bearing; | ||
} GpsData; | ||
|
||
typedef struct { | ||
unsigned char id; | ||
unsigned char elevation; | ||
short azimuth; | ||
unsigned char snr; | ||
unsigned char good; | ||
short garbage; | ||
} SatInfo; | ||
|
||
typedef struct { | ||
short satellites_in_view; | ||
short garbage; | ||
SatInfo satInfo[24]; | ||
} SatData; | ||
|
||
#pragma pack(pop) | ||
|
||
namespace GPS { | ||
void init(); | ||
void setGpsTime(time_t *time); | ||
void setGpsData(float latitude, float longitude, float altitude, float speed, float bearing, long long time); | ||
GpsData *getGpsData(); | ||
SatData *getSatData(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ | |
#pragma once | ||
|
||
void Register_sceUsbGps(); | ||
|
||
void __UsbGpsInit(); | ||
void __UsbGpsDoState(PointerWrap &p); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.