infrared!

Hi.
I want to be able to send data (hex codes or whatever) using the infrared ports.
I have imported the System.Net.Irda reference and able to access the IR classes.

However, I do not wish to connect to a device but rather send data. The device I am sending data to will be a dumb device really, just as a "reciever"... this can be a remote control recieving box or a TV IR reciever for example.

IS it possible to do this how I cannot seem to find a way in the .NET classes as it seems you have to connect to the destination then write data to the stream.

Thanks!




Answer this question

infrared!

  • R.Tutus

    Thanks for that, i will give it a shot and see what happens if i send data using that connection socket.

     

    What do you mean/need to know about ProtocolType :)



  • GlennM2

    I think you need to seperate out the logical and physical protocol layers.
    Irda is just a serial port. Wifi is just Ethernet that can, for example, transmit TCP/IP packets.
    If you want to talk to a device, you will need to understand the logical protocol as well. For example, what the packet structure is. If you send out a byte of 1, then the other device will do something. If you send out a byte of 2 it will do something else. Once the logical protocol is sorted out, then the physical transport could be anything. As I said in my previous post there are many IP->IR pieces of hardware on the market to translate the physical protocols.
    .net has many classes to talk to many different physical protocols, including Serial, TCP, UDP and Irda.

    Perhaps if you replied with what problem you are trying to solve, then we could give you the solution that you are looking for.

  • Jutsin Leung

    Have you guys seen this

    http://www.codeproject.com/ce/TVRemote.asp

    It's a C++ example of Pocket PC remote control for Sony tv. Seems pretty specific to that device though (timing wise).


  • mkfl

    You will not be able to communicate with a TV IR receiver through your standard computer's Irda port as they have different frequencies and range.

    You will require something like an IP->IR Controller box for communicating with consumer IR devices such as TVs, VCRs, Hifi, DVD players etc. etc. There are quite a few boxes out there that do this, but it depends on your price point and your application.

    Hope this helps.


  • BadFog

    I was working on conversion of the above article to C#, but eventually found that .NET framework was just too slow for some of the time-sensitive operations. For example, to send one byte out of the IR port would take me at least 1ms, whereas I needed it to be no longer than 0.5ms. I ended up going to embedded C++.

    If your IR code timing is in the ms, it is fairly straight forward to translate the C++ code in the article to C# by using P/Invokes and the like.


  • Terence Tung

    I thought so, thanks David :)

    what about Wifi obviously if the phone has (mobile device) wifi support... is there a .NET class that allows me to use wifi features such as connecting to a non PC device (like a reciever) and sending signals to it

    of course logic would be to scan for a wireless device.
    once found connect to it
    send messages to the device

    possible

  • KrishnaUNISYS

    I found onne thing that can help you. I tried to find something on your question, because i also want to use ny pocket pc to switch channels but not using third-party applications =), but can't find anything except this topic.

    So, if you declare

    Socket theSock = new Socket(AddressFamily.Irda, SocketType.Stream, ProtocolType.Unspecified);

    you will have a connection-based socket, and you need a listener on Tv-set, and this is impossible.

    Other way, if you declare socket as

    Socket theSock = new Socket(AddressFamily.Irda, SocketType.Rdm, ProtocolType.Unknown);

    You have connectionless socket, so you can send and recieve data without connecting to remote device.

    But one problem i have is that i don't know proper ProtocolType... Maybe you can elp me


  • Aleniko29139

    Thanks, i will check that out and get back if i need any more Q's answered.... :)

  • LpAngelRob

    i have seen that but far too complicated

  • Kunk

    Thanks!
    Yes I understand about different interfaces use different protocols etc...

    I really just want to make an application that can send out signals using IR to, lets say a TV so I can change a channel, put up the volume and so on...

    That is the problem.

    in .NET I cannot just send out data as it needs to connect to a server/listener in order to establish communication and send data.

    I could not find another way in .NET to do what I am doing but I will look into the IP -> IR devices.

    I have the codes to send/fire off to change a tv channel etc... for my TV BUT i need to send those codes via IR from the mobile device to the TV and cannot find a way to do this Smile

  • kgs1951

    update - i tried that, didnt work :(

    "The support for the dpecified socket type does not exist in this address family" -



  • pchan3

    Sounds like you need Stardraw Control:

    http://www.stardraw.com/Products/StardrawControl

    In particular, have a look at the How To movies:

    http://www.stardraw.com/products/stardrawcontrol/technical.asp

  • Tovdb

    *bump*

    would like to know if it is possible to make an app to still send signals across using IR but not connecting to a PC.... using either .NET or some other means

  • ___anshu

    stepping aside from the starcontrol....

    I have found a way of making a socket object which includes IR.



    Socket theSock = new Socket(AddressFamily.Irda, SocketType.Stream, ProtocolType.Unspecified);

     


    That's all well.
    but now i need to connect to a "dumb" device (in other words, not to a computer and not to a device that responds back).

    theSock.Connect(); tells me it needs an IPEndPoint parameter....



    IPEndPoint something = new IPEndPoint(IPAddress.None, 0);

     


    but when I do this:



    theSock.Connect(something);

     


    I get an error and do not know what other way there is to connect to a device that has no port or IP Address.

     The system detected an invalid pointer address in attempting to use a pointer argument in a call


    Any ideas

  • infrared!