NFC / NDEF Library for Proximity APIs  4.1.0
Easily parse and create NDEF records with the Windows Proximity APIs / Near Field Communication NFC.
Public Types | Public Member Functions | Static Public Member Functions | Properties | List of all members
NdefLibrary.Ndef.NdefGeoRecord Class Reference

Store longitude and latitude on a tag, to allow the user to view a map when tapping the tag. More...

Inheritance diagram for NdefLibrary.Ndef.NdefGeoRecord:
NdefLibrary.Ndef.NdefSmartUriRecord NdefLibrary.Ndef.NdefSpRecord NdefLibrary.Ndef.NdefRecord

Public Types

enum  NfcGeoType {
  NfcGeoType.GeoUri = 0, NfcGeoType.BingMaps, NfcGeoType.NokiaMapsUri, NfcGeoType.WebRedirect,
  NfcGeoType.MsDriveTo, NfcGeoType.MsWalkTo, NfcGeoType.HereDirections, NfcGeoType.HereDriveGuidance,
  NfcGeoType.HereWalkGuidance, NfcGeoType.HerePublicTransit, NfcGeoType.HereExploreShowMap, NfcGeoType.HereExploreShowPlace
}
 Format of the URI on the geo tag. More...
 
- Public Types inherited from NdefLibrary.Ndef.NdefRecord
enum  TypeNameFormatType {
  TypeNameFormatType.Empty = 0x00, TypeNameFormatType.NfcRtd = 0x01, TypeNameFormatType.Mime = 0x02, TypeNameFormatType.Uri = 0x03,
  TypeNameFormatType.ExternalRtd = 0x04, TypeNameFormatType.Unknown = 0x05, TypeNameFormatType.Unchanged = 0x06, TypeNameFormatType.Reserved = 0x07
}
 Standardized type name formats, as defined by the NDEF record specification from the Nfc Forum. More...
 

Public Member Functions

override bool CheckIfValid ()
 Checks if the contents of the record are valid; throws an exception if a problem is found, containing a textual description of the issue. More...
 
- Public Member Functions inherited from NdefLibrary.Ndef.NdefSmartUriRecord
 NdefSmartUriRecord ()
 Create an empty Smart Uri Record. More...
 
 NdefSmartUriRecord (NdefRecord other)
 Create a Smart Uri record based on the record passed through the argument. More...
 
- Public Member Functions inherited from NdefLibrary.Ndef.NdefSpRecord
 NdefSpRecord ()
 Create an empty Smart Poster (Sp) record. More...
 
 NdefSpRecord (NdefRecord other)
 Create a Smart Poster record based on the record passed through the argument. More...
 
void SetPayloadAndParse (byte[] payload, bool parseNewPayload)
 Sets the payload of the base class to the byte array from the parameter and optionally parses its contents. More...
 
bool HasSpData ()
 Returns true if this record contains data that requires a Smart Poster and could not be stored in a simple URI record. More...
 
override bool CheckIfValid ()
 Checks if the contents of the record are valid; throws an exception if a problem is found, containing a textual description of the issue. More...
 
void SetUri (NdefUriRecord newUri)
 Set the URI based on another URI record instead of specifying the URI itself. More...
 
void AddTitle (NdefTextRecord newTitle)
 Add an (optional) title to the Smart Poster. More...
 
int TitleCount ()
 Returns how many title text records are stored in the Smart Poster. More...
 
NdefTextRecord Title (int index)
 Retrieve a specific title text record from the list. More...
 
bool ActionInUse ()
 Returns if the action has been defined for this Smart Poster instance. More...
 
bool SizeInUse ()
 Returns if the size has been defined for this Smart Poster instance. More...
 
bool MimeTypeInUse ()
 Returns if the mime type has been defined for this Smart Poster instance. More...
 
bool ImageInUse ()
 Returns if the Smart Poster contains an image (not supported yet). More...
 
