module LibNFC
Constants
- BAUD_RATE
- BaudRate
- DEP_MODE
- DepEnum
- MODULATION_TYPE
- ModulationType
- PROPERTIES
Public Class Methods
crc(data)
click to toggle source
# File lib/ruby-nfc/libnfc.rb, line 272 def self.crc(data) data_ptr = FFI::MemoryPointer.new(:uint8, data.length) data_ptr.put_bytes(0, data) crc_ptr = FFI::MemoryPointer.new(:uint8, 2) crc_ptr.put_bytes(0, "\x0\x0") iso14443a_crc(data_ptr, data.length, crc_ptr) crc_ptr.get_bytes(0, 2).to_s end
crc_hex(data)
click to toggle source
# File lib/ruby-nfc/libnfc.rb, line 283 def self.crc_hex(data) crc(data).unpack('H*').pop end
debug_target(target)
click to toggle source
# File lib/ruby-nfc/libnfc.rb, line 287 def self.debug_target(target) str_pointer = FFI::MemoryPointer.new(:pointer) str_nfc_target(str_pointer, target, true) puts str_pointer.get_pointer(0).get_string(0) end