void show_geolocation(struct shttpd_arg *arg) {
	char location[256];

	CGPSController* gps = CGPSController::Instance();
	gps->TurnGpsOn();

	gps->UpdateTimeout();
	if (gps->IsKnownPosition()) {
		double latitude = gps->GetLatitude();
		double longitude = gps->GetLongitude();
		sprintf(location,"%.4f° %s, %.4f° %s;%f;%f",
			fabs(latitude),latitude < 0 ? "South" : "North",
			fabs(longitude),longitude < 0 ? "West" : "East",
			latitude,longitude);
	} else {
		strcpy(location,"reading...;reading...;reading...");
	}

	printf("Location: %s\n",location);

	shttpd_printf(arg, "%s", "HTTP/1.1 200 OK\r\n");
	shttpd_printf(arg, "Content-Length: %lu\r\n", strlen(location));
	shttpd_printf(arg, "%s", "Connection: close\r\n");
	shttpd_printf(arg, "%s", "Pragma: no-cache\r\n" );
	shttpd_printf(arg, "%s", "Cache-Control: no-cache\r\n" );
	shttpd_printf(arg, "%s", "Expires: 0\r\n" );
	shttpd_printf(arg, "%s", "Content-Type: text/html; charset=ISO-8859-4\r\n\r\n");
	shttpd_printf(arg, "%s", location);

	arg->flags |= SHTTPD_END_OF_OUTPUT;
}
Exemple #2
0
double rho_geo_longitude() 
{
#if defined(_WIN32_WCE)&& !defined( OS_PLATFORM_CE )
  CGPSController* gps = CGPSController::startInstance();
	return gps->GetLongitude();
#else
	return 0.0;
#endif
}
double rho_geo_longitude() 
{
#if defined(_WIN32_WCE)//&& !defined( OS_PLATFORM_MOTCE )
	if(winversion == 1)
	{
		CGPSController* gps = CGPSController::startInstance();
		return gps->GetLongitude();
	}
	return 0.0;
#else
	return 0.0;
#endif
}