|
string | GetCloudUrl () |
| Get the last DeviceAtlas cloud service end-point (server) URL called to get device properties More...
|
|
Server [] | GetServers () |
| Getter for cloud server list. The end-points in the returned array are used for making DeviceAtlas cloud calls. The top end-point will most likely be used unless it fails and the call falls to the next end-point and so on. More...
|
|
void | SetServers (Server[] servers) |
| Setter for cloud server list. To set DeviceAtlas cloud end-points manually. The order of this array matters. While healthy the top end-point will be used. More...
|
|
bool | GetAutoServerRanking () |
| Getter for auto server ranking More...
|
|
void | SetAutoServerRanking (bool autoServerRanking) |
| Setter for auto server ranking More...
|
|
int | GetServerPhaseOutLifetime () |
| Getter for manual ranking server phase out Lifetime. When not auto-ranking shall the top end-point fail the list will be re-arranged and the failed end-point will be moved to the bottom. ServerPhaseOutLifetime indicated for how long should this re-arranged Server list be used over the original. More...
|
|
void | SetServerPhaseOutLifetime (int serverPhaseOutLifetime) |
| Setter for manual ranking server phase out Lifetime. When not auto-ranking shall the top end-point fail the list will be re-arranged and the failed end-point will be moved to the bottom. ServerPhaseOutLifetime indicated for how long should this re-arranged Server list be used over the original. More...
|
|
int | GetCloudServiceTimeout () |
| Getter for cloud service timeout. If the API requests service from a DeviceAtlas end-point, shall the end-point not response in this amount of time the next end-point in the list will be used. More...
|
|
void | SetCloudServiceTimeout (int timeout) |
| Setter for cloud service timeout. If the API requests service from a DeviceAtlas end-point, shall the end-point not response in this amount of time the next end-point in the list will be used. More...
|
|
int | GetAutoServerRankingMaxFailures () |
| Getter for max server failures More...
|
|
void | SetAutoServerRankingMaxFailures (int autoServerRankingMaxFailures) |
| Setter for max server failures. Number of times an end-point is allowed to fail during auto ranking. Failing more times and the end-pint will be excluded. More...
|
|
int | GetAutoServerRankingNumRequests () |
| When auto ranking end-points, this number of requests will be sent to each end-point and the mean time will be used for ranking the end-point. More...
|
|
void | SetAutoServerRankingNumRequests (int autoServerLatencyNumRequests) |
| When auto ranking end-points, this number of requests will be sent to each end-point and the mean time will be used for ranking the end-point. More...
|
|
int | GetAutoServerRankingLifetime () |
| Getter for auto ranking cached end-point list lifetime. After each auto ranking the ranked end point list will be valid for this amount of time. When the list is too old the API will rank it again unless the auto ranking is off. More...
|
|
void | SetAutoServerRankingLifetime (int autoServerRankListLifetime) |
| Setter for auto ranking cached end-point list lifetime. After each auto ranking the ranked end point list will be valid for this amount of time. When the list is too old the API will rank it again unless the auto ranking is off. More...
|
|
string | GetLicenceKey () |
| Getter for licence key More...
|
|
void | SetLicenceKey (string licenceKey) |
| Setter for licence key More...
|
|
bool | GetUseCache () |
| Is device data being cached by the API or not. More...
|
|
void | SetUseCache (bool useCache) |
| Setter to cache or not to cache device data. More...
|
|
bool | GetUseFileCache () |
| Is data being cached on the disk or not. More...
|
|
void | SetUseFileCache (bool fileCache) |
| Set if data must be cached on disk or not More...
|
|
string | GetCacheDir () |
| Getter for the cache location directory. More...
|
|
void | SetCacheDir (string cacheDir) |
| Setter for the cache location directory. More...
|
|
int | GetCacheItemExpirySeconds () |
| Getter for the cache item expiry. More...
|
|
void | SetCacheItemExpirySeconds (int cacheItemExpirySec) |
| Setter for the cache item expiry. More...
|
|
bool | GetTestMode () |
| Getter for testMode setting. If this is TRUE then a test User-Agent will be used for the query. More...
|
|
void | SetTestMode (bool testMode) |
| Setter for testMode setting. Defaults to false. If this is TRUE then a test User-Agent will be used for the query. More...
|
|
string | GetVersion () |
| Get the API version. More...
|
|
bool | GetUseClientCookie () |
| Getter for the useClientCookie setting. Defaults to true. If TRUE then if device data which is created by the DeviceAtlas client side component (JS library) exists it will be used More...
|
|
void | SetUseClientCookie (bool useClientCookie) |
| Setter for the useClientCookie setting. Defaults to true. If TRUE then if device data which is created by the DeviceAtlas client side component (JS library) exists it will be used More...
|
|
Hashtable | GetDeviceData (NameValueCollection headers) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Hashtable | GetDeviceData (Dictionary< string, string > headers) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Hashtable | GetDeviceData (string userAgent) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Hashtable | GetDeviceDataByUserAgent (string userAgent) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Hashtable | GetDeviceDataByHeaders (Dictionary< string, string > headers) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Hashtable | GetDeviceDataByHeaders (NameValueCollection headers) |
| Get device data from DeviceAtlas Cloud service. If using cache is not turned off the device data will be cached after each cloud call, if cached data exists for a device it will be used over the cloud. More...
|
|
Server [] | GetServersLatencies () |
| Get DeviceAtlas cloud end-point list. If auto-ranking is on then the ranked end-point list is returned otherwise the manual or default original or fail-over list will be returned. If auto-ranking is on but no valid end-point list is found inside the cache then the end-points will be ranked and cached. More...
|
|
Server [] | GetServersLatencies (int numRequests) |
| Get servers and their service latencies. More...
|
|
Server [] | RankServers () |
| If auto-ranking is on then rank the DeviceAtlas cloud end-points and put in cache. More...
|
|
void | SetProxy (WebProxy proxy) |
| Sets HTTP proxy settings for the remote requests More...
|
|
|
const string | TEST_USERAGENT = "Mozilla/5.0 (Linux; U; Android 2.3.3; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" |
| Built in test user-agent More...
|
|
const string | CLIENT_COOKIE_NAME = "DAPROPS" |
| Name of the cookie created by the DeviceAtlas client side component More...
|
|
const string | KEY_USERAGENT = "useragent" |
| The name of the key used to lookup the User-Agent in the results object More...
|
|
const string | KEY_SOURCE = "source" |
| The name of the key used to lookup the source of data (none, cache or cloud) in the results object More...
|
|
const string | KEY_PROPERTIES = "properties" |
| The name of the key used to lookup the device properties in the results object More...
|
|
const string | SOURCE_CACHE = "cache" |
| In the result Map, KEY_SOURCE may be set to this. Shows that the data source of device properties set to KEY_PROPERTIES in the result Map was cache. More...
|
|
const string | SOURCE_CLOUD = "cloud" |
| In the result Map, KEY_SOURCE may be set to this. Shows that the device properties set to KEY_PROPERTIES where queried from DA cloud service. More...
|
|
const string | SOURCE_NONE = "none" |
| In the result Map, KEY_SOURCE may be set to this. Indicates that there was a problem getting device data. More...
|
|
const String | CACHE_NAME_SERVERS_AUTO = "servers" |
| cache key for cached servers ranked list ///
|
|
const String | CACHE_NAME_SERVERS_MANUAL = "servers_manual" |
| cache key for cached servers manual fail-over list ///
|
|
DeviceAtlas Cloud API. This client library can be used to easily get device data from the DeviceAtlas Cloud service. To reduce cloud calls and improve performance the API locally caches the data returned from the cloud service. The caching uses the built in .NET cache backed by a file cache.
The client is queried by passing either a collection of HTTP headers or a user-agent string. The device properties will then be returned.
Example 1 (manually passing the http headers):
Client client = Client.GetInstance();
client.SetLicenceKey("DeviceAtlas-licence-key");
Hashtable results;
Dictionary<string, string> headers new Dictionary<string, string>();
headers.Add("User-Agent", "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95_8GB/15.0.015; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413");
headers.Add("X-Profile", "http://nds.nokia.com/uaprof/NN95_8GB-1r100.xml");
headers.Add("Accept", "text/html,text/css,multipart/mixed,application/java-archive, application/java");
headers.Add("Accept-Language", "en-us,en;q=0.5");
try{ results = client.GetDeviceData(headers); } catch (Exception x) {
string ua = (String)results[Client.KEY_USERAGENT];
string dataSource = (String)results[Client.KEY_SOURCE];
Hashtable properties = (Hashtable)results[Client.KEY_PROPERTIES];
Example 2 (manually passing the user-agent string):
Client client = Client.GetInstance();
client.SetLicenceKey("DeviceAtlas-licence-key");
Hashtable results;
string ua = "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95_8GB/15.0.015; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413";
try{ results = client.GetDeviceData(ua); } catch (Exception x) {
string ua = (String)results[Client.KEY_USERAGENT];
string dataSource = (String)results[Client.KEY_SOURCE];
Hashtable properties = (Hashtable)results[Client.KEY_PROPERTIES];