本文整理汇总了C++中CGPSController::TurnGpsOn方法的典型用法代码示例。如果您正苦于以下问题:C++ CGPSController::TurnGpsOn方法的具体用法?C++ CGPSController::TurnGpsOn怎么用?C++ CGPSController::TurnGpsOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGPSController
的用法示例。
在下文中一共展示了CGPSController::TurnGpsOn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show_geolocation
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;
}