Esempio n. 1
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
    if (key == 'x') {
        visionImage.grabScreen(10, 10, videoSize.x, videoSize.y);
        visionImage.save("visionImage.png");
    }
    
    if (key == ' ') {
        
        videos[0].setPaused(true);
    }
    if (key == 'n') {
        
        videos[0].setPaused(false);
    }
    
    if (key == '1') {
        choosedCluster = 1;
    }
    
    if (key == '2') {
        choosedCluster = 2;
    }
    
    if (key == '3') {
        choosedCluster = 3;
    }
    
    if (key == '4') {
        choosedCluster = 4;
    }
    
    if (key == 'e') {
        videos[0].setFrame(310000);
    }
    
    if (key == 'a') {
        changeDate("20160905", "r");
    }
    
    if (key == 's') {
        changeDate("20160809", "r");
    }
    
    if (key == 'd') {
        changeDate("20160807", "r");
    }
    
    if (key == 'l') {
        changeDate(targetDate, "d");
    }
    
    if (key == 'k') {
        changeDate(targetDate, "r");
    }
}
Esempio n. 2
0
int changeDateT(char *args, pBackbone BackboneAux, int nArgs, unsigned long len)
{
    pInbound in = malloc(sizeof(Inbound));
    char *temp[1];
    int day;
    char msg[150];
    
    argsSep(temp,args,nArgs);
    
    day = atoi(temp[0]);
    
    if(changeDate(BackboneAux,day))
    {
        sprintf(msg,"%d | System date updated.",BackboneAux->date);
        writeLog(msg,BackboneAux->logger->pid);
        in->valid = 1;
    } else {
        sprintf(msg,"%d | Error: updating system date.",BackboneAux->date);
        writeLog(msg,BackboneAux->logger->pid);
        in->valid = 0;
    }
    if(writePipe(npAdmin,in))
        return 1;
    else
        return 0;
    
}
Esempio n. 3
0
int RTCDue::setYear (uint16_t year)
{
  _day_of_week = calculateDayofWeek( year, getMonth(), getDay() );
  _day_of_week = BIN2BCD( _day_of_week ) << RTC_CALR_DAY_Pos;
  
  _changed = BIN2BCD( year / seperator ) << RTC_CALR_CENT_Pos | BIN2BCD( year % seperator ) << RTC_CALR_YEAR_Pos;
  
  _current_date = ( currentDate() & ~RTC_CALR_DAY_Msk & ~RTC_CALR_YEAR_Msk ) ^ ( _changed | _day_of_week );
  
  return (int)changeDate(_current_date);
}
Esempio n. 4
0
int RTCDue::setMonth (int month)
{
  _day_of_week = calculateDayofWeek( getYear(), _month, getDay() );
  _day_of_week = BIN2BCD( _day_of_week ) << RTC_CALR_DAY_Pos;
  
  _changed = BIN2BCD( month ) << RTC_CALR_MONTH_Pos;
  
  _current_date = ( currentDate() & ~RTC_CALR_DAY_Msk & ~RTC_CALR_MONTH_Msk ) ^ ( _changed | _day_of_week );
  
  return (int)changeDate(_current_date);
}
Esempio n. 5
0
int RTCDue::setDay (int day)
{
  _day_of_week = calculateDayofWeek( getYear(), getMonth(), day );
  _day_of_week = BIN2BCD( _day_of_week ) << RTC_CALR_DAY_Pos;
  
  _changed = BIN2BCD( day ) << RTC_CALR_DATE_Pos;
  
  _current_date = ( currentDate() & ~RTC_CALR_DAY_Msk & ~RTC_CALR_DATE_Msk ) ^ ( _changed | _day_of_week );
  
  return (int)changeDate(_current_date);
}
void EditOccupationsInfosWidget::clickHandler(const QModelIndex& index){
    if(index.column()==remove) deleteRow(index.row());
    else if(index.column()==begin || index.column()==end){
        targetItem=model->item(index.row(),index.column());
	if(calendar) calendar->close();
        calendar=new QCalendarWidget;
        calendar->setWindowFlags(Qt::WindowStaysOnTopHint);
        calendar->show();
        connect(calendar,SIGNAL(clicked(QDate)),this,SLOT(changeDate(QDate)));
        calendar->setSelectedDate((targetItem->text()!="Click")?QDate::fromString(targetItem->text(),"dd/M/yyyy")
                                                         :QDate::currentDate());
        calendar->showSelectedDate();
    }//if
}//clickHandler
 int main()
 {
   //printf("%5d%5.1 f%5d\n", a, b, c);
   struct datum  vandaag;

   struct datum  *ptr_dag;


   vandaag.dag = 9;
   vandaag.maand = 11;
   vandaag.jaar = 2009;
   strcpy(vandaag.dag_naam, "maa");
  
   strcpy(vandaag.maand_naam, "nov");
   ptr_dag = &vandaag;

   printDate(ptr_dag);
   changeDate(ptr_dag);
   printDate(ptr_dag);
   return 0;
 }
