示例#1
0
文件: test.c 项目: gherlein/libcf2
int main(void)
{

	openRadio();
	printf("success\n");

	uint8_t header;
	CRTPPacket p;
	CRTPPacket* r;
	uint8_t port=0;
	uint8_t channel=0;

	int x;

	x=scanChannels();


	x=getNumberOfMems();
	

/*
	for(int x=0;x<1;x++)
	{
		x=sendCommander(0.0,0.0,0.0,15000);
		sleep(1);
	}

	sleep(15);
*/
	closeRadio();
	return 0;
}
示例#2
0
RadioManagerOld::~RadioManagerOld()
{
	if(status !=RM_STATUS_INIT)
	{
		closeRadio();
	}
}
示例#3
0
int RadioManagerOld::stopSearch()
{
    //printf("[radio][%4d] ~~~~~~~~~~~~~~~~~stopSearch  \n", __LINE__, RM_SEARCH_R_CANCEL);
	if(status !=RM_STATUS_SEARCH)
		return RM_R_OK;

	killTimer(timeId);
	

	status = RM_STATUS_LISTEN;
	if(listenedChannel !=0)
	{
		if(freqSection ==RM_FREQ_SECTION_FM)
			selectFMChannel(listenedChannel,0);
		else
			selectAMChannel(listenedChannel,0);
		
	}
	else
	{
		closeRadio();
	}
	
	emit searchChannelChanged(currentSearchChannel,0);
    //printf("[radio][%4d] ~~~~~~~~~~~~~~~~~searchEnd cause[%d]   \n", __LINE__, RM_SEARCH_R_CANCEL);
	emit searchEnd(RM_SEARCH_R_CANCEL);

	return RM_R_OK;
}
示例#4
0
void loop() {
	while(1){
		sendString(Time, Latitude, Longitude, Altitude, internalTemp, externalTemp, NumSatalites, pressure, geigerCount, ADCValue[0]);
		getADCValue(0);
		getTemperature();
		readBMP085();
		readGeigerCount();
		//printf("UV: %i Temp: %F Lat: %F Long: %F Alt: %F SatNu: %i Pressure %i iTemp %F GMC: %i\n", ADCValue[0], externalTemp, Latitude, Longitude, Altitude, NumSatalites, pressure, internalTemp, geigerCount);
		closeRadio();
		getGPS();
		//sleep(1);
	}
}
示例#5
0
void RadioManagerOld::searchNextChannel()
{
	printf("+++++++++++++++++++++++RadioManagerOld::searchNextChannel+++++++++++++++++++++\n");
	int nextSearchInterval =RM_AM_SEARCH_INTERVAL;
	if(freqSection == RM_FREQ_SECTION_FM)
		nextSearchInterval =RM_FM_SEARCH_INTERVAL;

	lastSearchChannel =currentSearchChannel;

	if(freqSection ==RM_FREQ_SECTION_FM)
	{
		currentSearchChannel +=RM_FM_FREQ_STEP;
		if(currentSearchChannel>RM_FM_FREQ_MAX)
		{
			currentSearchChannel=0;
		}
	}
	else
	{
		currentSearchChannel +=RM_AM_FREQ_STEP;
		if(currentSearchChannel>RM_AM_FREQ_MAX)
		{
			currentSearchChannel=0;
		}
	}

    printf("~~~~~~~~~~~~~~~~~lastSearchChannel[%d] currentSearchChannel[%d]\n", lastSearchChannel, currentSearchChannel);

	
	if ( currentSearchChannel > 107900 )
	{
		currentSearchChannel=0;
	}
	

	emit searchChannelChanged(lastSearchChannel,currentSearchChannel);

	if(currentSearchChannel>0)
	{
		if(m_voiceSwithFunction!=NULL &&  m_voiceStatus ==RM_VOICE_SWITCH_ON)
		{
			m_voiceSwithFunction(RM_VOICE_SWITCH_OFF,m_voiceSwithUserData);
			m_voiceStatus =RM_VOICE_SWITCH_OFF;
		}

		if(freqSection ==RM_FREQ_SECTION_FM)
			searchFMChannel(currentSearchChannel,1);
		else
			searchAMChannel(currentSearchChannel, 1);

		timeId =startTimer(nextSearchInterval);
	}
	else
	{
		if(listenedChannel!=0)
		{
			if(m_voiceSwithFunction!=NULL)
				m_voiceSwithFunction(RM_VOICE_SWITCH_ON,m_voiceSwithUserData);

			if(freqSection ==RM_FREQ_SECTION_FM)
				selectFMChannel(listenedChannel,0);
			else
				selectAMChannel(listenedChannel,0);

			status =RM_STATUS_LISTEN;
		}
		else
		{
			closeRadio();
		}
        printf("~~~~~~~~~~~~~~~~~searchEnd Normally   \n");
		emit searchEnd(RM_SEARCH_R_OK);
	}

	printf("~~~~~~~~~~~~~~~~~searchEnd   returnm%d %d \n", lastSearchChannel, currentSearchChannel);
        return;
}