Beispiel #1
0
void JSlideGame::StartCycle()
{
    srand( GetTickCount() );

    if (m_bRandomCatchID)
    {
        //  pick id of piece to catch on this cycle
        //  make it different from previous cycle's id
        int catchID = m_CatchID;
        while (catchID == m_CatchID && m_NumID > 1)
        {
            catchID = rand()%m_NumID;
        }
        m_CatchID = catchID;
    }

    //  pick the number to catch
    int nPieces = 0;
    JObjectIterator it( this );
    while (it)
    {
        JSlidePiece* pPiece = dynamic_cast<JSlidePiece*>( *it );
        ++it;
        if (!pPiece) continue;
        pPiece->StartFalling();
        if (pPiece->GetTag() == m_CatchID) nPieces++;
    }

    SendSignal( "NumToCatch" );
    SendSignal( "CatchID" );
} // JSlideGame::StartCycle
static void off_hook(void)
{
    CcConnectPrimType * CcConnectPrim;
    SignalType * startAudio;

    NewBuffer(sizeof(CcConnectPrimType), (void**) &CcConnectPrim);
    CcConnectPrim->SignalHeader.SignalLength = sizeof(CcConnectPrimType);
    SendSignal((SignalType*) CcConnectPrim, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_CONNECT_prim);

    NewBuffer(sizeof(SignalType), (void**) &startAudio);
    SendSignal((SignalType*) startAudio, DSP_PROCESS_ID, SETUPAUDIO_EVENT, 0);
}
Beispiel #3
0
void JButton::Press()
{
    if (!m_bPressed)
    {
        Frame ext = GetLocalExt();
        ext.x  += float( m_PressDX );
        ext.y  += float( m_PressDY );
        SetLocalExt( ext );
    }

    m_bPressed = true;
    SendSignal( "Press" );
    SendSignal( "Pressed" );
    OnPress();
} // JButton::Press
Beispiel #4
0
void JButton::Unpress()
{
    if (m_bPressed)
    {
        Frame ext = GetLocalExt();
        ext.x  -= float( m_PressDX );
        ext.y  -= float( m_PressDY );
        SetLocalExt( ext );
    }

    m_bPressed = false;
    SendSignal( "Unpress" );
    SendSignal( "Pressed" );
    OnUnpress();
} // JButton::Unpress
Beispiel #5
0
UByte voice_disConnectUser(PPIDType user)
{
    if (QuickData[user].EmptyMarker == 0) {
        ApplicationInstanceType *applicationInstanceData;
        PMIDType pmid;

        PPID2PMID((PMIDType *) pmid, user);
        applicationInstanceData = getApplicationInstance(pmid);

        if (applicationInstanceData->state == connected) {
            SignalType *CcReleasePrim;
            UByte Data[2] = { 0x2e, 00 };

            NewSignal(sizeof(SignalType) + 2, (void **) &CcReleasePrim);
            memcpy(CcReleasePrim->Address, pmid, 3);
            CcReleasePrim->Address[3] = 0x00;
            _memcpy(getCcReleasePrimTypeIE(CcReleasePrim), Data, 2);
            SendSignal((SignalType *) CcReleasePrim, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_prim);
            applicationInstanceData->state = idle;
            return 0;
        } else {
            return 2;
        }
    } else {
        return 3;
    }
}
Beispiel #6
0
void msf_send_DispReq(char * displayText, char * callbackNo, PPIDType user, UByte setupSpec)
{
    SioMsfInfoReqType * infoReq;
    int index = 0;
    PMIDType pmid;
    int callBackNoLength = 0;

    PPID2PMID(&pmid, user);

    if (callbackNo != 0) {
        callBackNoLength = strlen(callbackNo);
    }

    NewSignal(sizeof(SignalType) + strlen(displayText) + 1 + 1 + callBackNoLength + 1 + 1, (void**) &infoReq);

    infoReq->PpSetup = setupSpec;

    memcpy(getSioMsfInfoReqTypeIE(infoReq), displayText, strlen(displayText));
    index += strlen(displayText);

    getSioMsfInfoReqTypeIE(infoReq)[index++] = 0x00; /*zero terminate string*/

    if (callbackNo != 0) {
        memcpy(getSioMsfInfoReqTypeIE(infoReq) + index, callbackNo, strlen(callbackNo));
        index += strlen(callbackNo);
    }

    getSioMsfInfoReqTypeIE(infoReq)[index] = 0x00; /*zero terminate string*/

    memcpy((UByte*) infoReq->SignalHeader.Address, &pmid, 3);
    SendSignal((SignalType *) infoReq, APP_SS_PROCESS_ID, APP_SS_PRIMITIVE, SIO_MSF_INFO_req);
}
// Description:
//
// Arguments:
//
// Return:
//
void CPersonalRangeSignaling::CheckActorAngles( IActor* pActor )
{
  CRY_ASSERT( pActor != NULL );

  MapAngleSignals::iterator it = m_mapAngleSignalsSent.find( pActor->GetEntityId() );
  CAngleAlert const*        pAngle = GetAngleTo( pActor->GetEntity()->GetPos() );
  CAngleAlert const*        pOldAngle = ( (it != m_mapAngleSignalsSent.end()) ? it->second : NULL );

  if( pAngle != pOldAngle )
  {
    if( pAngle != NULL )
    {
      // Check boundary
      if( GetAngleTo(pActor->GetEntity()->GetPos(), true) != pOldAngle )
      {
        if( pOldAngle == NULL )
        {
          m_mapAngleSignalsSent.insert( std::pair < EntityId, CAngleAlert const * > (pActor->GetEntityId(), pAngle) );
        }
        else
        {
          it->second = pAngle;
        }

        SendSignal( pActor, pAngle->GetSignal(), pAngle->GetSignalData() );
      }
    }
    else
    {
      m_mapAngleSignalsSent.erase( it );
    }
  }
}
static void EEPROMWriteReadTestHandler(SignalType * Signal)
{
    switch (Signal->Event)
    {
        case EE_PRIMITIVE:
            switch (Signal->SubEvent)
            {
                case EE_READ_DATA_cfm:
                {
                    char* ptr;
                    EeStoreDataReqType *EeStoreDataReq;

                    ptr = StringPrint(StatusString, "EE_READ_DATA_cfm[");
                    ptr = StrPrintHexWord(ptr, EEP_UserDataArea);
                    ptr = StringPrint(ptr, "]=[");
                    ptr = StrPrintHexByte(ptr, eepromData[0]);
                    ptr = StringPrint(ptr, "]");
                    PrintStatus(0, StatusString);

                    eepromData[0]++;

                    NewSignal(sizeof(EeStoreDataReqType) + 1, (void **) &EeStoreDataReq);
                    getSignalData(EeStoreDataReq)[0] = eepromData[0];
                    EeStoreDataReq->DataTypes = EEDT_ANYADDRESS;
                    EeStoreDataReq->SubsNo = 0;
                    setAddressData(EEP_UserDataArea, 1);
                    SendSignal((SignalType *) EeStoreDataReq, EE_PROCESS_ID, EE_PRIMITIVE, EE_STORE_DATA_req);

                    setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0);
                }
                break;
            }
    }
    DeleteBuffer(Signal);
}
Beispiel #9
0
void handleAPPCCSetupInd(SignalType * TheSignal, ApplicationInstanceType * applicationInstanceData)
{
    SignalType *appccSetupAckReqSignal;
    char StatusString[256];
    char* tmp = StatusString;
    tmp = StringPrint(tmp, "\r\nApplication: outgoing call start: Calling party number: ");
    tmp = StringPrint(tmp, (char*) (getSignalData(TheSignal) + 1));
    PrintStatus(0, StatusString);

    applicationInstanceData->state = outgoingcall;

    NewSignal(sizeof(SignalType) + 9, (void**) &appccSetupAckReqSignal);
    memcpy(appccSetupAckReqSignal->Address, TheSignal->Address, 4);

    getSignalData(appccSetupAckReqSignal)[0] = 0x08; /*//info element offset*/
    getSignalData(appccSetupAckReqSignal)[1] = 0x01; /*UplaneEndpointStart*/
    getSignalData(appccSetupAckReqSignal)[2] = 0x02; /*UplaneEndpointStart*/
    getSignalData(appccSetupAckReqSignal)[3] = 0x00; /*UplaneEndpointStart*/
    getSignalData(appccSetupAckReqSignal)[4] = 0x00; /*UplaneEndpointStart*/
    getSignalData(appccSetupAckReqSignal)[5] = 0x1e;
    getSignalData(appccSetupAckReqSignal)[6] = 0x02;
    getSignalData(appccSetupAckReqSignal)[7] = 0x85;
    getSignalData(appccSetupAckReqSignal)[8] = 0x88;

    SendSignal(appccSetupAckReqSignal, APP_CC_PROCESS_ID, APP_CC_PRIMITIVE, APPCCSetupAckReq);
}
Beispiel #10
0
PoolServer::~PoolServer(){
	
	printf("PoolServer stopping...\n");
	
	proto::Signal sig;
	sig.set_type(proto::Signal_Type_SHUTDOWN);
	
	SendSignal(sig, mWorkerSignals);
	
	for(unsigned i = 0; i < mWorkers.size(); ++i){
		
		zsocket_wait(mWorkers[i].second);
		delete mWorkers[i].first;
		
	}
	
	delete mFrontend;
	delete mBackend;
	
	zsocket_destroy(mCtx, mWorkerSignals);
	zctx_destroy(&mCtx);
	
	printf("PoolServer stopped.\n");
	
}
Beispiel #11
0
UByte msf_setupreq_format1(PPIDType to, UByte setupSpec1, char * display, PPIDType callbackId)
{
    SignalType * signal;
    PMIDType pmid;
    char callback[12];

    if (QuickData[to].EmptyMarker != 0)
        return 0;

    PPID2PMID(&pmid, to);

    memset(callback, 0, 12);
    StrPrintHexWord(callback, callbackId);

    NewSignal(sizeof(SignalType) + 3 + strlen(display) + strlen(callback), (void**) &signal);
    getSignalData(signal)[0] = setupSpec1;
    memcpy(getSignalData(signal) + 1, display, strlen(display));
    getSignalData(signal)[1 + strlen(display)] = 0;
    if (strlen(callback) > 0) {
        memcpy(getSignalData(signal) + 1 + strlen(display) + 1, callback, strlen(callback) + 1);
    } else {
        getSignalData(signal)[1 + strlen(display) + 1] = 0;
    }

    memcpy(signal->Address, pmid, 3);
    SendSignal(signal, APP_SS_PROCESS_ID, APP_SS_PRIMITIVE, SIO_MSF_SETUP_req);
    return 1;
}
Beispiel #12
0
/*DEPRECATED*/
static status
ListenMovie(FILE *fd,char *port,char *ticket)
{
	int passive_s,ssock;
	unsigned long total_packets;
	unsigned long n_packet;
	boolean exit;
	download_t header;
	download_start_t start;
	void *packet;
	void *data;
	u_size size;
	u_size header_size;
	
	/* Preparo el puerto que va a escuchar la conexion */
	if( (passive_s=prepareTCP(client_host,port,prepareServer)) < 0 ) {
		return FATAL_ERROR;
	}	
	if( (listenTCP(passive_s,10)) < 0 ) {
		return FATAL_ERROR;
	}
	
	/* Mando la senial al server pidiendo el inicio de la descarga */
	strcpy(start.port,port);
	strcpy(start.ip,client_host);
	strcpy(start.ticket,ticket);
	
	size = GetDownloadStartData(start, &data);	
	if( SendSignal(__DOWNLOAD_START_OK__, data, size) == ERROR )
		return ERROR;
	free(data);
	
	exit = FALSE;
	n_packet = 0;
	ssock=acceptTCP(passive_s);
	while (!exit) {
		/* Recibo un paquete */
		packet = receiveTCP(ssock);
		if(packet==NULL)
		{
		    close(socket);
		    return TIMEOUT_ERROR;
		}
		header_size = GetDownloadPack(packet,&header);
		/* Lo bajo a disco */
		PutFileData(fd,_FILE_SIZE_, header.n_packet,packet+header_size,header.size);
		/* Verifico la cantidad total de paquetes a descargar */
		total_packets = header.total_packets;
		free(packet);
		n_packet++;
		/* Me fijo si llego a la cantidad total de paquetes bajados */
		if( n_packet >= total_packets )
			exit = TRUE;
	}
	closeTCP(ssock);
	closeTCP(passive_s);
	
	return OK;
}
Beispiel #13
0
void JSlideGame::Render()
{
    if (m_NumRightCycles == m_CurRightCycle)
    {
        return;
    }

    //  check whether all pieces have fallen
    bool bAllFallen = true;

    JObjectIterator it( this );
    while (it)
    {
        JSlidePiece* pPiece = dynamic_cast<JSlidePiece*>( *it );
        ++it;
        if (!pPiece || !pPiece->IsVisible()) continue;
        if (pPiece->m_Pos.y < m_BottomLine) bAllFallen = false;
    }

    if (m_NumCaughtWrong >= m_MaxIncorrect)
    {
        m_NumCaughtWrong = 0;
        m_NumCaught = 0;
        StartCycle();
    }

    if (m_NumCaught >= m_NumToCatch)
    {
        m_CurRightCycle++;
        m_NumCycles++;
        if (m_NumRightCycles == m_CurRightCycle)
        {
            SendSignal( "OnSuccess" );

            //  stop pieces from falling
            JObjectIterator pit( this );
            while (pit)
            {
                JSlidePiece* pPiece = dynamic_cast<JSlidePiece*>( *pit );
                ++pit;
                if (!pPiece) continue;
                pPiece->SetSpeed( 0.0f );
            }
            return;
        }
        else
        {
            StartCycle();
        }
    }

    if (bAllFallen)
    {
        StartCycle();
        m_NumCycles++;
    }

} // JSlideGame::Render
Beispiel #14
0
UByte voice_callUser(PPIDType called, PPIDType caller)
{
    ApplicationInstanceType *applicationInstanceData;

    if (QuickData[called].EmptyMarker == 0) {
        SignalType * signal;
        NewSignal(sizeof(SignalType), (void**) &signal);

        PPID2PMID((PMIDType *) signal->Address, called);

        applicationInstanceData = getApplicationInstance(signal->Address);

        if (applicationInstanceData->state == idle) {
            applicationInstanceData->state = incommingcall;
            applicationInstanceData->connectedTo = caller;

            SendSignal((SignalType*) signal, APP_CC_PROCESS_ID, APP_CC_PRIMITIVE, APPCCSetupReq);

            /*setup the outgoing side of the call:*/
            {
                PMIDType pmid;
                char tmp[13];
                UByte sum = called;

                PPID2PMID(&pmid, caller);

                applicationInstanceData = getApplicationInstance(pmid);
                applicationInstanceData->connectedTo = called;

                memset(tmp, 0, 12);
                tmp[0] = sum + '0';
                handleConnectPrim(pmid, applicationInstanceData);
                /*{
                 AudioLineCtrlReqType *AudioLineCtrlReq;
                 NewSignal(sizeof(AudioLineCtrlReqType), (void **) &AudioLineCtrlReq);
                 AudioLineCtrlReq->TheSignal.Address[0] = 0x0F;
                 AudioLineCtrlReq->TheSignal.Address[1] = 0;//MeInstance->Mcei;
                 AudioLineCtrlReq->Lid = sum;
                 _memcpy(AudioLineCtrlReq->Pmid,pmid,3);
                 AudioLineCtrlReq->option = 3;
                 PrintStatus(0, "\r\napp: send AUDIOLINECTRL_req to mac layer");

                 SendSignal((SignalType*)AudioLineCtrlReq, CCF_PROCESS_ID, CCF_PRIMITIVE, AUDIOLINECTRL_req);
                 }*/
            }

            return 1;
        } else {
            DeleteBuffer(signal);
            PrintStatus(0, "\r\nnumber found, but user allready active.\n");
            return 2;
        }
    } else {
        PrintStatus(0, "\r\nnumber not found...");
        return 3;
    }
}
Beispiel #15
0
void JObjectTree::SelectObject( JObject* pObject )
{
    if (pObject)
    {
        m_pSelected = pObject;
        m_pExpanded = m_pSelected;
        SendSignal( "Selected" );
    }
} // JObjectTree::SelectObject
static void PPDialingHandler(SignalType * Signal)
{
    switch (Signal->Event)
    {
        case IWU_PRIMITIVE:
        {
            switch (Signal->SubEvent)
            {
                case CC_CONNECT_prim:
                {
                    SignalType * startAudio;
                    NewBuffer(sizeof(SignalType), (void**) &startAudio);
                    SendSignal((SignalType*) startAudio, DSP_PROCESS_ID, SETUPAUDIO_EVENT, 0);
                    connected = 1;
                }
                case CC_INFO_prim: /*do not break*/
                {
                    if (connected == 1) {
                        SignalType* mySignal;
                        NewSignal(sizeof(SignalType) + 2 + strlen(numberToDial), (void **) &mySignal);
                        getSignalData(mySignal)[0] = 0x2c;
                        getSignalData(mySignal)[1] = strlen(numberToDial);
                        memcpy(getSignalData(mySignal) + 2, numberToDial, strlen(numberToDial));
                        InjectSignal(mySignal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_INFO_prim, Signal->SessionId);
                    }
                }
                break;
                case CC_RELEASE_prim:
                {
                    if (connected == 1) {
                        Signal->SignalLength = sizeof(CcReleaseComPrimType);
                        SendSignal(Signal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_COM_prim);
                        connected = 0;
                        setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0);
                        return;
                    }
                }
                break;
            }
        }
    }
    DeleteBuffer(Signal);
}
void RangeContainer::Update(float frameTime)
{
	float distToAttentionTargetSq = 0.0f;
	float distToLiveTargetSq = 0.0f;

	if (GetTargetDistances(distToAttentionTargetSq, distToLiveTargetSq))
	{
		Ranges::iterator it = m_ranges.begin();
		Ranges::iterator end = m_ranges.end();

		for ( ; it != end; ++it)
		{
			Range& range = *it;

			float distToTargetSq = 0.0f;
			switch (range.targetMode)
			{
			case Range::UseAttentionTargetDistance:
				distToTargetSq = distToAttentionTargetSq;
				break;
			case Range::UseLiveTargetDistance:
				distToTargetSq = distToLiveTargetSq;
				break;
			default:
				assert(0);
				break;
			}

			Range::State newState = (distToTargetSq < range.rangeSq) ? Range::Inside : Range::Outside;

			if (newState != range.state)
			{
				range.state = newState;

				if (newState == Range::Inside && !range.enterSignal.empty())
					SendSignal(range.enterSignal.c_str());
				else if (newState == Range::Outside && !range.leaveSignal.empty())
					SendSignal(range.leaveSignal.c_str());
			}
		}
	}
}
Beispiel #18
0
void JSlideGame::OnTakeWrong()
{
    g_pSoundServer->Play( g_pSoundServer->GetSoundID( m_SndTakeWrong.c_str(), 0 ) );
    m_NumCaughtWrong++;
    m_NumCaught--;
    if (m_NumCaught < 0)
    {
        m_NumCaught = 0;
    }
    SendSignal( "OnTakeWrong" );
} // JSlideGame::OnTakeWrong
Beispiel #19
0
UByte msf_send_CONNECT_res(PPIDType user)
{
    SignalType * signal;
    PMIDType pmid;
    getApplicationInstanceData(user)->msfState = msf_connected;
    NewSignal(sizeof(SignalType) + 2, (void**) &signal);
    PPID2PMID(&pmid, user);
    memcpy(signal->Address, pmid, sizeof(PMIDType));
    SendSignal(signal, APP_SS_PROCESS_ID, APP_SS_PRIMITIVE, SIO_MSF_CONNECT_res);
    return 1;
}
void on_hook(void)
{
    CcReleasePrimType * CcReleasePrim;
    ReleaseReasonType * ReleaseReason;

    NewBuffer(sizeof(CcReleasePrimType) + sizeof(ReleaseReasonType), (void**) &CcReleasePrim);
    CcReleasePrim->SignalHeader.SignalLength = sizeof(CcReleasePrimType) + sizeof(ReleaseReasonType);
    ReleaseReason = (ReleaseReasonType *) getCcReleasePrimTypeIE(CcReleasePrim);
    ReleaseReason->IEID = ReleaseReasonId;
    ReleaseReason->ReleaseReasonCode = NormalReleaseReason;
    SendSignal((SignalType*) CcReleasePrim, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_prim);
}
Beispiel #21
0
void showTime(u8* diff ,char* diff1)
{
  time temp;
  DSRead(&temp); 
  if(*diff != temp.min)
  {
    clear_OLED();
    *diff = temp.min;
    showYMD(&temp);
    showbignum(&temp);
    SendSignal(*diff1);
  }
}
Beispiel #22
0
static AJ_Status AppDoWork(AJ_BusAttachment* bus, uint32_t sessionId)
{
    static uint32_t pings_sent = 0;
    uint32_t pings = 0;
    AJ_Status status = AJ_OK;

    while (pings_sent < NumPings && pings++ < PINGS_PER_CALL && status == AJ_OK) {
        status = SendSignal(bus, sessionId);
        ++pings_sent;
    }

    return status;
}
Beispiel #23
0
void handleConnectPrim(PMIDType pmid, ApplicationInstanceType * applicationInstanceData)
{
    SignalType *ccconnectSignal;

    NewSignal(sizeof(SignalType) + 5, (void**) &ccconnectSignal);
    memcpy(ccconnectSignal->Address, pmid, 3); /*pmid in address field*/
    getSignalData(ccconnectSignal)[0] = 0x05; /*info element offset*/
    getSignalData(ccconnectSignal)[1] = 0x01; /*UplaneEndpointStart*/
    getSignalData(ccconnectSignal)[2] = 0x02; /*UplaneEndpointStart*/
    getSignalData(ccconnectSignal)[3] = 0x00; /*UplaneEndpointStart*/
    getSignalData(ccconnectSignal)[4] = 0x00; /*UplaneEndpointStart*/

    applicationInstanceData->state = connected;
    SendSignal(ccconnectSignal, APP_CC_PROCESS_ID, APP_CC_PRIMITIVE, APPCCConnectAckReq);
}
Beispiel #24
0
void PoolServer::NotifyNewBlock(CBlockIndex* pindex) {
	
	printf("NotifyNewBlock(%d)\n", pindex->nHeight);
	
	proto::Signal sig;
	sig.set_type(proto::Signal::NEWBLOCK);
	
	proto::Block* block = sig.mutable_block();
	block->set_height(pindex->nHeight);
	block->set_hash(pindex->phashBlock->GetHex());
	block->set_prevhash(pindex->pprev->phashBlock->GetHex());
	block->set_reqdiff(0);
	block->set_minshare(mMinShare);
	
	SendSignal(sig, mWorkerSignals);
	
}
Beispiel #25
0
UByte msf_send_ReleaseReq(PPIDType user, UByte releaseReason)
{
    SignalType * signal;
    PMIDType pmid;

    if (QuickData[user].EmptyMarker != 0)
        return 0;

    getApplicationInstanceData(user)->msfState = msf_release_pending;
    NewSignal(sizeof(SignalType) + 1, (void**) &signal);

    getSignalData(signal)[0] = releaseReason;

    PPID2PMID(&pmid, user);
    memcpy(signal->Address, pmid, sizeof(PMIDType));
    SendSignal(signal, APP_SS_PROCESS_ID, APP_SS_PRIMITIVE, SIO_MSF_RELEASE_req);
    return 1;
}
Beispiel #26
0
static status 
StartDownload(FILE *fd,char *ticket)
{	
	download_start_t start;
	void *data;
	u_size size;
	
	/* Mando la senial al server pidiendo el inicio de la descarga */
	strcpy(start.port,client_port);
	strcpy(start.ip,client_host);
	strcpy(start.ticket,ticket);
	
	size = GetDownloadStartData(start, &data);	
	if( SendSignal(__DOWNLOAD_START_OK__, data, size) == ERROR )
		return ERROR;
	free(data);
	return OK;
}
Beispiel #27
0
	void Process::_SendSignal(const ValueList& args, KValueRef result)
	{
		if (args.size() >= 1 && args.at(0)->IsNumber())
		{
			int code = -1;
			if (args.at(0)->IsString()) {
				std::string signalName = args.at(0)->ToString();
				if (ProcessBinding::signals.find(signalName) != ProcessBinding::signals.end())
				{
					code = ProcessBinding::signals[signalName];
				}
				else
				{
					std::ostringstream str;
					str << "Error, signal name: \"" << signalName << "\" is unrecognized";
					throw ValueException::FromString(str.str());
				}
			}
			else if (args.at(0)->IsNumber())
			{
				code = args.at(0)->ToInt();
				
				bool found = false;
				for (std::map<std::string,int>::const_iterator iter = ProcessBinding::signals.begin();
					iter != ProcessBinding::signals.end();
					iter++)
				{
					if (iter->second == code)
					{
						found = true;
						break;
					}
				}
				if (!found) {
					std::ostringstream str;
					str << "Error, signal number: " << code << " is unrecognized";
					throw ValueException::FromString(str.str());
				}
			}
			
			
			SendSignal(args.at(0)->ToInt());
		}
	}
Beispiel #28
0
UByte fp_send_module2module(PPIDType user, module2moduleData data)
{
    SsFacilityPrimType * SsFacilityPrim;
    UByte * dst;
    UByte cnt;

    NewSignal(sizeof(SsFacilityPrimType) + 5, (void**) &SsFacilityPrim);
    dst = (UByte *) getSsFacilityPrimTypeIE(SsFacilityPrim);

    dst[0] = MODULE_SHORT_MSF;

    for (cnt = 1; cnt <= 3; cnt++)
        dst[cnt] = data[cnt - 1];

    PPID2PMID((PMIDType*) SsFacilityPrim->SignalHeader.Address, user);

    SendSignal((SignalType*) SsFacilityPrim, IWU_PROCESS_ID, IWU_PRIMITIVE, SS_TUNNEL_prim);

    return 0;
}
// Description:
//
// Arguments:
//
// Return:
//
void CPersonalRangeSignaling::CheckActorTargetRanges( IActor* pActor )
{
  CRY_ASSERT( pActor != NULL );

  MapTargetRanges::iterator itTargetRanges = m_mapTargetRanges.find( pActor->GetEntityId() );
  CRY_ASSERT( itTargetRanges != m_mapTargetRanges.end() );

  MapRangeSignals::iterator it = m_mapTargetRangeSignalsSent.find( pActor->GetEntityId() );
  CRange const*             pRange = GetRangeTo( pActor->GetEntity()->GetPos(), itTargetRanges->second );
  CRange const*             pOldRange = ( (it != m_mapTargetRangeSignalsSent.end()) ? it->second : NULL );

  if( pRange != pOldRange )
  {
    if( pRange != NULL )
    {
      // Check boundary
      if( GetRangeTo(pActor->GetEntity()->GetPos(), itTargetRanges->second, true) != pOldRange )
      {
        if( pOldRange == NULL )
        {
          m_mapTargetRangeSignalsSent.insert( std::pair < EntityId, CRange const * > (pActor->GetEntityId(), pRange) );
        }
        else
        {
          it->second = pRange;
        }

		IActor* pMe = GetActor();
		CRY_ASSERT_MESSAGE(pMe, "An actor has been removed without cleaning up its range signals.");
		if (pMe)
		{
			SendSignal( pMe, pRange->GetSignal(), pRange->GetSignalData() );
		}
      }
    }
    else
    {
      m_mapTargetRangeSignalsSent.erase( it );
    }
  }
}
Beispiel #30
0
UByte msf_send_ppstatusReq(PPIDType to, UByte statusType, UByte * data, UByte dataLength)
{
    SignalType * signal;
    PMIDType pmid;

    if (QuickData[to].EmptyMarker != 0)
        return 1;

    if (dataLength > 100)
        return 2;

    PPID2PMID(&pmid, to);

    NewSignal(sizeof(SignalType) + 1 + dataLength, (void**) &signal);
    getSignalData(signal)[0] = statusType;
    memcpy(getSignalData(signal) + 1, data, dataLength);

    memcpy(signal->Address, pmid, 3);
    SendSignal(signal, APP_SS_PROCESS_ID, APP_SS_PRIMITIVE, SIO_PP_STATUS_req);
    return 0;
}