Esempio n. 8
0
void HandlerFile::download(string fileName) {
	Date* date1 = Date::newInstance();
	Date date2(prop->getValue("up_date"), Date::DB_FORMAT);
	long dif = (*date1 - date2);
	dif = dif / 86400;
	if (fileExists(fileName.c_str())) {
		if (dif == 0) return;
	}
	CURL *curl;
	CURLcode res;
	curl = curl_easy_init();
	if (!curl) return;
	//set_proxy_settings(curl);//my function




	//read settings file
	////////////////////////////////////
	string rest = prop->getValue("rest_query1")+to_string(dif)+prop->getValue("rest_query2");
	////////////////////////////////////

	//SSL Options
	//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER , 1);
	//curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST , 1);
	//Provide CA Certs from http://curl.haxx.se/docs/caextract.html */
	//curl_easy_setopt(curl, CURLOPT_CAINFO, "G:/LaSpaceProg/SPACETRACK(LIBCURL)/Debug/ca-bundle.crt");
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);

	// Set up a couple initial paramaters that we will not need to mofiy later.
	curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/4.0");
	curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
	curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookie");

	// Visit the login page
	curl_easy_setopt(curl, CURLOPT_URL, "https://www.space-track.org/ajaxauth/login");
	char data[192];
	strcpy(data, "identity=");
	strcat(data, prop->getValue("user").c_str());
	strcat(data, "&password="******"password").c_str());
	curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
	printf("login: "******": %s\n", curl_easy_strerror(res));


	curl_easy_setopt(curl, CURLOPT_HEADER, 0L);
	curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
	FILE *data_file = fopen(fileName.c_str(), "wb");//fopen(files[i].c_str(), "wb");
	curl_easy_setopt(curl, CURLOPT_URL,rest.c_str());
	//cout << "Rest is = " << rest.c_str() << endl;
	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_func);
	curl_easy_setopt(curl, CURLOPT_WRITEDATA, data_file);
	res = curl_easy_perform(curl);
	//if (res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
	//else printf("rest query %2i: %s\n", i, curl_easy_strerror(res));
	fclose(data_file);

	curl_easy_cleanup(curl); //Always cleanup
							 //printf("End. Press any key...\n");
							 //getchar();
	changeDate(*date1, file);
};
Esempio n. 9
0
void Controller::connectMainWindow(){
    QObject::connect(window->getWidget()->calendarWidget, SIGNAL(clicked(QDate)), this, SLOT(changeDate(QDate)));
    QObject::connect(window->getWidget()->addTimeSlotButton, SIGNAL(clicked()), this, SLOT(openEditTimeSlot())); 
    QObject::connect(window->getWidget()->commitButton, SIGNAL(clicked()), this, SLOT(commit()));
    QObject::connect(window->getWidget()->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->comboBoxClassroom, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->comboBoxGroup, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->comboBoxStudent, SIGNAL(currentIndexChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->actionAdministrator, SIGNAL(triggered()), this, SLOT(openAdministrator()));
    QObject::connect(window->getWidget()->checkBoxMagistral, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->checkBoxTutorial, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window->getWidget()->checkBoxPractical, SIGNAL(stateChanged(int)), this, SLOT(tabIndexChanged()));
    QObject::connect(window, SIGNAL(signal_addTimeSlot(QTimeSlot*)), this, SLOT(addQTimeSlot(QTimeSlot*)));
}