I need to remove characters from answer of device
2Fast
Junior Member
My problem is, sometimes what I need is in the start of the answer .... sometimes in the end.
Like that:
NB07□□ID01,F02,ST0001111□ID02,F02,ST0000000□ID05,F02,ST1110110□
The size of the answers are variable, so I need to identify the start with ID02 and put in a variable the complete feedback.
Example: VARIABLE = ID02,F02,ST0000000
I don't know what instruction I hace to use in this case.
Thanks!
Like that:
NB07□□ID01,F02,ST0001111□ID02,F02,ST0000000□ID05,F02,ST1110110□
The size of the answers are variable, so I need to identify the start with ID02 and put in a variable the complete feedback.
Example: VARIABLE = ID02,F02,ST0000000
I don't know what instruction I hace to use in this case.
Thanks!
Comments
-
My problem is, sometimes what I need is in the start of the answer .... sometimes in the end.
Like that:
NB07□□ID01,F02,ST0001111□ID02,F02,ST0000000□ID05,F02,ST1110110□
The size of the answers are variable, so I need to identify the start with ID02 and put in a variable the complete feedback.
Example: VARIABLE = ID02,F02,ST0000000
I don't know what instruction I hace to use in this case.
Thanks!
I imagine that □ is a return character? If so, you would probably need to nest a loop, pull off everything line by linemyCmd = remove_string(thatstring,13,1) // assuming it is a carriage return?
Then parse out myCmdmyWhatever = remove_string(myCmd,',',1)
Obviously this would be in loops, you would have ID02 in one pass, F02 in the next, etc... -
My problem is, sometimes what I need is in the start of the answer .... sometimes in the end.
Like that:
NB07□□ID01,F02,ST0001111□ID02,F02,ST0000000□ID05,F02,ST1110110□
The size of the answers are variable, so I need to identify the start with ID02 and put in a variable the complete feedback.
Example: VARIABLE = ID02,F02,ST0000000
I don't know what instruction I hace to use in this case.
Thanks!
2Fast,
I know we have seen this string already in the forum, it may have been from you. The key to parsing this message is finding the delimiter or the "TAIL" of the message. I can only assume what the little "□" none-printable character is for this message. But it seems that is the delimiter or "TAIL" of each of these sections. For the code example I will assume that the none-printable character is a Carriage Return / $0D.DEFINE_VARIABLE CHAR TAIL[] = {$0D}; DEFINE_EVENT DATA_EVENT[dvDevice] { STRING: { WHILE (FIND_STRING(cBuffer,"TAIL",1)) { cMsg = REMOVE_STRING(cBuffer,"TAIL",1); // Remove the Tail SET_LENGTH_STRING(cMsg, LENGTH_STRING(cMsg) - 1); IF (FIND_STRING(cMsg,'ID',1)) { // YOU SHOULD HAVE A COMPLETE ID MESSAGE HERE cANSWER = cMsg; } } } } -
Thanks guys. Now I think I understand ... Sorry for asking about it again!
-
Hmm I'm here again

I don't need only one feedback, I need to divide in answers from specific devices in the "network" and I really don't know how....
feedback1=ID01,F02,ST1110016
feedback2=ID02,F02,ST0110013
feedback3=ID03,F02,ST0100014
If the size of the answer was the same every time I would read for positions ...
With theses examples I'm not understanting
-
What device is this? Where can we find the protocol?
-
Hmm I'm here again

I don't need only one feedback, I need to divide in answers from specific devices in the "network" and I really don't know how....
feedback1=ID01,F02,ST1110016
feedback2=ID02,F02,ST0110013
feedback3=ID03,F02,ST0100014
If the size of the answer was the same every time I would read for positions ...
With theses examples I'm not understanting
DEFINE_VARIABLE CHAR TAIL[] = {$0D}; CHAR cAnswer[100][25]; DEFINE_EVENT DATA_EVENT[dvDevice] { STRING: { STACK_VAR INTEGER nCurrentID; WHILE (FIND_STRING(cBuffer,"TAIL",1)) { cMsg = REMOVE_STRING(cBuffer,"TAIL",1); // Remove the Tail SET_LENGTH_STRING(cMsg, LENGTH_STRING(cMsg) - 1) IF (FIND_STRING(cMsg,'ID',1)) { //ATOI Gets the '01' from the ID01,F02,ST1110016 nCurrentID = ATOI(cMsg); IF (nCurrentID <= MAX_LENGTH_ARRAY(cANSWER) && nCurrentID) { // YOU SHOULD HAVE A COMPLETE ID MESSAGE HERE cANSWER[nCurrentID] = cMsg; } } } } } -
Jeff - where is cBuffer?
-
Jeff - where is cBuffer?
I did not provide ALL the code!!!!!!! I am hoping people know how to create a buffer and declare a buffer!!!!! -
I sure hope so too.I am hoping people know how to create a buffer and declare a buffer!!!!!
I just thought you wouldn't remove the stuff you're referencing - maybe that's just me.
And please apologize - my ears hurt now.
-
I know how to create a buffer, sorry for my questions ... I will not disturb again with my dumb questions.
Sorry again and thanks -
I know how to create a buffer, sorry for my questions ... I will not disturb again with my dumb questions.
Sorry again and thanks
No no - not dumb. No question is dumb and you're not disturbing us.
As far as the buffer thing goes - I was just joking with Jeff and was actually curious whether or not it was supposed to be used in the CREATE_BUFFER or some other technique such as a LOCAL_VAR in the data event and populating it from the DATA.TEXT, etc. etc.
I'll just assume it's done via CREATE_BUFFER. -
No no - not dumb. No question is dumb and you're not disturbing us.
James is right... -

Thanks!
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums