Results 1 to 10 of 10

Thread: Serial transport - receive parsing and ID'ing

  1. #1
    Join Date
    Apr 2003
    Posts
    111

    Default Serial transport - receive parsing and ID'ing

    i made a basic transport that works with key digtial brand switchers. im still kind of slow with the lua so i have a few questions.

    problem 1: the protocol is designed to work on a serial bus with more then one device so each device gets an id. the ID functions as the CR and prefix for the send commands. right now i have it hard coded into the transport, but this limits me to only one device. how can i fill these with a variable that can be filled in later.

    problem 2: parsing the received data, the switch i am working with is a 8x4 matrix. the return comes in "UU2881" each number shows the input that the output is one 2 means output 1 is showing input 2, 8 means output 2 is showing input 8 and so on. how can i get this parsed out?

    i know these are pretty basic but once i have this understanding i think i can start making these things with out questions each time.

    transport attached
    protocol http://www.keydigital.com/Owner%20Ma...nual_HIRES.pdf
    Attached Files Attached Files
    Last edited by 28seven; December 14th, 2009 at 06:07 PM.

  2. #2
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Can you remind me about this tomorrow - it's about time for bed so I won't be able to do this justice now.
    --Rob

  3. #3
    Join Date
    Apr 2003
    Posts
    111

    Default

    haha, no problem. no rush.

  4. #4
    Join Date
    Apr 2003
    Posts
    111

    Default

    i will be around the equipment in about three hours. does that work for you?

  5. #5
    Join Date
    Jun 2005
    Posts
    760

    Default

    For problem 2, parsing the received data, first store the return string in a Lua variable and then read Chapter 20 here. Section 20.3 has examples of the captures you are after and Section 20.2 explains the patterns.

    Sorry I don't fully understand your problem 1. Good Luck!

  6. #6
    Join Date
    Apr 2003
    Posts
    111

    Default

    thanks

    took me about 1/2 hour of rereading the same line but i got it. is this good/bad/terrible?

    Code:
    OnReceiveData = function(self, Event)
         recv = Event:GetData()
         print(recv)
         _, _, I1, I2, I3, I4 = string.find(recv, "UU(%d)(%d)(%d)(%d)")
         print(I1, I2, I3, I4)  
         end,
    output:
    Code:
    SEND 30 32 32 38
    RECEIVE 55 55 32 38 38 31 UU2881
    UU2881
    2 8 8 1

  7. #7
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    That all looks fine to me. Although you may want to make those local variables.

    Regarding part 1, you already have a method GetSettings ie

    Code:
        GetSettings = function ( self )        
            return table.copy(DefaultSettings[self.TransportType])
        end,
    You should be able to do what you want by changing the copied table's Parser.Terminator value to the Id of the device you want to talk to
    Last edited by Rob H; December 16th, 2009 at 09:24 AM.
    --Rob

  8. #8
    Join Date
    Apr 2003
    Posts
    111

    Default

    i see where you are going with this but i am not sure i can connect the dots.

    i think that in the long run having this a full DM device is the best option. i have a full macro that i would like to run on an input switch, fade out switch fade in. at that point i could just have a drop down box in DM with 01-20 and it can be ID'ed then.

    another thought would be joining the two switches in the profile, so that "input 9" (in 1 on switch 2) will automatically send the correct ID

    is there a place other then the manual that can walk me through the creation of a device manager device?

  9. #9
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    I seem to remember that someone else did a plugin and provider for a matrix switch, you could maybe search for 'matrix switch' here for the thread.
    --Rob

  10. #10
    Join Date
    Jan 2008
    Location
    Near some trees in Essex, UK
    Posts
    371

    Default

    This might help, its not DM - its the old fashioned way & a little on the clunky side but it works ok for me...

    Zip file http://www.promixis.com/download.php?ID=1045
    Thread http://www.promixis.com/forums/showthread.php?t=19114

Posting Permissions

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