USB Port

Please suggest me how can I write applications for USB and Irda drivers. How can I open the USB/Irda ports, and read/write to/from the ports.



Answer this question

USB Port

  • Mike Prilliman

    Hi,

    O'K. This with RAPI was only example that ActiveSync connection and Bluethooth are two different things. It was not proposal for

    solution. My proposal is to look for alternative ideas in Win Mobile security model for communication API, not to mess with

    interfaces. I mean, to re-think solution according MS security model - for example - to set settings so that bluetooth to use max

    level of PIN in connections( in the beginig, for idea, look at BTH_SOCKOPT_SECURITY struct).

    Despite of that, if you want to use core radio interfaces it needs to have Platform builder 5.0( for Win mobile 5.0). In case of bluetooth

    you have to be sure that understands ones like Bluetoth stack architecture. For physical access see HCI_xxx transport layer( for

    example HCI_StartHardware starts bluetooth hardware). If it's not suits you, you could look in OBEX model and related COM

    classes.

    USB is more complicated than Bluetooth. Information about interfaces are set in USB_DEVICE struct from

    LPGET_DEVICE_INFO pointrer to function. For more detailed description of USB Interfaces look for structs USB_DEVICE,

    USB_CONFIGURATION... For USB status you can use LPGET_STATUS pointer to function. Note that you need

    Platform Builder 5.0, as well.

    Finaly, note that there isn't general solution for different communication protocols. That's why I gave example with ActiveSync.

    Good Luck. Solution is in your hands.


  • Pooja Katiyar

    Hi,

    I am not absolutely sure, but I suppose that if you keep open all time USB/irda/wifi/bluetooth connections, it would lead you to

    batery power disaster. Nonetheless, do not mix usb interface with bluetooth or wifi, for example. They are different types of interfaces

    that use different adapters for communication. Only general thing is that all radiomodems can be accessed through COM ports.

    According to ActiveSync, in RAPI has enum RAPI_CONNECTIONTYPE defined like this:

    typedef enum {
    RAPI_CONNECTION_USB = 0
    RAPI_CONNECTION_IR
    = 1
    RAPI_CONNECTION_SERIAL
    = 2
    RAPI_CONNECTION_NETWORK
    = 3
    } RAPI_CONNECTIONTYPE;

    You can see that there isn't neither bluetooth, wifi nor radio.

    Acording to your problem, I suggest you to look for solutions at security setting in Win Mobile , rather than in such ideas.

    Good luck!


  • Aleniko29139

    Thanks for the reply and suggestions.

    I know, if I open all the ports battery is going to over very soon,but I thought I don't have any options. I looked into the RAPIs suggested by you, I think the RAPI is mostly used for developing applications running on Desktop rather on the device. Though I found some stuctures for Pocket PC/ smart phone but I could not find the function interface for the same.

    Is there any Interface set which can give me the status of all these devices, or how can I make use of RAPI to develop application within the pocket PC/ not on the Desktop to check the status of the devices

     

     


  • Brad3000

    Hi,

    I don't know what exactly you want to do with IR and bluethooth, but I suppose that OBEX (Object Exchange) API will be sufficient. It is very well described in MSDN (and recomended) . But If you determined to 'open/close USB/Irda ports' you have to deal with Virtual COMs. About Bluethooth you have deal with Bluetooth Protocol Stack. (hint look in MSDN for Bluetooth Protocol Stack and PORTEMUPortParams structure to specify attributes for the virtual COM port).In case of IR Win Ce has IR stack. In both cases you have to deal with a lot of stuff as RFcomm numbers, remote device name,channels numbers and etc. After obtaining this data you have to open serial connection and Read/Write data. And finaly close it, of cource. It is very well documented in MSDN, as well.

    Good luck!


  • Evan Hennis

    Hello experts,

    I am newbee, that's why trying to put each my leg on different boat of different direction,

    Let me focus on USB only for the time being.  .

    I am writing security application, which when executed on pocket pc all the external interfaces such as USB/irda/wifi/bluetooth should be disabled. So I thought when I excute my application, I will keep these ports open so that other applications such as ActiveSync, 3rd Party applications should not be able to open these ports again to access the pocket pc while my application is running.

    If this works, I need to know, How to open my USB Interface ( Pocket PC shows it is accessable at  [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]) and how to check it's status, how to lock it so that it can not be accessed from external interfaces.

    Please suggest me.

    Thanks

    WP


  • USB Port