Difference between revisions of "Truxton sensitive site list add"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This makes an entry in the list. It creates a record in the <code>[SensitiveSite]</code> table. =Syntax= <source lang="C"> int truxton_sensitive_site_list_add( uint64_t ssl_h...")
 
 
Line 30: Line 30:
 
==<code>id</code>==
 
==<code>id</code>==
 
The string representation of a [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID.]
 
The string representation of a [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID.]
 +
Every site should have a unique identifier.
 +
If this value is an empty string or <code>NULL</code>, a random identifier will be generated for you.
  
 
=Return value=
 
=Return value=
Line 35: Line 37:
  
 
=Sample=
 
=Sample=
<source lang="C" highlight="12,13">
+
<source lang="C" highlight="13,14">
 
void create_list( uint64_t truxton )
 
void create_list( uint64_t truxton )
 
{
 
{

Latest revision as of 15:04, 25 May 2021

This makes an entry in the list. It creates a record in the [SensitiveSite] table.

Syntax

int truxton_sensitive_site_list_add( uint64_t ssl_handle, double latitude, double longitude, double distance_in_meters, char const* name, char const* id);

Parameters

ssl_handle

The handle to the list object. This handle comes from calling truxton_sensitive_site_list_create().

latitude

The latitude in decimal degrees using the WGS84 ellipsoid. It corresponds to the [Latitude] column of the [SensitiveSite] table.

longitude

The longitude in decimal degrees using the WGS84 ellipsoid. It corresponds to the [Longitude] column of the [SensitiveSite] table.

distance_in_meters

The distance in meters of the zone that should not be entered. It corresponds to the [Distance] column of the [SensitiveSite] table.

name

The name of the location. It corresponds to the [Name] column of the [SensitiveSite] table.

id

The string representation of a GUID. Every site should have a unique identifier. If this value is an empty string or NULL, a random identifier will be generated for you.

Return value

A non-zero value on success, zero on failure.

Sample

void create_list( uint64_t truxton )
{
   uint64_t ssl = truxton_sensitive_site_list_create( truxton );

   truxton_sensitive_site_list_set_id( ssl, "ED1E0F5E-1AD0-7A14-A053-04D8DB47BC4C" );
   truxton_sensitive_site_list_set_name( ssl, "A couple of places" );
   truxton_sensitive_site_list_set_description( ssl, "My list of places" );

   // Commit the data to the database
   truxton_sensitive_site_list_save( ssl );

   // Now add some sites to our list
   truxton_sensitive_site_list_add( ssl, 39.136001, -77.701114, 100, "Lothar's", NULL );
   truxton_sensitive_site_list_add( ssl, 28.421, -81.57985, 100, "Illegal Fishing HQ", "22222222-0000-0000-0000-000000000000");

   truxton_sensitive_site_list_destroy( ssl );
}