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 Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
NdefLibrary.Ndef.NdefUriRecord Class Reference

The URI record as specified by the NFC Forum URI record type definition. More...

Inheritance diagram for NdefLibrary.Ndef.NdefUriRecord:
NdefLibrary.Ndef.NdefRecord NdefLibrary.Ndef.NdefWindowsSettingsRecord

Public Member Functions

 NdefUriRecord ()
 Create an empty URI record. More...
 
 NdefUriRecord (NdefRecord other)
 Create a URI record based on the record passed through the argument. 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...
 
virtual 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...
 

Static Public Member Functions

static bool IsRecordType (NdefRecord record)
 Checks if the record sent via the parameter is indeed a URI record. Only checks the type and type name format, doesn't analyze if the payload is valid. More...
 

Static Public Attributes

static readonly byte [] UriType = { (byte)'U' }
 Type of the NDEF Text record (well-known, type 'U'). More...
 

Properties

byte [] RawUri [get, set]
 Get the raw URI as stored in this record, excluding any abbreviations. More...
 
string Uri [get, set]
 URI stored in this record. The abbreviation will be handled behind the scenes - getting and setting this property will always work on the full URI. 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

- 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...
 
- 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

The URI record as specified by the NFC Forum URI record type definition.

The record stores a URI and can be stored on a tag or sent to another device. Several of the most common URI headers are automatically abbreviated in order to keep the record as small as possible. URIs will be encoded using UTF-8.

This record can either be used stand alone, or as part of another record like the Smart Poster (NdefSpRecord).

Constructor & Destructor Documentation

◆ NdefUriRecord() [1/2]

NdefLibrary.Ndef.NdefUriRecord.NdefUriRecord ( )

Create an empty URI record.

◆ NdefUriRecord() [2/2]

NdefLibrary.Ndef.NdefUriRecord.NdefUriRecord ( NdefRecord  other)

Create a URI record based on the record passed through the argument.

Internalizes and parses the payload of the original record. The original record has to be a URI record as well.

Parameters
otherUri record to copy into this record.
Exceptions
NdefExceptionThrown if attempting to create a Uri record based on an incompatible record type.

Member Function Documentation

◆ IsRecordType()

static bool NdefLibrary.Ndef.NdefUriRecord.IsRecordType ( NdefRecord  record)
static

Checks if the record sent via the parameter is indeed a URI record. Only checks the type and type name format, doesn't analyze if the payload is valid.

Parameters
recordRecord to check.
Returns
True if the record has the correct type and type name format to be a URI record, false if it's a different record.

Member Data Documentation

◆ UriType

readonly byte [] NdefLibrary.Ndef.NdefUriRecord.UriType = { (byte)'U' }
static

Type of the NDEF Text record (well-known, type 'U').

Property Documentation

◆ RawUri

byte [] NdefLibrary.Ndef.NdefUriRecord.RawUri
getset

Get the raw URI as stored in this record, excluding any abbreviations.

Gets the raw contents of the URI, exclusive the first byte of the record's payload that would contain the abbreviation code. If the URI has been abbreviated, this method returns retuns the actual URI text as stored on the tag. To get the full URI that has been expanded with the abbreviated URI scheme, use the normal Uri accessor.

◆ Uri

string NdefLibrary.Ndef.NdefUriRecord.Uri
getset

URI stored in this record. The abbreviation will be handled behind the scenes - getting and setting this property will always work on the full URI.

Note that this property / class does not escape the URI data string to avoid double-escaping and to allow storing unescaped URIs if allowed by the protocol. For generic URLs, it's recommended to escape the URL string when sending it to this class, e.g., with System.Uri.EscapeUriString().


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