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

Stores a MIME type and image data for individual use or as a part of another record like the Smart Poster. More...

Inheritance diagram for NdefLibrary.Ndef.NdefMimeImageRecordBase:
NdefLibrary.Ndef.NdefRecord

Public Types

enum  ImageMimeType {
  Png, Jpg, Jpeg, JpegXr,
  Bmp, Gif, Tiff
}
 Common Image MIME type definitions, to be used when accessing the ImageMimeTypes dictionary to retrieve the correct MIME type string for the NDEF record. 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

 NdefMimeImageRecordBase (NdefRecord other)
 Create a MIME / Image 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 MIME / Image record. Only checks the type and type name format, doesn't analyze if the payload is valid. More...
 

Static Public Attributes

static readonly Dictionary< ImageMimeType, byte[]> ImageMimeTypes
 Dictionary containing the most common MIME type definitions for various image formats. More...
 

Protected Member Functions

 NdefMimeImageRecordBase ()
 Create an empty MIME / Image Record with the type of PNG. More...
 

Additional Inherited Members

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

Detailed Description

Stores a MIME type and image data for individual use or as a part of another record like the Smart Poster.

This base class provides the general record layout and various common used MIME types. As the actual interaction with bitmaps and encoded images (PNG, JPEG, etc.) is not possible from within a portable class library and requires platform-specific functions, you can use the derived class in the extension library for convenience methods to work with the image.

Member Enumeration Documentation

◆ ImageMimeType

Common Image MIME type definitions, to be used when accessing the ImageMimeTypes dictionary to retrieve the correct MIME type string for the NDEF record.

Constructor & Destructor Documentation

◆ NdefMimeImageRecordBase() [1/2]

NdefLibrary.Ndef.NdefMimeImageRecordBase.NdefMimeImageRecordBase ( )
protected

Create an empty MIME / Image Record with the type of PNG.

◆ NdefMimeImageRecordBase() [2/2]

NdefLibrary.Ndef.NdefMimeImageRecordBase.NdefMimeImageRecordBase ( NdefRecord  other)

Create a MIME / Image record based on the record passed through the argument.

The original record has to be a MIME / Image Record as well.

Parameters
otherRecord to copy into this Image record.
Exceptions
NdefExceptionThrown if attempting to create an Image record based on an incompatible record type.

Member Function Documentation

◆ IsRecordType()

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

Checks if the record sent via the parameter is indeed a MIME / Image 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 MIME / Image record, false if it's a different record.

Member Data Documentation

◆ ImageMimeTypes

readonly Dictionary<ImageMimeType,byte[]> NdefLibrary.Ndef.NdefMimeImageRecordBase.ImageMimeTypes
static
Initial value:
= new Dictionary<ImageMimeType, byte[]>
{
{ImageMimeType.Png, Encoding.UTF8.GetBytes(MimeTypeImage + "png")},
{ImageMimeType.Jpg, Encoding.UTF8.GetBytes(MimeTypeImage + "jpg")},
{ImageMimeType.Jpeg, Encoding.UTF8.GetBytes(MimeTypeImage + "jpeg")},
{ImageMimeType.JpegXr, Encoding.UTF8.GetBytes(MimeTypeImage + "vnd.ms-photo")},
{ImageMimeType.Bmp, Encoding.UTF8.GetBytes(MimeTypeImage + "bmp")},
{ImageMimeType.Gif, Encoding.UTF8.GetBytes(MimeTypeImage + "gif")},
{ImageMimeType.Tiff, Encoding.UTF8.GetBytes(MimeTypeImage + "tiff")},
}

Dictionary containing the most common MIME type definitions for various image formats.


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