void OperatorControl(){
		myRobot->ResetDisplacement();

		Drive->SetPriority(1);
		Drive->join();
		Shooter_Intake->SetPriority(2);
		Shooter_Intake->join();

		while(IsOperatorControl() && IsEnabled()){
			Wait(2);
			printf("Teleop");
		}
	}
void RateMonotonicScheduler::ScheduleAll() {
    vector<Task*>::iterator it;
    Task* leastPeriodTask = NULL;

    for (it = m_tasks.begin(); it < m_tasks.end(); it++) {
        (*it)->SetPriority(1);
        if ( (*it)->GetRemaining()>0 && (leastPeriodTask == NULL || ((*it)->GetPeriod() < leastPeriodTask->GetPeriod()))) {
            leastPeriodTask = *it;
        }
    }
    if (leastPeriodTask != NULL) {
        leastPeriodTask->SetPriority(59);
    }
}
Exemple #3
0
Task* TaskFS::FileToTask(entry_ref theEntryRef)
{
	Task*	newTask		=new Task();
	//needed for the "attribute stuff
	BFile	theFile(&theEntryRef,B_READ_ONLY);
	//needed to get out the name
	BEntry	theEntry(&theEntryRef);
	
	bool	completed;
	char	name[B_FILE_NAME_LENGTH];
	BString	taskListID;
	BString	notes;
	uint32	priority;
	time_t	due;
	BString	id;
	BString	url;	
	
	//maby do a check if everything went ok and only if so set the values
	theFile.ReadAttr("META:completed",B_BOOL_TYPE, 0, &completed, sizeof(completed));
	theEntry.GetName(name);
	theFile.ReadAttrString("META:tasks",&taskListID);
	theFile.ReadAttrString("META:notes",&notes);
	theFile.ReadAttr("META:priority", B_UINT32_TYPE, 0, &priority, sizeof(priority));
	theFile.ReadAttr("META:due", B_TIME_TYPE, 0, &due, sizeof(due));
	theFile.ReadAttrString("META:task_id", &id);
	theFile.ReadAttrString("META:task_url",&url);
	
	//** find TaskList from ID//
	
	TaskList *newTaskList = new TaskList("");
	newTaskList->SetID(taskListID);
	newTask->Complete(completed);
	newTask->SetTitle(BString(name));
	newTask->SetTaskList(newTaskList);
	newTask->SetNotes(notes);
	newTask->SetPriority(priority);
	newTask->SetDueTime(due);
	newTask->SetID(id);
	newTask->SetURL(url);
	BMessage *msg = new BMessage();
	msg->AddPointer("task",newTask);
	Looper()->SendNotices(ADD_TASK,msg);
	return newTask;
}