Example #1
0
//---------------------------------------------------------------------------
void File_Aac::From_Codec()
{
    //Filling
    Stream_Prepare(Stream_General);
    Fill(Stream_General, 0, General_Format, "AAC");
    Stream_Prepare(Stream_Audio);
    Fill(Stream_Audio, 0, Audio_Format, "AAC");
    Fill(Stream_Audio, 0, Audio_Codec, Codec);
    Ztring Profile;
    int8u Version=0, SBR=2, PS=2;
         if (0);
    else if (Codec==_T("A_AAC/MPEG2/MAIN"))     {Version=2; Profile=_T("Main");}
    else if (Codec==_T("A_AAC/MPEG2/LC"))       {Version=2; Profile=_T("LC");   SBR=0;}
    else if (Codec==_T("A_AAC/MPEG2/LC/SBR"))   {Version=2; Profile=_T("LC");   SBR=1;}
    else if (Codec==_T("A_AAC/MPEG2/SSR"))      {Version=2; Profile=_T("SSR");}
    else if (Codec==_T("A_AAC/MPEG4/MAIN"))     {Version=4; Profile=_T("Main");}
    else if (Codec==_T("A_AAC/MPEG4/LC"))       {Version=4; Profile=_T("LC");   SBR=0;}
    else if (Codec==_T("A_AAC/MPEG4/LC/SBR"))   {Version=4; Profile=_T("LC");   SBR=1; PS=0;}
    else if (Codec==_T("A_AAC/MPEG4/LC/SBR/PS")){Version=4; Profile=_T("LC");   SBR=1; PS=1;}
    else if (Codec==_T("A_AAC/MPEG4/SSR"))      {Version=4; Profile=_T("SSR");}
    else if (Codec==_T("A_AAC/MPEG4/LTP"))      {Version=4; Profile=_T("LTP");}
    else if (Codec==_T("raac"))                 {           Profile=_T("LC");}
    else if (Codec==_T("racp"))                 {           Profile=_T("LC");   SBR=1; PS=0;}

    if (Version>0)
        Fill(Stream_Audio, 0, Audio_Format_Version, Version==2?"Version 2":"Version 4");
    Fill(Stream_Audio, 0, Audio_Format_Profile, Profile);
    if (SBR!=2)
    {
        if (SBR)
            Fill(Stream_Audio, 0, Audio_Format_Settings, "SBR");
        Fill(Stream_Audio, 0, Audio_Format_Settings_SBR, SBR?"Yes":"No");
    }
    if (PS!=2)
    {
        if (PS)
            Fill(Stream_Audio, 0, Audio_Format_Settings, "PS");
        Fill(Stream_Audio, 0, Audio_Format_Settings_PS, PS?"Yes":"No");
    }

    Accept("AAC");
    Finish("AAC");
}
//---------------------------------------------------------------------------
void File_Dpg::FileHeader_Parse()
{
    //Parsing
    int32u  FrameCount, FrameRate, SamplingRate;
    Skip_C4(                                                    "Signature");
    Get_L4 (FrameCount,                                         "Frame count");
    Get_L4 (FrameRate,                                          "Frame rate"); Param_Info(FrameRate/0x100, " fps");
    Get_L4 (SamplingRate,                                       "Sampling rate");
    Skip_L4(                                                    "0x00000000");
    Get_L4 (Audio_Offset,                                       "Audio Offset");
    Get_L4 (Audio_Size,                                         "Audio Size");
    Get_L4 (Video_Offset,                                       "Video Offset");
    Get_L4 (Video_Size,                                         "Video Size");

    FILLING_BEGIN();
        Accept("DPG");

        Fill(Stream_General, 0, General_Format, "DPG");

        Stream_Prepare(Stream_Video);
        Fill(Stream_Video, 0, Video_FrameRate, (float)(FrameRate/0x100), 3);
        Fill(Stream_Video, 0, Video_FrameCount, FrameCount);
        Fill(Stream_Video, 0, Video_StreamSize, Video_Size);

        Stream_Prepare(Stream_Audio);
        Fill(Stream_Audio, 0, Audio_SamplingRate, SamplingRate);
        Fill(Stream_Audio, 0, Audio_StreamSize, Audio_Size);

        //Positionning
        #if defined(MEDIAINFO_MPEGA_YES)
            Parser=new File_Mpega();
            Open_Buffer_Init(Parser);
            GoTo(Audio_Offset, "DPG");
        #elif defined(MEDIAINFO_MPEGV_YES)
            Audio_Size=0;
            Parser=new File_Mpegv();
            Open_Buffer_Init(Parser);
            GoTo(Video_Offset, "DPG");
        #else
            Finish("DPG");
        #endif
    FILLING_END();
}
Example #3
0
//---------------------------------------------------------------------------
void File_Speex::Comment()
{
    Element_Name("Comment?");

    while (Element_Offset<Element_Size)
    {
        Ztring value;
        int32u size;
        Get_L4(size,                                            "size");
        if (size)
            Get_Local(size, value,                              "value");

        //Filling
        if (!value.empty())
            Fill(Stream_Audio, 0, "Comment", value);
    }

    Finish("Speex");
}
void UPawnAction_Sequence::OnChildFinished(UPawnAction& Action, EPawnActionResult::Type WithResult)
{
	if (RecentActionCopy == &Action)
	{
		if (WithResult == EPawnActionResult::Success || (WithResult == EPawnActionResult::Failed && ChildFailureHandlingMode == EPawnActionFailHandling::IgnoreFailure))
		{
			if (GetAbortState() == EPawnActionAbortState::NotBeingAborted)
			{
				PushNextActionCopy();
			}
		}
		else
		{
			Finish(EPawnActionResult::Failed);
		}
	}

	Super::OnChildFinished(Action, WithResult);
}
bool UPawnAction_Sequence::PushNextActionCopy()
{
	if (CurrentActionIndex >= uint32(ActionSequence.Num()))
	{
		Finish(EPawnActionResult::Success);
		return true;
	}

	UPawnAction* ActionCopy = SubActionTriggeringPolicy == EPawnSubActionTriggeringPolicy::CopyBeforeTriggering
		? Cast<UPawnAction>(StaticDuplicateObject(ActionSequence[CurrentActionIndex], this, NULL))
		: ActionSequence[CurrentActionIndex];

	UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> pushing action %s")
		, *GetName(), *GetNameSafe(ActionCopy));
	++CurrentActionIndex;	
	check(ActionCopy);
	RecentActionCopy = ActionCopy;
	return PushChildAction(*ActionCopy);
}
Example #6
0
NS_IMETHODIMP
FileHelper::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt,
                          nsresult aStatus)
{
  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");

  if (NS_FAILED(aStatus)) {
    if (aStatus == NS_ERROR_FILE_NO_DEVICE_SPACE) {
      mResultCode = NS_ERROR_DOM_FILEHANDLE_QUOTA_ERR;
    }
    else {
      mResultCode = NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR;
    }
  }

  Finish();

  return NS_OK;
}
	bool get_wait_to_play_devices() {
		alarm_center_video::request request;
		alarm_center_video::alarm_info alarm_info;
		grpc::ClientContext context;

		auto mgr = video::video_manager::get_instance();
		auto reader = stub_->get_alarming_devs(&context, request);
		while (reader->Read(&alarm_info)) {
			video::video_device_identifier id;
			id.dev_id = alarm_info.devinfo().dev_id();
			id.productor_type = video::Integer2ProductorType(alarm_info.devinfo().productor_type());
			video::device_ptr device = mgr->GetVideoDeviceInfo(&id);
			int speed = util::CConfigHelper::get_instance()->get_default_video_level();

			if (device && g_videoPlayerDlg) {
				//if (alarm_info.alarm_msg_size() == 0) {
				//	g_videoPlayerDlg->PlayVideoByDevice(device, speed);
				//} else {
				//	for (auto txt : alarm_info.alarm_msg()) {
				//		//g_videoPlayerDlg->PlayVideoByDevice(device, speed, )
				//	}
				//}

				//video::zone_uuid_ptr zone = nullptr;
				if (alarm_info.has_zone_uuid()) {
					auto zone = std::make_shared<video::zone_uuid>();
					zone->_ademco_id = alarm_info.zone_uuid().ademco_id();
					zone->_zone_value = alarm_info.zone_uuid().zone_value();
					zone->_gg = alarm_info.zone_uuid().gg();

					g_videoPlayerDlg->PlayVideo(zone, nullptr);
				} else {
					g_videoPlayerDlg->PlayVideo(device);
				}

				
			}
		}

		auto status = reader->Finish();
		return status.ok();
	}
