Class: Mifare::DESFire::FILE_PERMISSION

Inherits:
Struct
  • Object
show all
Defined in:
lib/mifare/des_fire.rb

Overview

value 0x00 ~ 0x0D are key numbers, 0x0E grants free access, 0x0F always denies access

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#change_accessObject

Returns the value of attribute change_access

Returns:

  • (Object)

    the current value of change_access



121
122
123
# File 'lib/mifare/des_fire.rb', line 121

def change_access
  @change_access
end

#read_accessObject

Returns the value of attribute read_access

Returns:

  • (Object)

    the current value of read_access



121
122
123
# File 'lib/mifare/des_fire.rb', line 121

def read_access
  @read_access
end

#read_write_accessObject

Returns the value of attribute read_write_access

Returns:

  • (Object)

    the current value of read_write_access



121
122
123
# File 'lib/mifare/des_fire.rb', line 121

def read_write_access
  @read_write_access
end

#write_accessObject

Returns the value of attribute write_access

Returns:

  • (Object)

    the current value of write_access



121
122
123
# File 'lib/mifare/des_fire.rb', line 121

def write_access
  @write_access
end

Instance Method Details

#import(byte) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/mifare/des_fire.rb', line 122

def import(byte)
  self[:change_access] = byte & 0x0F
  self[:read_write_access] = (byte >> 4) & 0x0F
  self[:write_access] = (byte >> 8) & 0x0F
  self[:read_access] = (byte >> 12) & 0x0F
  self
end

#to_uintObject



130
131
132
# File 'lib/mifare/des_fire.rb', line 130

def to_uint
  (read_access << 12) | (write_access << 8) | (read_write_access << 4) | change_access
end