haiku/headers/private/shared/Geolocation.h
Adrien Destugues edc5a2174e BGeolocation: add position to country mapping
Using the geonames.org API, so we will need an API key for it (similar
to the one used for MLS, deployed by the buildbot)

The unit tests uses the "demo" user, which is restricted to 20000 API
call credits and often expired. But we cannot use our secret key here as
it would need to be available to anyone running the test. If we ever get
to automate running the tests on a buildserver we could probably make it
use the secret username known by our buildbot instead.

Change-Id: Ia16880db82555ce85505ad28e1c623f692f46be0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1873
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-12-03 08:01:14 +00:00

44 lines
874 B
C++

/*
* Copyright 2014-2019, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _GEOLOCATION_H
#define _GEOLOCATION_H
#include <Country.h>
#include <Url.h>
namespace BPrivate {
class BGeolocation {
public:
BGeolocation();
BGeolocation(const BUrl& geolocationService,
const BUrl& geocodingService);
status_t LocateSelf(float& latitude, float& longitude);
status_t Locate(const BString placeName, float& latitude,
float& longitude);
status_t Name(const float latitude, const float longitude,
BString& name);
status_t Country(const float latitude, const float longitude,
BCountry& country);
private:
BUrl fGeolocationService;
BUrl fGeocodingService;
static const char* kDefaultGeolocationService;
static const char* kDefaultGeocodingService;
};
} // namespace BPrivate
#endif