void cereal::CerealPort::readBetweenThread(char start, char end) { std::string data; bool error = false; while(!stream_stopped_) { if(!stream_paused_) { error = false; try{ readBetween(&data, start, end, 100); } catch(cereal::Exception& e) { error = true; } if(!error && data.size()>0) readBetweenCallback(&data); } } }
int8_t MG2639_Cell::getPhoneNumber(char * phoneRet) { int8_t iRetVal; sendATCommand(OWNERS_NUMBER); // Send "AT+CNUM" // Response will look like "+CNUM: "1234567890",129,7,4\r\nOK\r\n" // Read if/until we fund "+CNUM", then we'll do some string work to get the // phone number. iRetVal = readWaitForResponse("+CNUM:", COMMAND_RESPONSE_TIME); if (iRetVal > 0) { // Read between the quotes ("), that's where our phone will be //! TODO: What if the phone number isn't in the string. //! Should return some value based on the return of readBetween readBetween('\"', '\"', phoneRet, COMMAND_RESPONSE_TIME); } return iRetVal; }