Ejemplo n.º 1
0
int
main( int argc, char **argv ) {
    struct timeval start, end;
    rbudpReceiver_t *rbudpReceiver;

    if ( argc < 5 ) {
        printf
        ( "Usage: recvfile <sender> <path to the orig file> <path to the dest file name> <MTU>\n" );
        printf
        ( " \n Example : recvfile <192.168.81.100 /path/to/file/on/sender /path/to/file/on/receiver 9000 \n" );
        exit( 1 );
    }


    rbudpReceiver = malloc( sizeof( rbudpReceiver_t ) );
    memset( rbudpReceiver, 0, sizeof( rbudpReceiver_t ) );

    // the constructor
    QUANTAnet_rbudpReceiver_c( rbudpReceiver, RECEIVE_PORT );

    // the init
    initReceiver( rbudpReceiver, argv[1] );

    printf( "init finishes\n" );
    gettimeofday( &start, NULL );
    QUANTAnet_rbudpBase_c( &rbudpReceiver->rbudpBase );
    getfile( rbudpReceiver, argv[2], argv[3], atoi( argv[4] ) );
    gettimeofday( &end, NULL );
    recvClose( rbudpReceiver );

    printf( "time consumed: %d microseconds\n", USEC( &start, &end ) );
    return 1;
}
Ejemplo n.º 2
0
int main() {
	DWORD t = 0;

	//Needed because a bug in picc-18?
	MIWRL=0;
	MIWRH=0;

	TRISA = 0;
	TRISB = 0;
	TRISC = 0;
	TRISD = 0;
	TRISE = 0;
	TRISF = 0;
	TRISG = 0;
	PORTA=0;
	PORTB=0;
	PORTC=0;
	PORTD=0;
	PORTE=0;
	PORTF=0;

	OSCTUNE = 0x40; //Speed up to 41.67 MHz

	//Turn off AD
	ADCON1 = 0x0F;

#if defined(DEBUG) && defined(_18F87J60)
	initUsart2();
#endif

	initTransmitter();
	initReceiver();
	initPwm();
	initInterrupts();
	initAppConfig();
	initWDT();
	TickInit();
	StackInit();
	//Set the LED on the connector
	SetLEDConfig(0x3742); //See MAC.h for the values

	printf("Telldus TellStick Net v%s\r\n", FIRMWARE_VERSION);

	while(1) {
		StackTask();
		StackApplications();
		if(TickGet() - t >= TICK_SECOND) {
			t = TickGet();
		}
#if defined(DEBUG)
		debugTask();
#endif
		rfReceiveTask();
		discoveryTask();
		ClrWdt();
	}
	return 42;
}
Ejemplo n.º 3
0
void * receiverThread(void* arg)
{
	int lg_message = LG_MESS_DEFAUT;
	
	initReceiver();
	setUser(1);
	while(1)
		recevoir(lg_message, msgRcv);
	return NULL;
}