//-------------------------------------------------------------------------------------------------- le_result_t pa_mdc_StartSessionIPV4 ( uint32_t profileIndex, ///< [IN] The profile to use pa_mdc_CallRef_t* callRefPtr ///< [OUT] Reference used for stopping the data session ) { le_result_t result=LE_NOT_POSSIBLE; if ( GetCurrentDataSessionIndex() != INVALID_PROFILE_INDEX ) { return LE_DUPLICATE; } // Always executed because: // - if GPRS is already attached it doesn't do anything and then it returns OK // - if GPRS is not attached it will attach it and then it returns OK on success if ( AttachGPRS(true) != LE_OK ) { return LE_NOT_POSSIBLE; } // Always executed because: // - if the context is already activated it doesn't do anything and then it returns OK // - if the context is not activated it will attach it and then it returns OK on success if ( ActivateContext(profileIndex,true) != LE_OK ) { return LE_NOT_POSSIBLE; } if ( (result = EstablishConnection(profileIndex)) != LE_OK ) { return LE_NOT_POSSIBLE; } if (result==LE_OK) { SetCurrentDataSessionIndex(profileIndex); memcpy(callRefPtr, &profileIndex, sizeof(void*)); } else { SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX); } return result; }
//-------------------------------------------------------------------------------------------------- le_result_t pa_mdc_StartSessionIPV4 ( uint32_t profileIndex ///< [IN] The profile to use ) { le_result_t result=LE_FAULT; if ( GetCurrentDataSessionIndex() != INVALID_PROFILE_INDEX ) { return LE_DUPLICATE; } // Always executed because: // - if GPRS is already attached it doesn't do anything and then it returns OK // - if GPRS is not attached it will attach it and then it returns OK on success if ( AttachGPRS(true) != LE_OK ) { return LE_FAULT; } // Always executed because: // - if the context is already activated it doesn't do anything and then it returns OK // - if the context is not activated it will attach it and then it returns OK on success if ( ActivateContext(profileIndex,true) != LE_OK ) { return LE_FAULT; } if ( (result = EstablishConnection(profileIndex)) != LE_OK ) { SetCurrentDataSessionIndex(INVALID_PROFILE_INDEX); return LE_FAULT; } SetCurrentDataSessionIndex(profileIndex); return result; }
CONTEXT SetContext (CONTEXT Context) { CONTEXT LastContext; LastContext = _pCurContext; if (Context != LastContext) { if (LastContext) { UnsetContextFlags ( MAKE_WORD (0, GRAPHICS_ACTIVE | DRAWABLE_ACTIVE)); SetContextFlags ( MAKE_WORD (0, _GraphicsStatusFlags & (GRAPHICS_ACTIVE | DRAWABLE_ACTIVE))); DeactivateContext (); } _pCurContext = Context; if (_pCurContext) { ActivateContext (); _GraphicsStatusFlags &= ~(GRAPHICS_ACTIVE | DRAWABLE_ACTIVE); _GraphicsStatusFlags |= HIBYTE (_get_context_flags ()); SetPrimColor (&_locPrim, _get_context_fg_color ()); _CurFramePtr = _get_context_fg_frame (); _CurFontPtr = _get_context_font (); } } return (LastContext); }
// Pause execution and switch to the yield context. void Scheduler::Yield() { // Just jump back; yield context will be restored in Activate(). ActivateContext(state.GetYieldContext()); }
// Update state and start the given context. void Scheduler::Activate(Context& newContext) { Context& previousYieldContext = state.Push(newContext); ActivateContext(newContext); state.Pop(previousYieldContext); }