CC3000: text finder equivalent?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
reevesl
 
Posts: 3
Joined: Mon Apr 15, 2013 2:38 pm

CC3000: text finder equivalent?

Post by reevesl »

Hi folks,

Before I add a bunch of code to my sketch (likely by pulling it out of the text finder library) I wanted to see if anyone else had already come across or created a solution.

The library is looking for an Ethernet client stream or a serial stream so the build fails with the cc3000 stream type. Granted, I'm a terrible programmer, so the chances that I did it wrong are pretty good.

The code isn't complicated so I can just re-implement the logic... just trying to save time. :D

Thanks,
Reeves

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000: text finder equivalent?

Post by adafruit_support_mike »

If you have the text in a C-style string, you can use the `strstr()` function to find a substring, and the `sscanf()` function to extract formatted data. Both functions are part of the standard C library, in <stdio.h>.

User avatar
reevesl
 
Posts: 3
Joined: Mon Apr 15, 2013 2:38 pm

Re: CC3000: text finder equivalent?

Post by reevesl »

Thanks Mike, that's a good suggestion but not exactly what I'm needing.

The value of the text finder library is that it scans the stream as it passes, discarding the response as the target string isn't found. This is much more efficient for Arduino's limited memory as you don't need to hold potentially large chunks of text to parse.

I've moved the text finder functions into my sketch and am working on debugging it right now. I'm encountering issues with dropped data... but that's something for another thread once I get a handle on what's happening. :)

Cheers,
Reeves

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000: text finder equivalent?

Post by adafruit_support_mike »

Yeah, I was afraid of that.. there are scanner-based versions of the code in C, but they're written for files, not Arduino Streams.

You might want to talk to the folks over in the Arduino Playground. I'm not familiar with the internals of the text finder library, so I don't know how its stream support works.

16snathan
 
Posts: 9
Joined: Sat Mar 15, 2014 6:50 pm

Re: CC3000: text finder equivalent?

Post by 16snathan »

Hi Reevesi
Can you post your code? I am trying to read streaming data from a port on my computer 10.0.0.3:5000 and read it into the arduino. The data streamed is text from the server. I am trying to use the wifi client example. I am able to connect to the server with the port, but the sketch is not reading the streaming data.

Is it possible for you to share your sketch?

Thanks

Shiva

User avatar
memelab
 
Posts: 2
Joined: Wed Aug 20, 2014 12:07 am

Re: CC3000: text finder equivalent?

Post by memelab »

It looks like Adafruit recently committed a change to the CC3000 Library that allows it to inherit from Client and therefore Stream. It would seem that this would support use of TextFinder. However, the following code snippet:

Adafruit_CC3000_Client client = cc3000.connectTCP(ip, port);
TextFinder finder(client);

results in the following error:
error: no matching function for call to 'TextFinder::TextFinder(Adafruit_CC3000_Client&, int)'

See the github ticket for details:
https://github.com/adafruit/Adafruit_CC ... /issues/19

Am I doing something wrong, or does their recent code update actually not provide the support?

Thanks!

User avatar
memelab
 
Posts: 2
Joined: Wed Aug 20, 2014 12:07 am

Re: CC3000: text finder equivalent?

Post by memelab »

Answering my own question: the new commit does appear to support TextFinder. I was experiencing some conflicts between multiple versions of the library. Once I cleaned everything out, the code compiles. Should be good news for anyone who was looking for this support.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”