views:

71

answers:

2

I'm creating a program that needs to communicate with a usb device when installed on the desktop, but doesn't need to access the device when running in the browser. Hopefully this would remove the need for doing any browser-dependent extensions/hacks to work.

Would silverlight 4 let me call a native process to do this (presumably via COM), or are things still tightly sandboxed? Supposedly there's a hack to do this ( google "silverlight 4 native process" )

Would using flex/adobe air be easier to achieve this? The latest version of flex seems to support access to native processes ( http://www.adobe.com/devnet/air/ajax/quickstart/articles/interacting_with_native_process.html )

A: 

I can't speak to Silverlight, but with Flex..

I'm creating a program that needs to communicate with a usb device when installed on the desktop, and the application also has an 'offline' mode which can run in the browser.

If I understand this, you need an application that will run in the browser and on the desktop, correct? Usually browser based applications are not referred to as "offline", but that is what you called it. Did you really mean to do that?

In Flex, I think you're limited to the type of USB Devices you can access. A Printer? Probably not! A card reader, or bar code scanner will act just like any other input device. Flex will support them no differently than a keyboard (both in the browser and on the desktop). A USB Drive? You should be able to access it via the File API (in AIR, but not in the browser). In AIR 1 if you plugged a drive in while the app was running it would not be accesible, but I believe this limitation was corrected. I'm not sure if it was corrected in AIR 1.5 or AIR 2, though.

A USB Microphone or web cam? They should be accessible both in browser and in AIR. I'm not sure if they'll be found if you plug them in after the app is loaded though.

My suspicion is that you'll need to elaborate on the type of USB device for specifics. I'll add that NativeProcess is an AIR specific feature and will not work in the browser all.

I also believe that Silverlight and Flex in the browser will have similar limitations in accessing external devices, due to the sandbox that the browser puts the app in.

Does this help?

www.Flextras.com
In the browser, I don't need to connect to the usb device, only when installed as a desktop app. Unfortunately, it's not a usb mic or webcam, it's a usb sound sequencer.
Calvin
Thanks for noting the confusion, I edited my question to be a little more clear.
Calvin
I'm not sure how sound sequencers work, but I suspect they are treated like a keyboard / mouse / standard input device. In the context of an AIR app, I believe your best bet is going to be to use a NativeProcess to communicate with it.
www.Flextras.com
A: 

Neither Flex or Silverlight will be able to connect directly to your USB sound sequencer. You will need to connect to the driver layer via some native software for the OS(es) you want to use and then connect the Flex or Silverlight app via NativeProcess or local TCP sockets.

slomojo
With Flex in an AIR 2 application, you can use a NativeProcess to execute something on the local machine which can access the sequencer. This can be done without the use of TCP Socket.
www.Flextras.com
That's true. Using NativeProcess the sequencer driver/interface will need to communicate on standard intput/output. So there will likely be a need to build an interface for that. I've updated my answer.
slomojo