Class: Rho::NFCTag

Inherits:
Object show all
Defined in:
lib/extensions/nfc/nfc.rb

Instance Method Summary collapse

Constructor Details

#initialize(tech_list) ⇒ NFCTag

Returns a new instance of NFCTag.



607
608
609
610
# File 'lib/extensions/nfc/nfc.rb', line 607

def initialize(tech_list)
    #puts 'Ruby NFCTag.initialize()'
   @techlist = tech_list
end

Instance Method Details

#get_IDObject

return byte[]



618
619
620
# File 'lib/extensions/nfc/nfc.rb', line 618

def get_ID
    return Nfc.tag_get_id
end

#get_tech(tech_name) ⇒ Object

return instance of coresponded tech (based on NFCTagTechnology)



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/extensions/nfc/nfc.rb', line 623

def  get_tech(tech_name)
    if @techlist.include?(tech_name)
        if tech_name == 'MifareClassic'
            return NFCTagTechnology_MifareClassic.new()
        end
        if tech_name == 'MifareUltralight'
            return NFCTagTechnology_MifareULtralight.new()
        end
        if tech_name == 'Ndef'
            return NFCTagTechnology_Ndef.new()
        end
        if tech_name == 'NfcA'
            return NFCTagTechnology_NfcA.new()
        end
        if tech_name == 'IsoDep'
            return NFCTagTechnology_IsoDep.new()
        end
        if tech_name == 'NdefFormatable'
            return NFCTagTechnology_NdefFormatable.new()
        end
        if tech_name == 'NfcB'
            return NFCTagTechnology_NfcB.new()
        end
        if tech_name == 'NfcF'
            return NFCTagTechnology_NfcF.new()
        end
        if tech_name == 'NfcV'
            return NFCTagTechnology_NfcV.new()
        end
    else
        return nil
    end
end

#get_tech_listObject

return array of string



613
614
615
# File 'lib/extensions/nfc/nfc.rb', line 613

def get_tech_list
    return @techlist
end