Class: MTP::Storage
- Inherits:
-
Object
- Object
- MTP::Storage
- Defined in:
- lib/mtp/storage.rb
Constant Summary collapse
- TYPES =
{ 0x0000 => "Undefined", 0x0001 => "Fixed ROM", 0x0002 => "Removable ROM", 0x0003 => "Fixed RAM", 0x0004 => "Removable RAM" }
- FILE_SYSTEMS =
{ 0x0000 => "Undefined", 0x0001 => "Generic Flat", 0x0002 => "Generic Hierarchical", 0x0003 => "DCF" }
Instance Attribute Summary collapse
-
#access_capability ⇒ Object
readonly
Returns the value of attribute access_capability.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#file_system ⇒ Object
readonly
Returns the value of attribute file_system.
-
#free_space_in_bytes ⇒ Object
readonly
Returns the value of attribute free_space_in_bytes.
-
#free_space_in_objects ⇒ Object
readonly
Returns the value of attribute free_space_in_objects.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#max_capability ⇒ Object
readonly
Returns the value of attribute max_capability.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#volume_label ⇒ Object
readonly
Returns the value of attribute volume_label.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#access_capability ⇒ Object (readonly)
Returns the value of attribute access_capability.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def access_capability @access_capability end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def description @description end |
#file_system ⇒ Object (readonly)
Returns the value of attribute file_system.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def file_system @file_system end |
#free_space_in_bytes ⇒ Object (readonly)
Returns the value of attribute free_space_in_bytes.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def free_space_in_bytes @free_space_in_bytes end |
#free_space_in_objects ⇒ Object (readonly)
Returns the value of attribute free_space_in_objects.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def free_space_in_objects @free_space_in_objects end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def id @id end |
#max_capability ⇒ Object (readonly)
Returns the value of attribute max_capability.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def max_capability @max_capability end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def type @type end |
#volume_label ⇒ Object (readonly)
Returns the value of attribute volume_label.
3 4 5 |
# File 'lib/mtp/storage.rb', line 3 def volume_label @volume_label end |
Class Method Details
.load(ph, id) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mtp/storage.rb', line 16 def self.load(ph, id) storage = Storage.new t = ph.transaction.get_storage_info(id) t.expect("OK") storage.instance_eval do @id = id @type, @file_system, @access_capability, @max_capability, @free_space_in_bytes, @free_space_in_objects, @description, @volume_label = t.data.payload.unpack("SSSQQIJJ") @type = Datacode.new(@type, TYPES) @file_system = Datacode.new(@file_system, FILE_SYSTEMS) end storage end |
Instance Method Details
#file_system_description ⇒ Object
35 36 37 |
# File 'lib/mtp/storage.rb', line 35 def file_system_description FILE_SYSTEMS[@file_system] end |