Code Examples/Quickstart Guides
WPS SDK
The WPS SDK leverages a series of simple APIs to facilitate device deployment and application integration. Using straightforward commands, such as 'Get Location', WPS lets application developers focus on building great end-user location-based applications without worrying about building the location-engine to make them work.
Below is a sample use of the WPS API that prints the user's location (latitude, longitude).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wpsapi.h"
int main(int argc, char *argv[])
{
WPS_SimpleAuthentication authentication;
authentication.username = argv[1];
authentication.realm = argv[2];
WPS_Location* location;
WPS_ReturnCode rc = WPS_location(&authentication,
WPS_NO_STREET_ADDRESS_LOOKUP,
&location);
if (rc == WPS_OK)
{
printf("%f, %f\n", location->latitude, location->longitude);
WPS_free_location(location);
}
return 0;
}
WPS/Quattro SDK
The WPS/Quattro SDK allows developers to request location targeted advertisements based on a number of input parameters. Those ads are delivered as a short text, an HTTP link and image allowing developers to simply integrate these ads into their user interface. Results of ad delivery can be monitored on the Quattro Wireless web site.>
Below is a sample use of the WPS/Quattro API that retrieves a local ad.
Be sure to setup an account here with Quattro before beginning to test.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wpsapi.h"
int main(int argc, char *argv[])
{
WPS_QuattroAuthentication authentication;
authentication.username = argv[1];
authentication.realm = argv[2];
authentication.pid = argv[3];
const WPS_Quattro_Ad* ad;
WPS_ReturnCode rc = WPS_Quattro_local_ad(&authentication,
NULL, // quy
NULL, // rots
NULL, // adm
NULL, // mdn
NULL, // dem
&ad);
if (rc == WPS_OK && ad)
{
printf("%s [%s]\n", ad->text, ad->href);
if (ad->size > 0)
{
FILE* f = fopen("ad.png", "wb");
if (f)
{
fwrite(ad->img, 1, ad->size, f);
fclose(f);
}
}
WPS_Quattro_free_ad(ad);
}
return 0;
}