Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Text from Girder to a Rssound CAV 6.6 UNO-S2 Keypads

  1. #1

    Default Text from Girder to a Rssound CAV 6.6 UNO-S2 Keypads

    Alright I am almost done with everything for my multi room sound system. I only have one thing left to setup. I have tested and made sure it worked and now I just have to figure out how to make it streamlined.

    I have a russound CAV 6.6 with UNO-S2 keypads and I am trying to figure out how I can send text to them. Here is my setup:

    The songs will be played in three copies of winamp. I would like each of these copies of winamp to display their current song to a specific keypads that are set to its specific source. This is the best way I can think about designing it:

    Identify the copies of winamp using the target feature under different class names. Then the current playing song is taken from winamp. Next girder checks all keypads for their current source. It gets that info and matches it to the right copy of winamp via set source/class name associations and sends that text to only those keypads. Then it monitors for a source change command from any keypads and then changes that keypad to the correct text output of winamp.

    Then I am also using event.exe to send commands to girder. I would like to send an event like playlist up and then send the text of that selected playlist along with the zone the software is currently in. I imagine the best way to do this would be to include it in the playload of the event command. Then I would need girder to strip off the different payload info and use it to send to the correct keypad.

    Also even though there is a russound plugin for this device I don’t think there is a send text command in it. So I have figured out a way to send the text through the “serial send” command. I have actually tested this out and it works great. Here is what I will need to do to send the text:

    8.2 On A Specific Keypad
    The following example shows how to display a text message on a Specific Keypad in the system.
    This is accomplished by setting the Target Device ID for the particular keypad in question.
    Byte # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    Value F0 cc zz kk 00 00 70 00 02 01 01 00 00 00 01 00 10 00 ## ## ## ## ## ##
    Byte # 25 26 27 28 29 30 31 32 33 34 35 36
    Value ## ## ## ## ## ## ## ## ## ## xx F7
    cc = Controller Number -1
    zz = Zone Number -1
    kk = Keypad Number -1
    xx = Checksum
    Byte #19 = Alignment (0x00 = Centered, 0x01 = Left justified)
    Byte #20 = Low Byte of Flash Time
    Byte #21 = High Byte of Flash Time
    Byte #22 – #34 = ASCII text characters (Section 11 ASCII Character Set)

    Basically the only Bytes that are going to change here is the zone number, the checksum, and the ascii text. This script will have to send out a separate serial send command for each keypad that has that source selected. Because you can’t send to more than one keypad at once. Then the send command will also have to be sent every time the song changes and every time the playlist up or down button is pressed. Also the text will have to be converted hex though I am not sure if there is a feature for that in girder. Finally the last thing that changes is the checksum. This will have to be calculated with every new text message. Here is explanation of how this is calculated:

    4.3.1 Checksum
    All messages include a Checksum that helps protect the integrity of the message. The
    Checksum is a single byte that can be calculated using the following formula (see example
    below):

    Checksum Calculation Example:

    Value (Hex) Notes
    F0 Start of Message Character
    00
    67
    7C
    F1
    0F
    59 Checksum
    F7 End of Message Character

    Step #1 - Add the HEX value of every byte in the message that precedes the Checksum:
    Example - 0xF0 + 0x00 + 0x67 + 0x7C + 0xF1 + 0x0F = 0x02D3

    Step #2 - Count the number of bytes which precede the Checksum and convert that value from
    DEC to HEX (byte count). Add the byte count in HEX to the previously calculated sum of
    bytes:

    Example - 0x02D3 + 6 (6 = Decimal value byte count) = 0x02D9 12

    Step #3 - This value is then AND-ed with the HEX value 0x007F (7F is the highest BIN value
    for 7 bits = 1111111). The Checksum itself and the End of Message Character are not
    included in the calculation. Only the low 7 bits are used so overflow is discarded:

    Example - 0x02D9 AND 0x007F = 0x59 = Checksum

    Here is a script that was already made for this but I couldn’t get it to work in girder 4


    Code:
    -- takes a string of hex bytes as input
    CheckSum = function ( StringValue )
        local Answer = 0
        -- make sure the string is even length
        if ( band( strlen( StringValue ), 1 ) == 1 ) then
            -- not even length, add a 0 to the front of the string
            StringValue = "0"..StringValue
        end
        local i
        -- for each byte in the string (2 hex chars per byte)
        for i=0, ( strlen( StringValue ) /2 )-1 do
            -- add the byte and 1
            Answer = Answer + tonumber( strsub( StringValue,(i*2)+1,(i*2)+2 ), 16 ) + 1
        end
        -- make sure this is only 7 bits and turn into a string (return the same datatype we received)
        return format( "%2x", band( Answer, tonumber( "3f", 16 ) ) )
    end
    Finally here is a way to check which keypads have which source selected:

    local zoneinfo = RNET:GetZoneInfo (1,1)
    --first number is the controller id and the second is the zone number
    table.print (zoneinfo)

    The zone number would be the only thing changing here.

    I have some of the big pieces done but I am not any kind of scripting guru. So if anyone can provide any help in getting this accomplished it would be very appreciated.

    Thanks,
    ByMyHand

  2. #2

    Default

    Actually I found something else that would work better for this. I found another serial send command that will actually broadcast to all keypads set to a certain source. So now I won’t have to find out or monitor the source actions. The only other thing with this one is that the payload size will need to be calculated. This size is the equal to the number of hex bits you have in your ascii text. Then at the end a 00 will need to be added before the checksum.

    This example shows a Source Broadcast Display Feedback message with text "102.9 MHz FM".
    Byte # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    Value F0 7D 00 79 00 7D 00 00 02 01 01 02 01 01 00 00 01 00 14 00 10 00 00 31
    Byte # 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    Value 30 32 2E 39 20 4D 48 7A 20 46 4D 00 00 00 00 00 14 F7
    Byte #4 = Target Keypad ID (NOTE: A value of 0x79 in the Target Keypad ID field indicates
    that this message is a Source Broadcast Display Feedback message.)
    Byte #19 = Overall Payload Size
    Byte #21 = Message type and Source Number = (0x10 (Source Broadcast Display Type) bit-wise
    OR-ed with the source number (e.g. source 1 = 0x10, source 3 = 0x12))
    Byte #22 = Flash Time low byte (Flash time is in 10ms increments, 0x00 = Constant)
    Byte #23 = Flash Time high byte
    Bytes #24 – #40 = Text ("102.9 MHz FM")
    Byte #41 = Calculated Checksum

    Here is an easy cut and paste form:
    F07D0079007D00000201010201010000010014001000003130 322E39204D487A20464D000000000014F7


    ByMyHand

  3. #3
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Hi,

    Drop this in the plug/serial folder. note: you will need to delete this file once we update the plugin!!

    try

    RNETisplayKeypad (Controller,Zone,Keypad,Alignment,FlashTime,Text)


    RNETisplayAllKeypads (Alignment,FlashTime,Text)
    Attached Files Attached Files

  4. #4
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Hi,

    Drop this in the plug/serial folder. note: you will need to delete this file once we update the plugin!!

    try
    Code:
    RNET:DisplayKeypad (Controller,Zone,Keypad,Alignment,FlashTime,Text)
    
    
    RNET:DisplayAllKeypads (Alignment,FlashTime,Text)

  5. #5

    Default

    Wow! You are awesome! This works perfectly

    Here are some examples for everyone else:

    Code:
    RNET:DisplayKeypad (1,3,1,0,1000,'hello') 
    This sends the text to controller 1 zone(keypad) 3
    
    And this is an example of the multi zone one:
    
    RNET:DisplayAllKeypads (0,1000,'hello')
    This is very cool but I think the other one would be good a option to have available too because you can send to all keypads set to a certain source and you can output up to at least 28 charters where as these can only output up to 12 charters. This is the one I am talking about:

    This example shows a Source Broadcast Display Feedback message with text "102.9 MHz FM".
    Byte # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    Value F0 7D 00 79 00 7D 00 00 02 01 01 02 01 01 00 00 01 00 14 00 10 00 00 31
    Byte # 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    Value 30 32 2E 39 20 4D 48 7A 20 46 4D 00 00 00 00 00 14 F7
    Byte #4 = Target Keypad ID (NOTE: A value of 0x79 in the Target Keypad ID field indicates
    that this message is a Source Broadcast Display Feedback message.)
    Byte #19 = Overall Payload Size
    Byte #21 = Message type and Source Number = (0x10 (Source Broadcast Display Type) bit-wise
    OR-ed with the source number (e.g. source 1 = 0x10, source 3 = 0x12))
    Byte #22 = Flash Time low byte (Flash time is in 10ms increments, 0x00 = Constant)
    Byte #23 = Flash Time high byte
    Bytes #24 – #40 = Text ("102.9 MHz FM")
    Byte #41 = Calculated Checksum

    Just keep the target keypad ID 79 and set the variables as source, flash time, and text. It may require that you have a 00 at the end of the payload. Though I am not sure if that is calculated in the size of the payload.
    Last edited by bymyhand; June 18th, 2007 at 10:03 PM.

  6. #6

    Default

    Alright I did some work on this but I will need your help for one part. I have setup the display by source and after testing it out I found that it can support up to 38 charters. Since if you send less then that it will still work correctly, I have set the payload size Byte and text size to a static length. I have also set the variables as source, flash time, and text. The double zero at the end of the text is required to cut off the extra charters. The only thing that I am having problems with is the OR'ing of the source variable and 0x10. I tried bor and bxor but that didn't seem to give me the same result as the example. So I just used the real value for the source variable to test it out.

    Here is my code:

    Code:
        DisplaySourceKeypads = function(self,Source,FlashTime,Text)
            local DisplaySourceKeypads = {'7d','00','79','00','7d','00','00','02','01','01','02','01','01','00','00','01','00','27','00','SC','FL','FH','T1','T2','T3','T4','T5','T6','T7','T8','T9','T10','T11','T12','T13','T14','T15','T16','T17','T18','T19','T20','T21','T22','T23','T24','T25','T26','T27','T28','T29','T30','T31','T32','T33','T34','T35','T36','T37','T38','00'}
    
            local Params = {
                SC = Source,
                FL = math.band (FlashTime,255),
                FH = math.bshiftr (FlashTime,8),
            }
    
            for i = 1, 38 do
                Params ['T'..i] = string.byte (string.sub (Text,i,i)) or 0
            end
    
            self:SendMessageEx (DisplaySourceKeypads,Params)
        end,

    Also I fixed your code a bit. The text field of those two commands only support 12 Bytes. Also if you put in a text message that is more then 12 Bytes you start seeing errors on the screen as it scrolls. I stopped that by one limiting the amount of charters to 12 and also by adding the double zero at the end. Now no matter what the size of the text message it will only display the charters that will fit in the packet.

    Code:
        DisplayKeypad = function(self,Controller,Zone,Keypad,Alignment,FlashTime,Text)
            local DisplayKeypad = {'cc','zz','kk','00','00','70','00','02','01','01','00','00','00','01','00','10','00','AL','FL','FH','T1','T2','T3','T4','T5','T6','T7','T8','T9','T10','T11','T12','00'}
    
            local Params = {
                cc = Controller,
                zz = Zone,
                kk = Keypad,
                AL = Alignment,
                FL = math.band (FlashTime,255),
                FH = math.bshiftr (FlashTime,8),
            }
            
            for i = 1, 12 do
                Params ['T'..i] = string.byte (string.sub (Text,i,i)) or 0
            end
    
            self:SendMessageEx (DisplayKeypad,Params)
        end,
    
        
        DisplayAllKeypads = function(self,Alignment,FlashTime,Text)
            local DisplayAllKeypads = {'7f','00','00','00','00','70','00','02','01','01','00','00','00','01','00','10','00','AL','FL','FH','T1','T2','T3','T4','T5','T6','T7','T8','T9','T10','T11','T12','00'}
    
            local Params = {
                AL = Alignment,
                FL = math.band (FlashTime,255),
                FH = math.bshiftr (FlashTime,8),
            }
            
            for i = 1, 12 do
                Params ['T'..i] = string.byte (string.sub (Text,i,i)) or 0
            end
    
            self:SendMessageEx (DisplayAllKeypads,Params)
        end,
    Last edited by bymyhand; June 19th, 2007 at 02:03 AM.

  7. #7
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Great, would you post the .lua file when ready?

  8. #8

    Default

    Here you go. Could you help out with the source variable? Also there looks like to be a limitation on the flash time. It looks like the longest the device will display a text message is about 20 seconds. Though I am pretty sure that is a device limitation not the script.
    Attached Files Attached Files

  9. #9
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Quote Originally Posted by bymyhand View Post
    Wow! You are awesome! This works perfectly

    Here are some examples for everyone else:

    Code:
    RNET:DisplayKeypad (1,3,1,0,1000,'hello') 
    This sends the text to controller 1 zone(keypad) 3
    
    And this is an example of the multi zone one:
    
    RNET:DisplayAllKeypads (0,1000,'hello')
    This is very cool but I think the other one would be good a option to have available too because you can send to all keypads set to a certain source and you can output up to at least 28 charters where as these can only output up to 12 charters. This is the one I am talking about:

    This example shows a Source Broadcast Display Feedback message with text "102.9 MHz FM".
    Byte # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    Value F0 7D 00 79 00 7D 00 00 02 01 01 02 01 01 00 00 01 00 14 00 10 00 00 31
    Byte # 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    Value 30 32 2E 39 20 4D 48 7A 20 46 4D 00 00 00 00 00 14 F7
    Byte #4 = Target Keypad ID (NOTE: A value of 0x79 in the Target Keypad ID field indicates
    that this message is a Source Broadcast Display Feedback message.)
    Byte #19 = Overall Payload Size
    Byte #21 = Message type and Source Number = (0x10 (Source Broadcast Display Type) bit-wise
    OR-ed with the source number (e.g. source 1 = 0x10, source 3 = 0x12))
    Byte #22 = Flash Time low byte (Flash time is in 10ms increments, 0x00 = Constant)
    Byte #23 = Flash Time high byte
    Bytes #24 – #40 = Text ("102.9 MHz FM")
    Byte #41 = Calculated Checksum

    Just keep the target keypad ID 79 and set the variables as source, flash time, and text. It may require that you have a 00 at the end of the payload. Though I am not sure if that is calculated in the size of the payload.

    As far as I can tell or find out, the text lengths are either 12 or 16 characters. If you have a PDF showing different, please post it.

  10. #10

    Default

    Well I tested it out and I got up to 38 charters with doing it that way. That was in there with the code I sent you. You can see for yourself by doing this with that lua file I posted:

    Code:
    RNET:DisplaySourceKeypads (Source,FlashTime,Text)
    Since I don’t have it all working just make sure you put in the real source

    IE:
    10 = source 1
    11 = source 2
    12 = source 3
    Etc..

    That’s what I setup. The reason that you can have so many more charters is because you calculate and send the payload size. You tell the device how many charters to expect. This way you’re not stuck with 12 charters like the other two commands that don't have a payload calculation.

    What I did in the code I sent was I set the payload size and text size to its max. Which is 38 charters. That’s why you see a 27 in there. That’s 39 in decimal. 38 for the text and 1 Byte for the null charter, which is discussed here:

    “Null character” – A value of 0x00 used as a Data byte will be a text character of Null. A Null
    text character is always used after the last text character in the display string. With a 12
    character text message you would use a Null character as the 13th text character. A Null
    character is also used for each unused text character at the end of the text display message if the
    maximum number of Data bytes are not all used.

    I just tried to make this as simple as possible because you can just enter a smaller amount of text and it will, I guess, add zeros for the rest of the spaces and still display correctly.

    You are right, I have not positively found out if 38 is the real number but all I can say is that I tested it and it worked up to 38 charters. after that it just cut everything else off. I tried adding more null charters and other things but it didn't seem to make any difference.

    Again even though I asked for this to be done I have basically already created the code by editing what you already had. I just needed help with the source variable. Here it is again.

    Code:
        DisplaySourceKeypads = function(self,Source,FlashTime,Text)
            local DisplaySourceKeypads = {'7d','00','79','00','7d','00','00','02','01','01','02','01','01','00','00','01','00','2A','00','SC','FL','FH','T1','T2','T3','T4','T5','T6','T7','T8','T9','T10','T11','T12','T13','T14','T15','T16','T17','T18','T19','T20','T21','T22','T23','T24','T25','T26','T27','T28','T29','T30','T31','T32','T33','T34','T35','T36','T37','T38','00'}
    
            local Params = {
    	    SC = Source,
                FL = math.band (FlashTime,255),
                FH = math.bshiftr (FlashTime,8),
            }
    
            for i = 1, 38 do
                Params ['T'..i] = string.byte (string.sub (Text,i,i)) or 0
            end
    
            self:SendMessageEx (DisplaySourceKeypads,Params)
        end,
    Just a final note after looking at the document again, which I posted in case you don’t have it, it seems like I calculated the payload size incorrectly. It seems to be calculated from Byte 21 onwards. So my payload size should actually be 39 + 3 (settings) Bytes. Which would equal 2A. I tried this out and it still gave me the same results. Still worked great up to 38 charters still cut off everything after that.

    ByMyHand
    Attached Files Attached Files

Page 1 of 3 123 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
  •