Page 1 of 13 12311 ... LastLast
Results 1 to 10 of 125

Thread: creating a TCP/IP Transport

  1. #1
    Join Date
    Apr 2003
    Posts
    111

    Default creating a TCP/IP Transport

    I am working to create a Device Manager for Integra Receivers, working backwards from the Denon device manager. everything is currently 232 but I am curious about adding TCP/IP functionality.

    If i go into the transport and configure it for IP it says that it connects, but nothing sends or receives. the manual says that the TCP/IP transport function are:

    Code:
     num, err = [transport]:Open( [url], [port number] )
    but where does this go?
    Last edited by 28seven; January 15th, 2009 at 06:07 PM.

  2. #2
    Join Date
    Apr 2003
    Posts
    111

    Default

    playing around with it a bit more now, I am getting events from the receiver but it seems that there is a different header on the commands then the RS232 protocol.

    so i guess the question is now how do i setup a header that is only sent when connected TCP/IP

    the protocol is linked below
    http://freenet-homepage.de/Messiahs/...nkyo/onkyo.xls

  3. #3
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    I am not concinved that starting with the denon code is the best approach,.. it's quite complicated for your first transport. Shall we start from a clean slate?
    Ron
    No support through PM

  4. #4
    Join Date
    Apr 2003
    Posts
    111

    Default

    im all for doing it the right way.

  5. #5
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    Looking at the protocol it appears that it is always 'CR' terminated for both serial and TCP/IP sadly the value of 'CR' 0x0D might appear in the DataSize field of the TCP/IP header. So technically we could not use the terminated transport. However I think we should try. The reason being that calling lua on each reached character is too much of a CPU hog.

    So I think we should use the terminated parser with CR as the terminator. And then detect if we received a full or partial packet. If we receive a partial packet hold the data and then merge it once the rest comes in.

    Sound fair?
    Ron
    No support through PM

  6. #6
    Join Date
    Apr 2003
    Posts
    111

    Default

    ok so i have taken a step back and am now trying to use tutorial 1 as my basis.

    are you saying all in my OnBuildCommand my return should be 'CR'? when i was using the denon transport i had it working with '1a'. in the protocol it says that it should be '0D'

    with tutorial 1 when i send a command it does not show up in the lua console, it just sends back a "no response to last send"

    what am i doing wrong here

  7. #7
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    Here is the tricky part of this device. It expects commands sent to it to be terminated by 0x0D BUT the response it sends is terminated by 0x1A.

    Code:
    {
     Transport={
     Post={
     NoResponseTimeout=2000,
     },
     },
     Parser={
     Type=constants.parser.TERMINATED,
     Terminator=string.char(26), -- 0x1a
    
     Timeout=1500,
     },
     }, 
    
    and buildcommand should be

    Code:
    returndata..string.char(13)
    first let me ask this, are you suing the serial or tcp/ip version currently?
    Last edited by Ron; January 16th, 2009 at 01:45 PM. Reason: byte -> char
    Ron
    No support through PM

  8. #8
    Join Date
    Apr 2003
    Posts
    111

    Default

    i would rather get tcp/ip going first because that will work in all situations. but if it is more difficult then starting with serial is fine

  9. #9
    Join Date
    Apr 2003
    Posts
    111

    Default

    it doesent seem to like the string

    Code:
    ...is\Girder5\luascript\transport/devices/tutorial4.lua:23: attempt to index global `string' (a nil value)
    stack traceback:
        ...is\Girder5\luascript\transport/devices/tutorial4.lua:23: in function `init'
        ...ram Files\Promixis\Girder5\\luascript\compat-5.1.lua:195: in function `require'
        ...is\Girder5\luascript\components\TransportManager.lua:343: in function `ReadTransportClassFile'
        ...is\Girder5\luascript\components\TransportManager.lua:269: in function `LoadTransportClasses'
        ...is\Girder5\luascript\components\TransportManager.lua:302: in function `LoadSerialClasses'
        ...is\Girder5\luascript\components\TransportManager.lua:111: in function `LuaStateIsReady'
        ...iles\Promixis\Girder5\luascript\ComponentManager.lua:676: in function `StartEnabledComponents'
        ...iles\Promixis\Girder5\luascript\ComponentManager.lua:229: in function <...iles\Promixis\Girder5\luascript\ComponentManager.lua:228>
        [C]: ?
        ...iles\Promixis\Girder5\luascript\ComponentManager.lua:228: in function <...iles\Promixis\Girder5\luascript\ComponentManager.lua:227>

  10. #10
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,553

    Default

    It's a bit more tricky but we can do it!

    Let's start from the same point. I've modified tutorial 1 for you. Of course since I do not have this amp this is untested code...
    Attached Files Attached Files
    Ron
    No support through PM

Page 1 of 13 12311 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •