NfcBarcode
class NfcBarcode : TagTechnology
| kotlin.Any | |
| ↳ | android.nfc.tech.NfcBarcode | 
Provides access to tags containing just a barcode.
Acquire an NfcBarcode object using get.
Summary
| Constants | |
|---|---|
| static Int | 
            
             Kovio Tags  | 
        
| static Int | |
| Public methods | |
|---|---|
| Unit | 
            close() | 
        
| Unit | 
            connect() | 
        
| static NfcBarcode! | 
            
             Get an instance of   | 
        
| ByteArray! | 
            
             Returns the barcode of an NfcBarcode tag.  | 
        
| Tag! | 
            getTag() | 
        
| Int | 
            getType()Returns the NFC Barcode tag type.  | 
        
| Boolean | |
Constants
Public methods
close
fun close(): Unit
| Exceptions | |
|---|---|
java.lang.Exception | 
            if this resource cannot be closed | 
java.io.IOException | 
            if an I/O error occurs | 
java.lang.SecurityException | 
            if the tag object is reused after the tag has left the field | 
connect
fun connect(): Unit
| Exceptions | |
|---|---|
TagLostException | 
            if the tag leaves the field | 
java.io.IOException | 
            if there is an I/O failure, or connect is canceled | 
java.lang.SecurityException | 
            if the tag object is reused after the tag has left the field | 
get
static fun get(tag: Tag!): NfcBarcode!
Get an instance of NfcBarcode for the given tag. 
Returns null if NfcBarcode was not enumerated in Tag.getTechList. 
Does not cause any RF activity and does not block.
| Parameters | |
|---|---|
tag | 
            Tag!: an NfcBarcode compatible tag | 
| Return | |
|---|---|
NfcBarcode! | 
            NfcBarcode object | 
getBarcode
fun getBarcode(): ByteArray!
Returns the barcode of an NfcBarcode tag.
 Tags of TYPE_KOVIO return 16 bytes: 
- 0x00: Reserved for manufacturer assignment
 - 0x01: 96-bit URL with "http://www." prefix
 - 0x02: 96-bit URL with "https://www." prefix
 - 0x03: 96-bit URL with "http://" prefix
 - 0x04: 96-bit URL with "https://" prefix
 - 0x05: 96-bit GS1 EPC
 - 0x06-0xFF: reserved
 - In case of a URL payload, the payload is encoded in US-ASCII, following the limitations defined in RFC3987. {@see RFC 3987}
 - In case of GS1 EPC data, see GS1 Electronic Product Code (EPC) Tag Data Standard (TDS) for more details.
 
The first byte is 0x80 ORd with a manufacturer ID, corresponding to ISO/IEC 7816-6.
The second byte describes the payload data format. Defined data format types include the following:
The following 12 bytes are payload:
The last 2 bytes comprise the CRC.
Does not cause any RF activity and does not block.
| Return | |
|---|---|
ByteArray! | 
            a byte array containing the barcode | 
See Also
getTag
fun getTag(): Tag!
| Return | |
|---|---|
Tag! | 
            the Tag backing this TagTechnology object. | 
          
getType
fun getType(): Int
Returns the NFC Barcode tag type.
Currently only one of TYPE_KOVIO or TYPE_UNKNOWN. 
Does not cause any RF activity and does not block.
| Return | |
|---|---|
Int | 
            the NFC Barcode tag type | 
isConnected
fun isConnected(): Boolean
| Return | |
|---|---|
Boolean | 
            true if I/O operations should be possible |