Example #8
0
TEST_F(TeeHistorian, Auth)
{
	const unsigned char EXPECTED[] = {
		// EX uuid=60daba5c-52c4-3aeb-b8ba-b2953fb55a17 data_len=16
		0x4a,
		0x60, 0xda, 0xba, 0x5c, 0x52, 0xc4, 0x3a, 0xeb,
		0xb8, 0xba, 0xb2, 0x95, 0x3f, 0xb5, 0x5a, 0x17,
		0x10,
		// (AUTH_INIT) cid=0 level=3 auth_name="default_admin"
		0x00, 0x03, 'd',  'e',  'f',  'a',  'u',  'l',
		't',  '_',  'a',  'd',  'm',  'i',  'n',  0x00,
		// EX uuid=37ecd3b8-9218-3bb9-a71b-a935b86f6a81 data_len=9
		0x4a,
		0x37, 0xec, 0xd3, 0xb8, 0x92, 0x18, 0x3b, 0xb9,
		0xa7, 0x1b, 0xa9, 0x35, 0xb8, 0x6f, 0x6a, 0x81,
		0x09,
		// (AUTH_LOGIN) cid=1 level=2 auth_name="foobar"
		0x01, 0x02, 'f',  'o',  'o',  'b',  'a',  'r',
		0x00,
		// EX uuid=37ecd3b8-9218-3bb9-a71b-a935b86f6a81 data_len=7
		0x4a,
		0x37, 0xec, 0xd3, 0xb8, 0x92, 0x18, 0x3b, 0xb9,
		0xa7, 0x1b, 0xa9, 0x35, 0xb8, 0x6f, 0x6a, 0x81,
		0x07,
		// (AUTH_LOGIN) cid=1 level=2 auth_name="foobar"
		0x02, 0x01, 'h',  'e',  'l',  'p',  0x00,
		// EX uuid=d4f5abe8-edd2-3fb9-abd8-1c8bb84f4a63 data_len=7
		0x4a,
		0xd4, 0xf5, 0xab, 0xe8, 0xed, 0xd2, 0x3f, 0xb9,
		0xab, 0xd8, 0x1c, 0x8b, 0xb8, 0x4f, 0x4a, 0x63,
		0x01,
		// (AUTH_LOGOUT) cid=1
		0x01,
		0x40, // FINISH
	};
	m_TH.RecordAuthInitial(0, IServer::AUTHED_ADMIN, "default_admin");
	m_TH.RecordAuthLogin(1, IServer::AUTHED_MOD, "foobar");
	m_TH.RecordAuthLogin(2, IServer::AUTHED_HELPER, "help");
	m_TH.RecordAuthLogout(1);
	Finish();
	Expect(EXPECTED, sizeof(EXPECTED));
}
Example #9
0
void Arena::UpdatePlayerCounts()
{
	if(m_ended)
		return;

	m_mapMgr->GetStateManager().UpdateWorldState(m_pcWorldStates[GOLD_TEAM], m_playersCount[GOLD_TEAM]);
	m_mapMgr->GetStateManager().UpdateWorldState(m_pcWorldStates[GREEN_TEAM], m_playersCount[GREEN_TEAM]);

	if(!m_started)
		return;

	if(m_playersCount[GOLD_TEAM] == 0)
		m_losingteam = GOLD_TEAM;
	else if(m_playersCount[GREEN_TEAM] == 0)
		m_losingteam = GREEN_TEAM;
	else
		return;

	Finish();
}
Example #10
0
//---------------------------------------------------------------------------
void File_ArriRaw::Read_Buffer_Continue()
{
    //Parsing
    Skip_C4(                                                    "Signature");
    Skip_C1(                                                    "Signature");
    Skip_C3(                                                    "Signature");
    Skip_XX(File_Size-8,                                        "Data");

    FILLING_BEGIN();
        Frame_Count++;
        if (Frame_Count_NotParsedIncluded!=(int64u)-1)
            Frame_Count_NotParsedIncluded++;
        if (!Status[IsFilled])
        {
            Fill();
            if (Config->ParseSpeed<1.0)
                Finish();
        }
    FILLING_END();
}
Example #11
0
//---------------------------------------------------------------------------
void File_Gzip::Read_Buffer_Continue()
{
    //Parsing
    int8u CM;
    Skip_B2(                                                    "IDentification");
    Get_B1 (CM,                                                 "Compression Method");
    Skip_B1(                                                    "FLaGs");
    Skip_B4(                                                    "Modified TIME");
    Skip_XX(File_Size-10,                                       "Data");

    FILLING_BEGIN();
        //Filling
        Accept("Gzip");

        Fill(Stream_General, 0, General_Format, "GZip");
        Fill(Stream_General, 0, General_Format_Profile, "deflate");

        Finish("Gzip");
    FILLING_END();
}
//---------------------------------------------------------------------------
void File_Pcm::Data_Parse()
{
    #if MEDIAINFO_DEMUX
        if (Demux_UnpacketizeContainer)
        {
            Demux_Offset=(size_t)Element_Size;
            Demux_UnpacketizeContainer_Demux();
        }
    #endif //MEDIAINFO_DEMUX

    //Parsing
    Skip_XX(Element_Size,                                       "Data"); //It is impossible to detect... Default is no detection, only filling

    Frame_Count++;
    if (!Status[IsAccepted] && Frame_Count>=2)
    {
        Accept();
        Finish();
    }
}
Example #13
0
BOOL CDialog::Uninstall()
{
	BOOL result = TRUE;
	TCHAR szPath[MAX_PATH] = {0};
	TCHAR szMessage[MAX_PATH] = {0};

	SetMessage( TEXT("") );

	int msg = IDS_UNINSTALL_RESTART;

	lstrcpy(szPath, m_szDestinationPath);
	lstrcat(szPath, "\\");
	lstrcat(szPath, FILENAME_DLL);

	if( UnRegisterActiveX(szPath) )
	{
		RegDeleteKey( HKEY_LOCAL_MACHINE, UNINSTALL_KEY);
		if( ::DeleteFile(szPath) )
		{
			m_bCleanup = true; // Tell main to call CleanUp()
			msg = IDS_UNINSTALL_SUCCESS;
		}
		else
		{
			// Write something to RunOnce registry key
		}
	}
	else
	{
		msg = IDS_UNREGISTERACTIVEXFAILED;
		result = FALSE;
	}

	m_bUnInstall = false;

	AppendMessage( msg, NULL, true );

	Finish();

	return result;
}
Example #14
0
//---------------------------------------------------------------------------
void File_Vc3::Data_Parse()
{
    //Parsing
    Element_Info(Frame_Count+1);
    HeaderPrefix();
    CodingControlA();
    Skip_XX(16,                                                 "Reserved");
    ImageGeometry();
    Skip_XX( 5,                                                 "Reserved");
    CompressionID();

    Skip_XX(640-Element_Offset,                                 "ToDo");
    Skip_XX(Element_Size-Element_Offset,                        "Data");

    FILLING_BEGIN();
        Data_ToParse-=Buffer_Size-(size_t)Buffer_Offset;
        Frame_Count++;
        if (!Status[IsFinished] && Frame_Count>=Frame_Count_Valid)
            Finish("VC-3");
    FILLING_END();
}
void
DeleteFilesRunnable::DirectoryLockAcquired(DirectoryLock* aLock)
{
  AssertIsOnBackgroundThread();
  MOZ_ASSERT(mState == State_DirectoryOpenPending);
  MOZ_ASSERT(!mDirectoryLock);

  mDirectoryLock = aLock;

  QuotaManager* quotaManager = QuotaManager::Get();
  MOZ_ASSERT(quotaManager);

  // Must set this before dispatching otherwise we will race with the IO thread
  mState = State_DatabaseWorkOpen;

  nsresult rv = quotaManager->IOThread()->Dispatch(this, NS_DISPATCH_NORMAL);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    Finish();
    return;
  }
}
Example #16
0
 void StreamRender::Update(){


    // QTimer::singleShot(30, this, SLOT(render())); // el consumo de cpu es 0

    if (isFinal())
    {
        // if(Timer->isActive ())
        // {
            Timer->stop();
            emit  Finish();

        // }
     }


    render();



}
//---------------------------------------------------------------------------
void File_Ico::Data_Parse()
{
    //Parsing
    int32u Size, Offset;
    int16u BitsPerPixel;
    int8u Width, Height;
    Get_L1 (Width,                                      "Width");
    Get_L1 (Height,                                     "Height");
    Skip_L1(                                            "Colour count");
    Skip_L1(                                            "Reserved");
    Skip_L2(                                            Type==1?"Colour planes":"X hotspot");
    Get_L2 (BitsPerPixel,                               Type==1?"Bits per pixel":"Y hotspot");
    Get_L4 (Size,                                       "Size of the bitmap data");
    Get_L4 (Offset,                                     "Offset of the bitmap data");

    FILLING_BEGIN_PRECISE();
        stream Stream;
        Stream.Width=Width;
        Stream.Height=Height;
        Stream.BitsPerPixel=BitsPerPixel;
        Stream.Size=Size;
        Stream.Offset=Offset;
        Streams.push_back(Stream);

        IcoDataSize+=Size;
        if (Offset>File_Size || File_Offset+Buffer_Offset+Element_Size+IcoDataSize>File_Size)
            Reject("ICO");
        Count--;
        if (Count==0)
        {
            if (File_Offset+Buffer_Offset+Element_Size+IcoDataSize!=File_Size)
                Reject("ICO");
            else
            {
                Accept("ICO");
                Finish("ICO");
            }
        }
    FILLING_END();
}
Example #18
0
std::unique_ptr<PeerRequest> PeerRequest::Create(
    const api::Wallet& wallet,
    const ConstNym& nym,
    const proto::PeerRequestType& type,
    const Identifier& unitID,
    const Identifier& serverID,
    const std::uint64_t& amount,
    const std::string& terms)
{
    auto unit = wallet.UnitDefinition(unitID);

    if (!unit) {
        otErr << __FUNCTION__ << ": failed to load unit definition."
              << std::endl;

        return nullptr;
    }

    std::unique_ptr<PeerRequest> contract;

    switch (type) {
        case (proto::PEERREQUEST_OUTBAILMENT): {
            contract.reset(new OutBailmentRequest(
                wallet,
                nym,
                unit->Nym()->ID(),
                unitID,
                serverID,
                amount,
                terms));
        } break;
        default: {
            otErr << __FUNCTION__ << ": invalid request type." << std::endl;

            return nullptr;
        }
    }

    return Finish(contract);
}
Example #19
0
//---------------------------------------------------------------------------
void File_TimedText::Data_Parse()
{
    //Parsing
    Ztring Value;
    Get_UTF8 (Element_Size, Value,                              "Value");

    FILLING_BEGIN();
        if (!Status[IsAccepted])
        {
            Accept();
            #ifdef MEDIAINFO_MPEG4_YES
                if (IsChapter)
                {
                    Stream_Prepare(Stream_Menu);
                }
                else
            #endif //MEDIAINFO_MPEG4_YES
                {
                    Stream_Prepare(Stream_Text);
                }
            Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "Timed Text");
        }
        #ifdef MEDIAINFO_MPEG4_YES
            if (IsChapter)
            {
            }
            else
        #endif //MEDIAINFO_MPEG4_YES
            {
                Finish();
            }

        #ifdef MEDIAINFO_MPEG4_YES
            if (IsChapter && FrameInfo.DTS!=(int64u)-1 && Buffer_Offset==2)
                Fill(Stream_Menu, 0, Ztring().Duration_From_Milliseconds(FrameInfo.DTS/1000000).To_UTF8().c_str(), Value);
        #endif //MEDIAINFO_MPEG4_YES
    FILLING_END();

    Element_Offset=Buffer_Size-Buffer_Offset; //Buffer can also contain atoms after the text, ignoring them
}
Example #20
0
File: job.c Project: UNGLinux/Obase
/*-
 *-----------------------------------------------------------------------
 * handle_signal --
 *	handle a signal for ourselves
 *
 *-----------------------------------------------------------------------
 */
