Converge Response Function
staticattic
Posts: 200
This is my first job dealing with Clearone devices via IP. In the past, I had always controlled Clearone devices serially and I have never had any problems. The problem I am having with IP is that I have to enter a username and password. In the DATA_EVENT for the Converge, I have this:
I don't like the FIND_STRING 'user' part. The WHILE loop is what I have always used and never had issues. So, I just modified it a little for the user and password info. Here is the section of my function handling the password portion:
STRING: { IF(FIND_STRING(cConverge_Buff,'user:',1)) { SEND_STRING dvConverge,"'clearone',13" } WHILE(FIND_STRING(cConverge_Buff,"13,10",1)) { fnConverge_Response() } }
I don't like the FIND_STRING 'user' part. The WHILE loop is what I have always used and never had issues. So, I just modified it a little for the user and password info. Here is the section of my function handling the password portion:
DEFINE_FUNCTION fnConverge_Response() { LOCAL_VAR CHAR cMSG[50] cMSG = REMOVE_STRING(cConverge_Buff,"13,10",1) IF(LENGTH_STRING(cMSG) != 0) { SET_LENGTH_STRING(cMSG,LENGTH_STRING(cMSG) - 2) SELECT { ACTIVE(FIND_STRING(cMSG,'pass:',1)): { SEND_STRING dvConverge,"'converge',13" } ACTIVE(FIND_STRING(cMSG, "cConverge_ADDRESS, 'other stuff'",1)): { do other things like adjust bargraph values or toggle MUTE icons } } } }This was the only way I could get the Master to correctly login to the Converge. I tried moving everything into the function, but when I did that, I could never get past the user name request. I am guessing the big clue to my problem is "13,10." My function is set to run every time the buffer has a CR and a LF. When the Converge asks for a username, there is no CR and LF to trigger the function. When I send the string 'clearone' as the user name, then the CR and LF happens which causes the function to run which then handles the password request. It works as is, but it just doesn't seem like this is the best way to operate. Is there a better way to do this?
0
Comments
Jeff
Yours is actually a bit cleaner and probably less wasteful than mine. I also can't see a better way to do it than what you've come up with.
I don't have a Converge in front of me to play with, but I have an idea in my head how that would work. As always, what's inside my head doesn't necessarily work in real life. Thoughts?