User Tools

Site Tools


access:cpp_track_api

This is an old revision of the document!


C++ API for tracking

The C++ API contains the TrackAPI, which is useful for tracking applications. There isn't a lot of functionality, and the API is minimal in order to accomplish base tasks. It is possible that this API is extended in the future (e.g. later than mid-2015).

The API allows an application to list tracks, trackers (more is needed), and track positions. Using the StorageServer object, the application requests an instance of the TrackAPI.

class ITrackApi { public:

virtual ~ITrackApi(void) {}
// Downloads GPS positions from the server according to the
// following arguments:
//
// serial    - The serial number of the GPS device
// start     - The time of the first GPS position
// end       - The time of the last GPS position
// allFields - Flag controlling which fields are retrieved.
//             true: Retrieves all fields listed in the GpsPos class
//             false: Retrieves only time, latitude and longitude
// cb        - The function called for each downloaded position
// clientp   - A pointer to client data passed to the callback function.
virtual AccessError download(const std::string& serial, 
            int start, 
            int end,
            bool allFields,
            PositionCallback cb, 
            void *clientp) = 0;
// Uploads GPS positions to the server according to the
// following arguments:
//
// serial   - The serial number of the GPS device
// count    - The number of GPS positions
// points   - An array of GPS positions
// uploaded - The number of points that were successfully uploaded.
//            This value will only be less than than the number of points
//            passed in if an error occurs.
virtual AccessError upload(const std::string& serial, 
            int count, 
            GpsPos* points, 
            int* uploaded) = 0;
// Retrieves the list of tracks from the server according to
// the following arguments:
//
// serial  - The serial number of the device that created the track.
//           Use the #define ALL_DEVICES to download tracks from all devices.
// project - The handle of the project containing the tracks.
//           Use the #define ALL_PROJECTS to download tracks from all projects.
// tracks  - The list the retrieved tracks will be added to. 
virtual AccessError getTracks(const std::string& serial,
            int project,
            TrackList& tracks) = 0;
// Moves a track to a project.
//
// track   - The handle of the track to move.
// project - The handle of the destination project.
// result  - A pointer to a track instance to store the result.
//           If the argument is null, no track is returned.
virtual AccessError moveTrack(int track, int project, Track* result) = 0;
// Deletes a track from the server.
//
// handle - The handle of the track to be deleted.
virtual AccessError deleteTrack(int handle) = 0;
// Returns the list of device serial numbers the server knows about
// for the customer. These include devices that are explicitly assigned
// to the customer and devices that have uploaded data.
//
// serials - The list the retrieved serial numbers will be added to.
virtual AccessError getSerialNumbers(SerialList& serials) = 0;

protected:

ITrackApi(void) {}

private:

ITrackApi(const ITrackApi& api);
ITrackApi& operator=(const ITrackApi& api);

};

access/cpp_track_api.1435773990.txt.gz · Last modified: 2015/07/01 18:06 by mjallison