Tangui
Tangui

Reputation: 3953

Flex, get USB id of plugged USB device

I'm developping an Adobe Flex application.

I need to detect gps devices when plugged. Currently, it is a bad heuristic-based detection that is used (it tries to find specific files/directories). It uses the StorageVolumeInfo to discover plugged devices.

Thus, I'd like to know if there's a way to get the USB id with Flex.

Thx in advance

Upvotes: 6

Views: 1480

Answers (2)

J_A_X
J_A_X

Reputation: 12847

Right now, no, you can't do it natively in Air. You could however use a third party utility application to communicate with the device (java, c++, etc). Air USB device controls will be coming eventually after Adobe did a demo of using an xbox controller to play a game.

I tried looking for a release date, but to no avail.

Upvotes: 5

Dennis Jaamann
Dennis Jaamann

Reputation: 3565

I believe that the functionality you are looking for is only available in AIR. The following example shows all currently connected device names when starting up and also adds an event listener for devices that are connected at runtime.

        import mx.events.FlexEvent;

        private function onCreationComplete(e:FlexEvent):void{
            StorageVolumeInfo.storageVolumeInfo.addEventListener(StorageVolumeChangeEvent.STORAGE_VOLUME_MOUNT,onMount);
            showCurrentlyConnectedVolumes();

        }

        private function onMount(event:StorageVolumeChangeEvent):void{
            trace(event.storageVolume.name);
        }

        private function showCurrentlyConnectedVolumes():void{
            for each(var volume:StorageVolume in StorageVolumeInfo.storageVolumeInfo.getStorageVolumes()){
                trace(volume.name);
            }
        }

Cheers

Upvotes: 1

Related Questions