rebuilding a string
PyroGuy
Posts: 121
Good day...
I am working with an 'old' PLB-AS16 audio router (which BTW, I think is a nicely featured box for us less than expert programmers)
We are doing some basic intercom with the unit and am looking for suggestions.
When user in any given room wants to call ALL the other rooms, they push the ALL button on the keypad (PLK-DMS - another nice little keypad) which simply routes the audio from the keypad mic, to all of the other rooms.
SEND_COMMAND vdvAS16,"'AI16O1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16'" (send input 16 to all outputs)
Of course you don't want to send the 'calling room' audio to itself so for the above case (calling from room 16) you need to drop the calling room from the string.
SEND_COMMAND vdvAS16,"'AI16O1,2,3,4,5,6,7,8,9,10,11,12,13,14,15'"
There must be a simple way to make that string a variable which can be chopped up to remove the calling room section so this will work for any room starting an intercom call.
I figure a bunch of concatenating, left_string, mid_string commands must do it, but I'm open for suggestions.
Basically, the task is to figure out what string is between the AI and the O (to discover the part to remove and then find it in the rest of the string- and remove it.
I figure I'm trying to make this WAY harder than it is.
Thanks!
I am working with an 'old' PLB-AS16 audio router (which BTW, I think is a nicely featured box for us less than expert programmers)
We are doing some basic intercom with the unit and am looking for suggestions.
When user in any given room wants to call ALL the other rooms, they push the ALL button on the keypad (PLK-DMS - another nice little keypad) which simply routes the audio from the keypad mic, to all of the other rooms.
SEND_COMMAND vdvAS16,"'AI16O1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16'" (send input 16 to all outputs)
Of course you don't want to send the 'calling room' audio to itself so for the above case (calling from room 16) you need to drop the calling room from the string.
SEND_COMMAND vdvAS16,"'AI16O1,2,3,4,5,6,7,8,9,10,11,12,13,14,15'"
There must be a simple way to make that string a variable which can be chopped up to remove the calling room section so this will work for any room starting an intercom call.
I figure a bunch of concatenating, left_string, mid_string commands must do it, but I'm open for suggestions.
Basically, the task is to figure out what string is between the AI and the O (to discover the part to remove and then find it in the rest of the string- and remove it.
I figure I'm trying to make this WAY harder than it is.
Thanks!
0
Comments
Removing a specific set of characters in a string is quite easy. I do it like so: This will remove 'AAA' from cSearchedString starting at the point it finds the first AAA. Repeat if necessary.
There is a function floating around (I'm not on my work computer) that is callsed STRING_REMOVE that is in a strings.axi posted on here somewhere. That'll do the trick as well.
So you use ' 16' as your string to remove since there is a '16' already in the string. Or you could do something like this, but you'll probably still need to remove the space.
This goes through all 16 outputs and makes a list, leaving out the initiating keypad.
You could do the same for page areas, ie: bedrooms, floor 2, etc... (quick code here)
SEND_COMMAND vdvAS16,"'AI',ITOA(CALL_ZONE),'O',LEFT_STRING(ZONE_LIST,(LENGTH_STRING(ZONE_LIST)-1))"
You'd have to keep track whether or not then if the last zone is two digits or just one. If you subtract the length by one and the last zone is 16, you'll wind up with 1 and not removing 16 completely.
There's no real one-liner way to do it so it seems. Just have to put some logic to it, but all the suggestions here are quite simple to implement.
I've edited the original reply to add the correct line in.
Kevin D.
Cheers All!
It does, however, support memorizing the current configuration. What I have done for paging is just that:
1) Memorize current settings
2) Activate the zones I want for the page
3) Send audio through
4) Restore saved settings
However, I wasn't using live pages, I was using WAV files to indicate the driveway sensor went off, or doorbell rang, or a=something of that nature. You would have to adjust accordingly; if delays are necessary for the saves and restores to take effect, you may have to throw up a pop-up indicating the user needs to hang on a few seconds while the system gets ready.
I'll be real honest about this though: I was relieved when AMX discontinued the old Phast AS matrixes. MY boss just loved them, and I hated trying to get them "just right" for a NetLinx system. They were better suited to the Landmark system than NetLinx by a long shot; I imagine because we can't talk directly to the hardware, but need to use a module as an interpreter. They are, simply put, way too sluggish, and have issues with dropping commands here and there. You never notice it when only doing one room at a time, but paging groups and audio scenes tend to make it stand out.