static void
handle_signal(int signo)
{
	if (DEBUG(JOB)) {
		(void)fprintf(stdout, "handle_signal(%d) called.\n", signo);
		(void)fflush(stdout);
	}

	/*
	 * Deal with proper cleanup based on the signal received. We only run
	 * the .INTERRUPT target if the signal was in fact an interrupt. The
	 * other three termination signals are more of a "get out *now*"
	 * command.
	 */
	if (signo == SIGINT)
		JobInterrupt(true, signo);
	else if (signo == SIGHUP || signo == SIGTERM || signo == SIGQUIT)
		JobInterrupt(false, signo);

	if (signo == SIGQUIT)
		Finish(0);
}
Example #21
0
void Arena::UpdatePlayerCounts()
{
	if(m_ended)
		return;
	
	SetWorldState(WORLDSTATE_ARENA__GREEN_PLAYER_COUNT, m_playersCount[0]);
	SetWorldState(WORLDSTATE_ARENA__GOLD_PLAYER_COUNT, m_playersCount[1]);

	if(!m_started)
		return;

	return;

	if(m_playersCount[1] == 0)
		m_winningteam = 0;
	else if(m_playersCount[0] == 0)
		m_winningteam = 1;
	else
		return;

	Finish();
}
Example #22
0
 void Test() override
 {
     switch (GetTestStep())
     {
         case 0:
             SpawnPlayer(0, CLASS_WARLOCK, RACE_UNDEAD, 10.0f);
             SpawnPlayer(1, CLASS_MAGE, RACE_GNOME, 0, 1);
             SpawnPlayer(2, CLASS_MAGE, RACE_GNOME, 0, -1);
             WaitPlayerSummon();
             break;
         case 1:
         {
             Player* warlock = GetTestPlayer(0, TESTPLAYER_PVP_ON);
             Player* mage1 = GetTestPlayer(1, TESTPLAYER_PVP_ON | TESTPLAYER_MAXLEVEL);
             Player* mage2 = GetTestPlayer(2, TESTPLAYER_PVP_ON | TESTPLAYER_MAXLEVEL);
             mage1->SetSelectionGuid(warlock->GetObjectGuid());
             mage2->SetSelectionGuid(warlock->GetObjectGuid());
             mage1->SetFacingToObject(warlock);
             mage2->SetFacingToObject(warlock);
             mage1->CastSpell(warlock, SPELL_ARCANE_MISSILE, false);
             TEST_ASSERT(mage1->IsNonMeleeSpellCasted(false) && "First cast");
             mage2->CastSpell(warlock, SPELL_ARCANE_MISSILE, false);
             TEST_ASSERT(mage1->IsNonMeleeSpellCasted(false));
             TEST_ASSERT(mage2->IsNonMeleeSpellCasted(false));
             Wait(3000);
             break;
         }
         case 2:
         {
             Player* mage1 = GetTestPlayer(1);
             Player* mage2 = GetTestPlayer(2);
             TEST_ASSERT(mage1->IsNonMeleeSpellCasted(false));
             TEST_ASSERT(mage2->IsNonMeleeSpellCasted(false));
             Finish(true);
             break;
         }
     }
     NextStep();
 }
