Page 1 of 1
Extracting portions of data from Circular Buffer
Posted: Sat Apr 21, 2018 8:46 am
by jollybv
Hi Guys
I'm trying to extract say for example the phone number from the circular buffer, What i need is to scan the buffer until i see the " then read the 12 digits and exit but i cant seem to be able to get this right any help / examples will be appreciated as system must go out on Monday. I've tried using string manipulation but is not efficient as different networks have different formats.
+CMT: "+27741016705",,"2018/04/21 09:32:31+08"
+CMT: "+27741016705" Please call
Re: Extracting portions of data from Circular Buffer
Posted: Sat Apr 21, 2018 9:23 am
by mnf
Please give us a little more detail of what you are trying to do. Save the characters to a string, convert to a number (or several numbers) is there any detail in the string etc
The circular buffer allows easy access to contents using GetByte, and of you've downloaded the latest version of the component then there is a PeekByte which will let you check for the end of a symbol too.
Martin
Re: Extracting portions of data from Circular Buffer
Posted: Sat Apr 21, 2018 10:28 am
by jollybv
Hi Martin
Thank for the response what I'm trying to do is extract the 12 digit phone number (+27741016705) out the string in the buffer and compare it with a number stored in memory. the comparison is not a problem it is getting the 12 digit number as the buffer is constantly getting updated and never the same size to use string manipulation
+CMT: "+27741016705",,"2018/04/21 09:32:31+08"
+CMT: "+27741016705" Please call
Re: Extracting portions of data from Circular Buffer
Posted: Sat Apr 21, 2018 10:31 am
by jollybv
Hi Martin
Thank for the response what I'm trying to do is extract the 12 digit phone number (+27741016705) out the string in the buffer and compare it with a number stored in memory. the comparison is not a problem it is getting the 12 digit number as the buffer is constantly getting updated and never the same size to use string manipulation.
+CMT: "+27741016705",,"2018/04/21 09:32:31+08"
+CMT: "+27741016705" Please call
Do you have a link where i can download the updated component.
Re: Extracting portions of data from Circular Buffer
Posted: Sat Apr 21, 2018 5:17 pm
by mnf
Something like :
[img]buffer.PNG[/img]
How is your circular buffer being updated - if interrupts? - you may need to disable them whilst reading to .data (which you are then free to compare etc as required)
How big a buffer are you using ?
The updated circular buffer component (thanks to Ben for this) is at
http://www.flowcode.co.uk/mmforums/downl ... p?id=25485
Martin
Re: Extracting portions of data from Circular Buffer
Posted: Sun Apr 22, 2018 6:45 am
by jollybv
Hi Martin
Thanks for this I can see exactly how it will work