//Description: // A complete message has been received from GPRS Shield from execute() // the message is processed. void GoGprs::_processGprsMsg(){ GG_DEBUG_PRINT( F("processGprsMsg for ") ); GG_DEBUG_PRINTLN( _gprsMsg ); // Initialize Internal response status _isOk = false; _isError = false; // Initialize the Ready State _setReady( _gprsMsg.indexOf( "POWER DOWN") < 0 ); if( _gprsMsg.indexOf( "POWER DOWN")>=0 ){ // If the module is going down -> not possible to call anymore! _setCallReady( false ); // wait the power down to get completed delay( 1500 ); // waiting will avoids isReady() to send "AT" command // and to receive a valid response before power down getting complete } // Process Normal GPRS message if( _gprsMsg == "OK" ){ //Not pertinent: GG_DEBUG_PRINTLN("Skip OK"); _isOk = true; } else if( _gprsMsg.indexOf( "ERROR" ) == 0 ) { _isError = true; } else if( _gprsMsg.indexOf( "+CPIN: SIM PIN" ) >= 0 ){ _sendPinCode(); } else if( _gprsMsg.indexOf( "RDY" ) == 0 ){ _setReady( true ); _setCallReady( false ); // GPRS will bind (or rebin) the Mobile Network _sendEchoOff(); // Send echo off } else if( _gprsMsg.indexOf( "Call Ready" ) >= 0 ){ _setCallReady( true ); _sendInitCmds(); // Initialise the communication between the Arduino & GPRS } else if( _gprsMsg.indexOf( "+CMTI" ) >= 0 ) { _processSmsReceipt(); // Process the SMS reception (it is a long work... so, sub-routine!) } else // If it is not a self explaining GPRS message... then it is perhaps // a response to a previous request ? // // Will manage the _gprsMsg -> update _lastResID + _ReqResult1 if( _lastReqID != REQ_NONE ){ _processReqResp( _lastReqID, _gprsMsg ); } _clearGprsMsg(); }
void ObjectDataIStream::addDataCommand( ObjectDataICommand command ) { LB_TS_THREAD( _thread ); LBASSERT( !isReady( )); #ifndef NDEBUG const uint128_t& version = command.getVersion(); const uint32_t sequence = command.getSequence(); if( _commands.empty( )) { LBASSERTINFO( sequence == 0, sequence << " in " << command ); } else { ObjectDataICommand previous( _commands.back() ); const uint128_t& previousVersion = previous.getVersion(); const uint32_t previousSequence = previous.getSequence(); LBASSERTINFO( sequence == previousSequence+1, sequence << ", " << previousSequence ); LBASSERT( version == previousVersion ); } #endif _commands.push_back( command ); if( command.isLast( )) _setReady(); }
void ObjectDataIStream::addDataPacket( Command& command ) { LB_TS_THREAD( _thread ); LBASSERT( !isReady( )); const ObjectDataPacket* packet = command.get< ObjectDataPacket >(); #ifndef NDEBUG if( _commands.empty( )) { LBASSERTINFO( packet->sequence == 0, packet ); } else { const ObjectDataPacket* previous = _commands.back()->get< ObjectDataPacket >(); LBASSERTINFO( packet->sequence == previous->sequence+1, packet->sequence << ", " << previous->sequence ); LBASSERT( packet->version == previous->version ); } #endif command.retain(); _commands.push_back( &command ); if( packet->last ) _setReady(); }
void FrameData::setReady( const co::ObjectVersion& frameData, const fabric::FrameData& data ) { clear(); LBASSERT( frameData.version.high() == 0 ); LBASSERT( _impl->readyVersion < frameData.version.low( )); LBASSERT( _impl->readyVersion == 0 || _impl->readyVersion + 1 == frameData.version.low( )); LBASSERT( _impl->version == frameData.version.low( )); _impl->images.swap( _impl->pendingImages ); _impl->data = data; _setReady( frameData.version.low()); LBLOG( LOG_ASSEMBLY ) << this << " applied v" << frameData.version.low() << std::endl; }
void MediaImpl::unloadMovie() { // Free allocated resources. freeResources(); // Reset flags. // _audioNewBufferCounter = 0; _terminate = false; _seekEnabled = false; _setReady(false); // Unsynch. // NOTE: I commented this out, it was in Drone, most probably useless but who knows. // unSynch(); // XXX: I'm not sure why we are doing this... }
bool MediaImpl::setPlayState(bool play) { if (_pipeline == NULL) return false; GstStateChangeReturn ret = gst_element_set_state (_pipeline, (play ? GST_STATE_PLAYING : GST_STATE_PAUSED)); if (ret == GST_STATE_CHANGE_FAILURE) { qDebug() << "Unable to set the pipeline to the playing state."; unloadMovie(); return false; } else { _setReady(play); return true; } }
void MediaImpl::resetMovie() { // TODO: Check if we can still seek when we reach EOS. It seems like it's then impossible and we // have to reload but it seems weird so we should check. if (!_eos() && _seekEnabled) { qDebug() << "Seeking at position 0."; gst_element_seek_simple (_pipeline, GST_FORMAT_TIME, (GstSeekFlags) (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), 0); this->_frame = NULL; _setReady(true); } else { // Just reload movie. qDebug() << "Reloading the movie" << _seekEnabled; _currentMovie = ""; loadMovie(_uri); } }
void FrameData::setReady() { _setReady( _impl->version ); }