Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 402
Tangui Avatar asked May 18 '11 20:05

Tangui


2 Answers

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.

like image 125
J_A_X Avatar answered Oct 13 '22 23:10

J_A_X


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

like image 30
Dennis Jaamann Avatar answered Oct 14 '22 01:10

Dennis Jaamann