Closed Bug 1203408 Opened 9 years ago Closed 7 years ago

[Stingray] Display available memory devices (USB stick/USB HDD/Samba/NFS) in Device Deck

Categories

(Firefox OS Graveyard :: Gaia::TV, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: schien, Unassigned)

References

Details

(Whiteboard: [ft:conndevices])

User Story

As a user, I would like to see all available external memory devices, e.g. USB stick/USB HDD/Samba Server/NFS, in Device Deck.
In Bug 1126694 DeviceStorage WebAPI can notify the activity of adding/removing storage areas reported by nsVolumnService. Now Device Deck can enumerate and monitor the available memory devices using following sample code, with 'device-storage:sdcard' permission declared:

// list all available memory devices
let storages = navigator.getDeviceStorages('sdcard');

// monitor the change of memory device
navigator.deviceStorageAreaListener.addEventListener("storageareachanged", function(e) {
  switch (e.operation) {
    case 'added':
      addMemoryDevice(e.storageName);
      break;
    case 'removed':
      removeMemoryDevice(e.storageName);
      break;
    default:
      break;
  }
});

function addMemoryDevice(storageName) {
  // Get the corresponding DeviceStorage object for that memory device.
  let storage = navigator.getDeviceStorageByNameAndType(storageName, 'sdcard');

  //... create new storage device or make storage as available
}

function removeMemoryDevice(storageName) {
  //... mark storage as unavailable
}
Blocks: TV_dev_board
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.