dom/webidl/MozNDEFRecord.webidl
author Gregory Szorc <gps@mozilla.com>
Fri, 22 Apr 2016 12:51:23 -0700
changeset 294591 d6ea7c8e2449d9b34882650490383ee86b8bb164
parent 232810 039c954bce303c252542853c2268c3abdf6ab6b7
permissions -rw-r--r--
Bug 1259782 - Build with Visual Studio 2015 Update 2; r=ted Should be a drop-in replacement for VS2015u1. MozReview-Commit-ID: HSmdikYPR0j

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Copyright © 2013 Deutsche Telekom, Inc. */

/**
 * Type Name Format.
 *
 * @see NFCForum-TS-NDEF 3.2.6 TNF
 */
enum TNF {
  "empty",
  "well-known",
  "media-type",
  "absolute-uri",
  "external",
  "unknown",
  "unchanged"
};

/**
 * Prefixes of well-known URI.
 *
 * @see NFCForum-TS-RTD_URI Table 3. Abbreviation Table.
 */
enum WellKnownURIPrefix {
  "",
  "http://www.",
  "https://www.",
  "http://",
  "https://",
  "tel:",
  "mailto:",
  "ftp://anonymous:anonymous@",
  "ftp://ftp.",
  "ftps://",
  "sftp://",
  "smb://",
  "nfs://",
  "ftp://",
  "dav://",
  "news:",
  "telnet://",
  "imap:",
  "rtsp://",
  "urn:",
  "pop:",
  "sip:",
  "sips:",
  "tftp:",
  "btspp://",
  "btl2cap://",
  "btgoep://",
  "tcpobex://",
  "irdaobex://",
  "file://",
  "urn:epc:id:",
  "urn:epc:tag:",
  "urn:epc:pat:",
  "urn:epc:raw:",
  "urn:epc:",
  "urn:nfc:"
};

/**
 * Record Type Description.
 *
 * Record Types from well-known NDEF Records.
 * @see NFCForum-TS-RTD
 */
enum RTD {
  "U", // URI
};

[Constructor(optional MozNDEFRecordOptions options),
 Constructor(DOMString uri)]
interface MozNDEFRecord
{
  /**
   * Type Name Field - Specifies the NDEF record type in general.
   */
  [Constant]
  readonly attribute TNF tnf;

  /**
   * type - Describes the content of the payload. This can be a mime type.
   */
  [Constant]
  readonly attribute Uint8Array? type;

  /**
   * id - Identifer is application dependent.
   */
  [Constant]
  readonly attribute Uint8Array? id;

  /**
   * payload - Binary data blob. The meaning of this field is application
   * dependent.
   */
  [Constant]
  readonly attribute Uint8Array? payload;

  /**
   * Get the size of this NDEF Record.
   */
  [Constant]
  readonly attribute unsigned long size;

  /**
   * Returns this NDEF Record as URI, return null if this record cannot be
   * decoded as a well-known URI record.
   */
  DOMString? getAsURI();
};

dictionary MozNDEFRecordOptions {
  TNF tnf = "empty";
  Uint8Array? type;
  Uint8Array? id;
  Uint8Array? payload;
};