Hello,

How do I set up attributes for an IrDA device. I am trying to use
IrDA:IrCOMM as 9 Wire cooked.

I am using the following code:

private void Send_Click(object sender, System.EventArgs e)
{
try
{
irEndP = new IrDAEndPoint(irDevices[DeviceID].DeviceID,
"IrDA:IrCOMM");
irClient = new IrDAClient( irEndP );
}
catch( SocketException exS )
{
MessageBox.Show( "Create socket error: " + exS.Message );
return;
}

// Get the underlying stream of the client.
Stream irStream = irClient.GetStream();

irStream.Write( stringToByteArray(textBox1.Text), 0, textBox1.Text.Length );

// Display the number of bytes being sent.
statusBar1.Text = "Sending " + textBox1.Text.Length + " bytes";

irStream.Flush();
irStream.Close();
irClient.Close();
}

where irDevices[DeviceID].DeviceID is a previously discovered IrDA device

Thanks

Steve

RE: setting IrDA Attributes by alanjmcf

alanjmcf
Sat Nov 13 14:22:02 CST 2004

"Steve Spencer" wrote:
> How do I set up attributes for an IrDA device. I am trying to use
> IrDA:IrCOMM as 9 Wire cooked.
>
> I am using the following code:
> irEndP = new IrDAEndPoint(irDevices[DeviceID].DeviceID,
> "IrDA:IrCOMM");
> irClient = new IrDAClient( irEndP );
[...]
Unfortunately Steve, there appears to be no way to select Cooked-mode IrCOMM
for IrDA connections in the Compact Framework. Bit of an omission
Microsoft... :-(

So you'll have to use native code. Or else use the IrCOMM Virtual COM Port
(assuming there is one). You lose some controllability that way: selection
of peers etc.

RE: setting IrDA Attributes by SteveSpencer

SteveSpencer
Mon Nov 15 10:08:01 CST 2004

Alan,

thanks for this, you have confirmed my own thoughts.

> So you'll have to use native code.
OK, Do you have any sample code that I could follow? Ideally I would like to
have everything as .NET so if you have any examples of this using PInvoke
that would be useful.

Unfortunately, we can only run in IrCOMM and 9pin cooked mode as we are
trying to use an Actisys IR100s serial to IR converter connected to the RS232
port of the hardware device we are trying to communicate with.

Regards

Steve

RE: setting IrDA Attributes by alanjmcf

alanjmcf
Wed Nov 17 10:28:06 CST 2004

"Steve Spencer" wrote:
> thanks for this, you have confirmed my own thoughts.
>
> > So you'll have to use native code.
> OK, Do you have any sample code that I could follow? Ideally I would like to
> have everything as .NET so if you have any examples of this using PInvoke
> that would be useful.
>
My expertise is only in the use of IrDA, and in particular on desktop
Windows, so others may have more useful help here...

Anyway see my programming reference for the complete details of IrDA through
Winsock, at
<http://www.alanjmcf.me.uk/comms/infrared/Microsoft%20Windows%20IrDA%20programming.html>,
sections 3.2, 4.9.3, etc. In short, use setsockopt with option
IRLMP_9WIRE_MODE to set Cooked mode. However that probably takes you deeply
into the native world...

It would be nice if some company would create an 'object' to use with .Net
that provides IrCOMM and IrLPT connectivity...


Also I'll note again, in case you missed it the first time, that there's
normally an IrCOMM Virtual COM Port present on PocketPC. One just uses it
like a normal serial port but it uses IrCOMM to talk to an IrDA peer; it does
all the discovery etc automatically. See
<http://msdn.microsoft.com/library/en-us/wceseril/html/cmconircomm.asp> etc.
I presume one can use it fine from .Net.


> Unfortunately, we can only run in IrCOMM and 9pin cooked mode as we are
> trying to use an Actisys IR100s serial to IR converter connected to the RS232
> port of the hardware device we are trying to communicate with.
>
Yup, its maybe a bit of a shame that the device can't be set to listen on a
bog-standard (non-IrCOMM) TinyTP socket. :-(
--
Alan J. McFarlane
http://www.alanjmcf.me.uk/
Please follow-up in the newsgroup for the benefit of all.

RE: setting IrDA Attributes by SteveSpencer

SteveSpencer
Mon Nov 22 09:09:04 CST 2004

Alan,

Thanks for this. I can now access the IR port using the virutal com port. In
fact it makes my code easier because I can now access both Bluetooth and IR
using serial communications on .NET CF.

Cheers

Steve

"Alan J. McFarlane" wrote:

> "Steve Spencer" wrote:
> > thanks for this, you have confirmed my own thoughts.
> >
> > > So you'll have to use native code.
> > OK, Do you have any sample code that I could follow? Ideally I would like to
> > have everything as .NET so if you have any examples of this using PInvoke
> > that would be useful.
> >
> My expertise is only in the use of IrDA, and in particular on desktop
> Windows, so others may have more useful help here...
>
> Anyway see my programming reference for the complete details of IrDA through
> Winsock, at
> <http://www.alanjmcf.me.uk/comms/infrared/Microsoft%20Windows%20IrDA%20programming.html>,
> sections 3.2, 4.9.3, etc. In short, use setsockopt with option
> IRLMP_9WIRE_MODE to set Cooked mode. However that probably takes you deeply
> into the native world...
>
> It would be nice if some company would create an 'object' to use with .Net
> that provides IrCOMM and IrLPT connectivity...
>
>
> Also I'll note again, in case you missed it the first time, that there's
> normally an IrCOMM Virtual COM Port present on PocketPC. One just uses it
> like a normal serial port but it uses IrCOMM to talk to an IrDA peer; it does
> all the discovery etc automatically. See
> <http://msdn.microsoft.com/library/en-us/wceseril/html/cmconircomm.asp> etc.
> I presume one can use it fine from .Net.
>
>
> > Unfortunately, we can only run in IrCOMM and 9pin cooked mode as we are
> > trying to use an Actisys IR100s serial to IR converter connected to the RS232
> > port of the hardware device we are trying to communicate with.
> >
> Yup, its maybe a bit of a shame that the device can't be set to listen on a
> bog-standard (non-IrCOMM) TinyTP socket. :-(
> --
> Alan J. McFarlane
> http://www.alanjmcf.me.uk/
> Please follow-up in the newsgroup for the benefit of all.

RE: setting IrDA Attributes, 9-wire cooked mode, virtual COM port by Nick

Nick
Sun Jul 03 09:14:01 CDT 2005

Did you get this to work?
I need to talk to a Microchip MCP215X which supports IRCOMM and "9-wire
cooked mode" so, having read this thread, I tried the virtual COM port:
however I'm still not getting anything past the chip.
Cheers
Nick



"Steve Spencer" wrote:

> Alan,
>
> Thanks for this. I can now access the IR port using the virutal com port. In
> fact it makes my code easier because I can now access both Bluetooth and IR
> using serial communications on .NET CF.
>
> Cheers
>
> Steve
>
> "Alan J. McFarlane" wrote:
> ...


RE: setting IrDA Attributes, 9-wire cooked mode, virtual COM port by SteveSpencer

SteveSpencer
Mon Jul 04 02:27:01 CDT 2005

Nick,

I did get the virtual com port working. On my PDA I found the com port that
is associated with the IR and used the OpenNetCF SmartDevice Framework
(http://www.opennetcf.org/) to open the com port as you would for a standard
RS232 connection. Unfortunately I have not got any further with IR as we
decided it wasn't suitable for our application.

Steve

"Nick Ajderian" wrote:

> Did you get this to work?
> I need to talk to a Microchip MCP215X which supports IRCOMM and "9-wire
> cooked mode" so, having read this thread, I tried the virtual COM port:
> however I'm still not getting anything past the chip.
> Cheers
> Nick
>
>
>
> "Steve Spencer" wrote:
>
> > Alan,
> >
> > Thanks for this. I can now access the IR port using the virutal com port. In
> > fact it makes my code easier because I can now access both Bluetooth and IR
> > using serial communications on .NET CF.
> >
> > Cheers
> >
> > Steve
> >
> > "Alan J. McFarlane" wrote:
> > ...
>

RE: setting IrDA Attributes, 9-wire cooked mode, virtual COM port by NickAjderian

NickAjderian
Tue Jul 05 02:07:49 CDT 2005

Thanks, Steve, but did you manage to write anything to the virtual COM Port
(and, more to the point, did the hardware see what you wrote)? After reading
your post I tried this (using Output=ByteArray) but the hardware is receiving
what I think I'm sending.
If you did manage to write then could you possibly post the settings you
used for the OpenNETCF.IO.Serial.Port? Or did you discard all your work on
this project in disgust?

"Steve Spencer" wrote:

> Nick,
>
> I did get the virtual com port working. On my PDA I found the com port that
> is associated with the IR and used the OpenNetCF SmartDevice Framework
> (http://www.opennetcf.org/) to open the com port as you would for a standard
> RS232 connection. Unfortunately I have not got any further with IR as we
> decided it wasn't suitable for our application.
>
> Steve
>
> "Nick Ajderian" wrote:
> ...