- Public Member Functions inherited from NdefLibrary.Ndef.NdefRecord
 NdefRecord ()
 Create an empty record, not setting any information. More...
 
 NdefRecord (TypeNameFormatType tnf, byte[] type)
 Create a new record with the specified type name format and type. Doesn't set the payload and ID. More...
 
 NdefRecord (NdefRecord other)
 Create a new record, copying the information of the record sent through the parameter. More...
 
Type CheckSpecializedType (bool checkForSubtypes)
 Checks the type name format and type of this record and returns the appropriate specialized class, if one is available and known for this record type. More...
 

Static Public Member Functions

static bool IsHereMapsType (NfcGeoType geoType)
 Check if the current geo type is one of the HERE maps schemes, as these require the AppId. More...
 
- Static Public Member Functions inherited from NdefLibrary.Ndef.NdefSpRecord
static bool IsRecordType (NdefRecord record)
 Checks if the record sent via the parameter is indeed a Smart Poster. Only checks the type and type name format, doesn't analyze if the payload is valid. More...
 

Properties

double Longitude [get, set]
 Longitude of the coordinate to encode in the Geo URI. More...
 
double Latitude [get, set]
 Latitude of the coordinate to encode in the Geo URI. More...
 
string PlaceTitle [get, set]
 Title of the specified place. Used by MsDriveTo, MsWalkTo and the HERE maps schemes. More...
 
string AppId [get, set]
 App ID - has to be present for HERE maps schemes, unfortunately. It is obviously risky to share your app ID on public NFC tags, so be careful and use the generic MsDriveTo scheme in those cases. More...
 
NfcGeoType GeoType [get, set]
 Format to use for encoding the coordinate into a URI. More...
 
- Properties inherited from NdefLibrary.Ndef.NdefSmartUriRecord
override byte [] Type [get]
 An identifier describing the type of the payload. Override to return correct type depending on data stored - either U(RI) or Sp (Smart Poster). More...
 
override byte [] Payload [get]
 The application data carried within an NDEF record. More...
 
- Properties inherited from NdefLibrary.Ndef.NdefSpRecord
string Uri [get, set]
 Mandatory URI of the Smart Poster More...
 
List< NdefTextRecord > Titles [get]
 List of all title texts for different languages used in the Smart Poster. More...
 
NdefSpActRecord.NfcActionType NfcAction [get, set]
 The action defines how the reader should handle the Smart Poster record. More...
 
uint NfcSize [get, set]
 Size of the linked content. More...
 
string NfcMimeType [get, set]
 MIME type of the linked object. More...
 
NdefMimeImageRecordBase NfcImage [get, set]
 Icon / Image data contained in the Smart Poster. More...
 
- Properties inherited from NdefLibrary.Ndef.NdefRecord
TypeNameFormatType TypeNameFormat [get, set]
 Indicates the structure of the value of the TYPE field. More...
 
virtual byte [] Type [get, set]
 An identifier describing the type of the payload. More...
 
byte [] Id [get, set]
 An identifier in the form of a URI reference. More...
 
virtual byte [] Payload [get, set]
 The application data carried within an NDEF record. More...
 

Additional Inherited Members

- Static Public Attributes inherited from NdefLibrary.Ndef.NdefSpRecord
static readonly byte [] SmartPosterType = { (byte)'S', (byte)'p' }
 Type of the NDEF Smart Poster record (well-known, type 'Sp'). More...
 
- Protected Attributes inherited from NdefLibrary.Ndef.NdefSpRecord
NdefUriRecord RecordUri
 URI sub-record of this Smart Poster. Use Uri property to access if possible. More...
 
- Protected Attributes inherited from NdefLibrary.Ndef.NdefRecord
byte [] _type
 Byte array storing raw contents of the type. Use Type property to access it whenever possible. More...
 
byte [] _payload
 Byte array storing raw contents of the payload. Use Payload property to access it whenever possible. More...
 