Example #23
0
bool TOptsParser::Next() {
    bool r = false;

    if (OptsDefault_.empty()) {
        CurrentOpt_ = 0;
        TempCurrentOpt_.Destroy();

        CurrentValue_ = 0;

        if (Stopped_)
            return false;

        TOptsParser copy = *this;

        r = copy.DoNext();

        Swap(copy);

        if (!r) {
            Stopped_ = true;
            // we are done; check for missing options
            Finish();
        }
    }

    if (!r && !OptsDefault_.empty()) {
        CurrentOpt_ = OptsDefault_.front();
        CurrentValue_ = CurrentOpt_->GetDefaultValue();
        OptsDefault_.pop_front();
        r = true;
    }

    if (r) {
        if (CurOpt())
            CurOpt()->FireHandlers(this);
    }

    return r;
}
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			{
				m_bActive = false;
				m_actInfo = *pActInfo;
				Register(true);
			}
			break;

		case eFE_Activate:
			{
				if (IsPortActive(pActInfo, EIP_Enable))
					Register(true);
				if (IsPortActive(pActInfo, EIP_Disable))
					Register(false);
			}
			break;

		case eFE_Update:
			{
				if (!m_bFinished)
				{
					float fTimeout = GetPortFloat(&m_actInfo, EIP_Timeout);
					CTimeValue curTime = gEnv->pTimer->GetFrameStartTime();
					float elapsedTime = (curTime - m_activationTime).GetSeconds();
					if (elapsedTime > fTimeout)
					{
						Finish();
						ActivateOutput(&m_actInfo, EOP_TimedOut, true);
					}
				}
			}
			break;
		}

	}
