USB Port  
Author Message
Nody Online





PostPosted: Visual C# Language, USB Port Top

Hi

I am developing a program and I need to send data using USB port , but I could not find a class as the one for Serial Port to use it to transfer data.

So I searched on the Net for any USB class but I didn't find.

Can anyone help




Visual C#6  
 
 
Figo Fei - MSFT





PostPosted: Visual C# Language, USB Port Top

Hi, SamuraiJack

This thread is on the topic: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=588602&SiteID=1

Thank you



 
 
Nestos





PostPosted: Visual C# Language, USB Port Top

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!


 
 
danych





PostPosted: Visual C# Language, USB Port Top

I am not a professional, but i have been doing some readings about USB and i can share what i know with you.

First, .NET does not yet have an embedded class or control as the serial class.

I have found some class that can communicate with a PIC USB microcontroller, if you're intrested send me ur email address.



 
 
SamuraiJack





PostPosted: Visual C# Language, USB Port Top

Isn't there an API for such thing

 
 
Windows Project





PostPosted: Visual C# Language, USB Port Top

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


 
 
Nestos





PostPosted: Visual C# Language, USB Port Top

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!


 
 
Figo Fei - MSFT





PostPosted: Visual C# Language, USB Port Top

Hi,

What do you exactly want to do with usb Could you be more specific

Thanks



 
 
SamuraiJack





PostPosted: Visual C# Language, USB Port Top

I have a CellPhone (Let's say Nokia) i want to send it a message from my Pc Through the USB port and it send it automaticaly to a specified number.
 
 
Windows Project





PostPosted: Visual C# Language, USB Port Top

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

 

 


 
 
Nestos





PostPosted: Visual C# Language, USB Port Top

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.


 
 
Figo Fei - MSFT





PostPosted: Visual C# Language, USB Port Top

Hi,

If your cell phone has intalled windows CE, you can use Microsoft ActiveSync.

Otherwise, you must contact your cell phone provider with this issue.

Thank you