Detailed Description

Store longitude and latitude on a tag, to allow the user to view a map when tapping the tag.

Geo tags are not standardized by the NFC forum, therefore, this class supports three different types of writing the location to a tag.

As this class is based on the Smart URI base class, the payload is formatted as a URI record initially. When first adding Smart Poster information (like a title), the payload instantly transforms into a Smart Poster.

Member Enumeration Documentation

◆ NfcGeoType

Format of the URI on the geo tag.

Enumerator
GeoUri 

Geo URI scheme, as defined in RFC 5870 (http://tools.ietf.org/html/rfc5870).

BingMaps 

Bing Maps URI scheme, used for Maps on Windows 8 / 10 (https://msdn.microsoft.com/en-us/library/windows/apps/mt228341.aspx)

NokiaMapsUri 

HERE Maps HTTP URL to show maps in the browser.

WebRedirect 

Web redirection script that uses the appropriate URI format depending on the browser's user agent.

MsDriveTo 

Drive-to URI scheme for Windows Phone 8 / Windows 10 (https://msdn.microsoft.com/en-us/library/windows/apps/mt228341.aspx)

MsWalkTo 

Walk-to URI scheme for Windows Phone 8 / Windows 10 (https://msdn.microsoft.com/en-us/library/windows/apps/mt228341.aspx)

HereDirections 

Here Maps URI Scheme for Directions (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/directions.html)

HereDriveGuidance 

Here Maps URI Scheme for starting voice-guided drive navigation (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/drive-guidance.html)

HereWalkGuidance 

Here Maps URI Scheme for starting voice-guided walking navigation (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/walk-guidance.html)

HerePublicTransit 

Here Maps URI Scheme for public transit (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/public-transit.html)

HereExploreShowMap 

Here Maps URI Scheme for exploring maps / showing the map at a specific position (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/explore-maps.html)

HereExploreShowPlace 

Here Maps URI Scheme for exploring maps / showing a specific place (http://developer.nokia.com/Resources/Library/Lumia/#!maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/explore-maps.html)

Member Function Documentation

◆ CheckIfValid()

override bool NdefLibrary.Ndef.NdefGeoRecord.CheckIfValid ( )
virtual

Checks if the contents of the record are valid; throws an exception if a problem is found, containing a textual description of the issue.

Exceptions
NdefExceptionThrown if no valid NDEF record can be created based on the record's current contents. The exception message contains further details about the issue.
Returns
True if the record contents are valid, or throws an exception if an issue is found.

Reimplemented from NdefLibrary.Ndef.NdefRecord.

◆ IsHereMapsType()

static bool NdefLibrary.Ndef.NdefGeoRecord.IsHereMapsType ( NfcGeoType  geoType)
static

Check if the current geo type is one of the HERE maps schemes, as these require the AppId.

Returns
If the currently selected map scheme is a HERE maps scheme.

Property Documentation

◆ AppId

string NdefLibrary.Ndef.NdefGeoRecord.AppId
getset

App ID - has to be present for HERE maps schemes, unfortunately. It is obviously risky to share your app ID on public NFC tags, so be careful and use the generic MsDriveTo scheme in those cases.

◆ GeoType

NfcGeoType NdefLibrary.Ndef.NdefGeoRecord.GeoType
getset

Format to use for encoding the coordinate into a URI.

◆ Latitude

double NdefLibrary.Ndef.NdefGeoRecord.Latitude
getset

Latitude of the coordinate to encode in the Geo URI.

◆ Longitude

double NdefLibrary.Ndef.NdefGeoRecord.Longitude
getset

Longitude of the coordinate to encode in the Geo URI.

◆ PlaceTitle

string NdefLibrary.Ndef.NdefGeoRecord.PlaceTitle
getset

Title of the specified place. Used by MsDriveTo, MsWalkTo and the HERE maps schemes.


The documentation for this class was generated from the following file: