views:

810

answers:

2

Hello Gurus,

I'm developing application for Symbol MC3000 device. It's running Windows CE 4.2 Professional. Application is simple data driven app, which stores information about products in store.

My client wants to communicate with the device through serial and USB interface and read data stored in application. And here is where i'm stucked.

He wan't to send commands to device like over console:

RES:GET:DATA? - to receive all data from device in spec.format

RES:GET:VN? - to get version of software.

and so on.

Serial line is not a big deal. But how would you implement this via the USB port. (with no active sync, or network sockets)

(the device might be connected to USB on linux or windows machine, and those terminal commands should work)

Od do you have any ideas how to design this problem?

can you please guys recommend me some literature, or materials to read?

Thank you very much.

Alef

+1  A: 

The simple and short answer is "you don't."

The more complex, long answer is that it can be done, but the amount of work required is likely to be way more expensive than the value and an alternate should be looked at (e.g. if you have any mechanism for a network interface, use a socket).

For the USB side you have to understand how USB works, at least in general terms. When you plug that device into the PC, the PC needs to have a driver that understands how to communicate with the device. The device, at the same time, needs to have a driver that understands how to talk to the PC. These drivers need to understand how each other work so they can effectively communicate.

When you use ActiveSync, what happens (with the older 4.2 stuff) is that ActiveSync on the PC has a serial over USB driver, so when you plug in your device, the PC says "hey, this looks like a serial device" and the ActiveSync itself does a PPP over serial connection using that serial layer. Down on the device, when the connection is made, a driver that the OEM put in (usbser.dll to be specific) fires up and negotiates with the PC then fires up ActiveSync's device client with finishes creating that network. Done and done. Newer devices use a similar mechanism but typically use RNDIS instead of serial over USB becasue PCs ship with ENDIS upport and it's more robust and faster.

Now that you want to remove ActiveSync, you have to provide those drivers - for both ends. The path of least resistance is probably to use HID. At least this way the PC-side is done (it's the same protocol a mouse uses, so any PC, be it Windows or Linux, that understands a USB mouse will have the driver for this). You still would have to write the HID driver for the device. Once you have that, you can then write an app for each end to use that USB pipe to communicate.

Of course all of this is going to also require that you deploy your driver(s) to the device and possibly PCs.

ctacke
A: 

It would be difficult to build a USB serial link between the device and a PC. For a Windows Platform you could use RAPI as a work around. The device would connect to a PC through ActiveSync. Then using RAPI you can (among others), read the registry of the remote device, start the execution of an application in the device, transfer files between the two.

I suppose that if you don't want real-time transfer of data this will work. For Linux, I don't know if there is a RAPI SDK available. In Windows you could use OpenNetCF's RAPI SDK, which will make your life a lot easier.

kgiannakakis