Example #25
0
/**
 * 开始会话状态机,这时候可以发送外部请求
 */
int CISecRegService::OnStart()
{
    LOG_TRACE("Trace|%lu|: OnStart", m_stHead.ulTraceID);

    bzero(&m_stContext, sizeof(m_stContext));
    m_stContext.iSessId   = GetSessId();
    m_stContext.dwSessSeq = (m_stReq.ullTknSeq >> sizeof(m_stContext.dwSessSeq));    //请求序列号,实际可以用随机数或者累加得到

    //发送给外部服务请求包
    CPushToIosApi *pApi = CPushToIosApi::Instance();
    if(pApi->IsAllServerDown())
    {
    	LOG_ERR("TknSeq|%llu| ios all server down", m_stReq.ullTknSeq);
    	return Finish(RT_MSEC_SYS_ERROR);
    }

    bool bRet = pApi->RegTokenToConn(m_stContext, m_stReq);
    ASSERT(bRet);

    //修改服务状态
    return G2STAT(APP_STAT_IOS_REG);
}
Example #26
0
void EscapeSupervisor::Update()
{
    _escape_window.Update();
    _action_options.Update();

    // Update action
    if(vt_input::InputManager->ConfirmPress()) {
        if(_action_options.GetSelection() == 0)
            Cancel();
        else
            Finish();
    }
    else if(vt_input::InputManager->CancelPress()) {
        Cancel();
    }
    else if(vt_input::InputManager->LeftPress()) {
        _action_options.InputLeft();
    }
    else if(vt_input::InputManager->RightPress()) {
        _action_options.InputRight();
    }
}
//---------------------------------------------------------------------------
void File_DtvccTransport::Streams_Finish()
{
    Clear(Stream_Text);

    if (ServiceDescriptors)
    {
        if (ServiceDescriptors->ServiceDescriptors608.find(0)!=ServiceDescriptors->ServiceDescriptors608.end())
            CreateStream(0);
        if (ServiceDescriptors->ServiceDescriptors608.find(1)!=ServiceDescriptors->ServiceDescriptors608.end())
            CreateStream(1);
        if (!ServiceDescriptors->ServiceDescriptors708.empty())
            CreateStream(2);
    }

    //Per stream
    for (size_t Pos=0; Pos<Streams.size(); Pos++)
        if (Streams[Pos] && Streams[Pos]->Parser && Streams[Pos]->Parser->Status[IsAccepted] /*&& Streams[Pos]->Parser->Status[IsUpdated]*/)
        {
            Finish(Streams[Pos]->Parser);
            Streams_Update_PerStream(Pos);
        }
}
Example #28
0
void Arena::UpdatePlayerCounts()
{
	if(m_ended)
		return;

	switch(m_mapMgr->GetMapId())
	{
		/* ruins of lordaeron */
	case 572:
		SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]);
		SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]);
		break;

		/* blades edge arena */
	case 562:
		SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]);
		SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]);
		break;

		/* nagrand arena */
	case 559:
		SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]);
		SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]);
		break;
	}

	if(!m_started)
		return;

	if(m_playersCount[1] == 0)
		m_winningteam = 0;
	else if(m_playersCount[0] == 0)
		m_winningteam = 1;
	else
		return;

	Finish();
}
Example #29
0
void WorkerThread::run(){
	emit Start();

	emit Range(0,window->jobs.count()-1);
	emit Value(0);

	cancelled=false;


	for(int i=0;i<window->jobs.count();i++){
		emit Value(i);

		GenericJob *job=window->jobs.at(i);

		if(!job->source.isEmpty()){
			job->file=new rwfile(job->source);
			if(!job->file->issue.isEmpty()){
				continue;
			}
		} else job->file=NULL;

		if(!job->iso_filename.isEmpty()){
			job->isofile=window->iso->open(job->iso_filename);
			if(job->isofile==NULL){
				job->fail(QString("%1 (inside iso) - %2").arg(job->iso_filename).arg(window->iso->issue));
				continue;
			}
		} else job->isofile=NULL;

		job->process();

		window->resources.append(job->resources);

		job->close();
	}

	emit Finish();
}
void
ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess)
{
  if (Canceled()) {
    return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
  }

  // If we haven't been canceled we should have a registration.  There appears
  // to be a path where it gets cleared before we call into here.  Assert
  // to try to catch this condition, but don't crash in release.
  MOZ_DIAGNOSTIC_ASSERT(mRegistration);
  if (!mRegistration) {
    return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
  }

  // Continue executing the Install algorithm at step 12.

  // "If installFailed is true"
  if (NS_WARN_IF(!aInstallEventSuccess)) {
    // The installing worker is cleaned up by FailUpdateJob().
    FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
    return;
  }

  MOZ_DIAGNOSTIC_ASSERT(mRegistration->GetInstalling());
  mRegistration->TransitionInstallingToWaiting();

  Finish(NS_OK);

  // Step 20 calls for explicitly waiting for queued event tasks to fire.  Instead,
  // we simply queue a runnable to execute Activate.  This ensures the events are
  // flushed from the queue before proceeding.

  // Step 22 of the Install algorithm.  Activate is executed after the completion
  // of this job.  The controlling client and skipWaiting checks are performed
  // in TryToActivate().
  mRegistration->TryToActivateAsync();
}