Class: Rho::NFCTagTechnology_Ndef

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

Constant Summary collapse

MIFARE_CLASSIC =
'com.nxp.ndef.mifareclassic'
NFC_FORUM_TYPE_1 =
'org.nfcforum.ndef.type1'
NFC_FORUM_TYPE_2 =
'org.nfcforum.ndef.type2'
NFC_FORUM_TYPE_3 =
'org.nfcforum.ndef.type3'
NFC_FORUM_TYPE_4 =
'org.nfcforum.ndef.type4'

Constants inherited from NFCTagTechnology

Rho::NFCTagTechnology::ISODEP, Rho::NFCTagTechnology::MIFARE_ULTRALIGHT, Rho::NFCTagTechnology::NDEF, Rho::NFCTagTechnology::NDEF_FORMATABLE, Rho::NFCTagTechnology::NFCA, Rho::NFCTagTechnology::NFCB, Rho::NFCTagTechnology::NFCF, Rho::NFCTagTechnology::NFCV

Instance Method Summary collapse

Methods inherited from NFCTagTechnology

#close, #connect, #get_name, #is_connected

Constructor Details

#initializeNFCTagTechnology_Ndef

Returns a new instance of NFCTagTechnology_Ndef.



294
295
296
# File 'lib/extensions/nfc/nfc.rb', line 294

def initialize
    super(NFCTagTechnology::NDEF)
end

Instance Method Details

#can_make_read_onlyObject

return bool



309
310
311
# File 'lib/extensions/nfc/nfc.rb', line 309

def can_make_read_only
    return (Nfc.tech_Ndef_can_make_read_only != 0)
end

#get_max_sizeObject

return int



299
300
301
# File 'lib/extensions/nfc/nfc.rb', line 299

def get_max_size
    return Nfc.tech_Ndef_get_max_size
end

#get_typeObject

return string



319
320
321
# File 'lib/extensions/nfc/nfc.rb', line 319

def get_type
    return Nfc.tech_Ndef_get_type
end

#is_writableObject

return bool



304
305
306
# File 'lib/extensions/nfc/nfc.rb', line 304

def is_writable
    return (Nfc.tech_Ndef_is_writable != 0)
end

#make_read_onlyObject

return bool



314
315
316
# File 'lib/extensions/nfc/nfc.rb', line 314

def make_read_only
    return (Nfc.tech_Ndef_make_read_only != 0)
end

#read_NdefMessageObject

return NdefMessage



324
325
326
327
328
329
# File 'lib/extensions/nfc/nfc.rb', line 324

def read_NdefMessage
    msg_ar =  Nfc.tech_Ndef_read_Nde_message
    msg = NdefMessage.new
    msg.init_from_byte_array(msg_ar)
    return msg
end

#write_NdefMessage(msg) ⇒ Object

msg - NdefMessage



332
333
334
# File 'lib/extensions/nfc/nfc.rb', line 332

def write_NdefMessage(msg)
    Nfc.tech_Ndef_write_Nde_message(msg.get_byte_array)
end