bool QDockWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: undock((QWidget*)static_QUType_ptr.get(_o+1)); break; case 1: undock(); break; case 2: dock(); break; case 3: setOrientation((Orientation)(*((Orientation*)static_QUType_ptr.get(_o+1)))); break; case 4: setCaption((const QString&)static_QUType_QString.get(_o+1)); break; case 5: toggleVisible(); break; default: return QFrame::qt_invoke( _id, _o ); } return TRUE; }
AutoDock::AutoDock(SysLogParser *parser, FemtoTester *tester, QObject *parent) : QObject(parent), m_parser(parser), m_tester(tester), m_dockingState(DockingStateMessage::DockedManually), m_softDockingLimits(0, 0), m_regularDockingLimits(0, 0), m_zeroDockingLimits(0, 0), m_dockingMode(ManualDocking), m_slots(), m_currentSlot(0), m_targetSlot(0), m_servoSpeedUp(0), m_servoSpeedDown(0), m_zForce(0), m_forceIsSteady(false), m_autoDock(false), m_autoUndock(false), m_autoSlotSelect(false) { loadSettings(); connect(tester, SIGNAL(connectedStateChanged(bool)), this, SLOT(loadHwSettings())); connect(tester, SIGNAL(dockingForceChanged(qreal,bool)), this, SLOT(setDockingForce(qreal,bool))); connect(tester, SIGNAL(settingsByteChanged(quint8,quint8)), this, SLOT(onHwByteSettingChanged(quint8,quint8))); connect(tester, SIGNAL(settingsWordChanged(quint8,quint16)), this, SLOT(onHwWordSettingChanged(quint8,quint16))); connect(tester, SIGNAL(settingsArrayChanged(quint8,QByteArray)), this, SLOT(onHwArraySettingChanged(quint8,QByteArray))); connect(tester, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState)), this, SLOT(onDockingStateChange(DockingStateMessage::DockingState))); connect(tester, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState)), this, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState))); connect(m_parser, SIGNAL(dockingModeSelected(AutoDock::DockingMode)), this, SLOT(setDockingMode(AutoDock::DockingMode))); connect(m_parser, SIGNAL(suctionRingVacuumDisabled()), this, SLOT(onTreatmentFinished())); connect(m_parser, SIGNAL(treatmentAborted()), this, SLOT(onTreatmentFinished())); connect(m_parser, SIGNAL(dmsSensorReset()), this, SLOT(undock())); connect(m_parser, SIGNAL(treatmentStarted()), this, SLOT(stop())); // lock when treatment starts }
int main(int argc, char** argv) { ros::init(argc,argv,"pr2_actions"); ros::NodeHandle node_handle; Approach approach(node_handle); Dock dock(node_handle); Undock undock(node_handle); Pick pick(node_handle); Place place(node_handle); ros::spin(); return 0; }
void killb(int qx, int qy) { struct quad *q; struct xy *b; q = &Quad[qx][qy]; if (q->bases <= 0) return; if (!damaged(SSRADIO)) { /* then update starchart */ if (q->scanned < 1000) q->scanned -= 10; else if (q->scanned > 1000) q->scanned = -1; } q->bases = 0; Now.bases -= 1; for (b = Now.base; ; b++) if (qx == b->x && qy == b->y) break; *b = Now.base[Now.bases]; if (qx == Ship.quadx && qy == Ship.quady) { Sect[Etc.starbase.x][Etc.starbase.y] = EMPTY; if (Ship.cond == DOCKED) undock(0); printf("Starbase at %d,%d destroyed\n", Etc.starbase.x, Etc.starbase.y); } else { if (!damaged(SSRADIO)) { printf("Uhura: Starfleet command reports that the " "starbase in\n"); printf(" quadrant %d,%d has been destroyed\n", qx, qy); } else schedule(E_KATSB | E_GHOST, TOOLARGE, qx, qy, 0); } }
void initial_status::update_docking_info() { int i; object *objp = &Objects[Ships[m_ship].objnum]; // remove old info for (i = 0; i < num_dock_points; i++) { // see if the object at this point is no longer there object *dockee_objp = dock_find_object_at_dockpoint(objp, i); if (dockee_objp != NULL) { // check if the dockee ship thinks that this ship is docked to this dock point if (objp != dock_find_object_at_dockpoint(dockee_objp, dockpoint_array[i].dockee_point) ) { // undock it undock(objp, dockee_objp); } } } // add new info for (i = 0; i < num_dock_points; i++) { // see if there is an object at this point that wasn't there before if (dockpoint_array[i].dockee_shipnum >= 0) { if (dock_find_object_at_dockpoint(objp, i) == NULL) { object *dockee_objp = &Objects[Ships[dockpoint_array[i].dockee_shipnum].objnum]; int dockee_point = dockpoint_array[i].dockee_point; // dock it dock(objp, i, dockee_objp, dockee_point); } } } update_map_window(); }
bool FdoSelectionManager::nativeEventFilter(const QByteArray& eventType, void* message, long int* result) { Q_UNUSED(result); if (eventType != "xcb_generic_event_t") { return false; } xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message); auto responseType = XCB_EVENT_RESPONSE_TYPE(ev); if (responseType == XCB_CLIENT_MESSAGE) { auto ce = reinterpret_cast<xcb_client_message_event_t *>(ev); if (ce->type == Xcb::atoms->opcodeAtom) { switch (ce->data.data32[1]) { case SYSTEM_TRAY_REQUEST_DOCK: dock(ce->data.data32[2]); return true; } } } else if (responseType == XCB_UNMAP_NOTIFY) { auto unmappedWId = reinterpret_cast<xcb_unmap_notify_event_t *>(ev)->window; if (m_proxies[unmappedWId]) { undock(unmappedWId); } } else if (responseType == m_damageEventBase + XCB_DAMAGE_NOTIFY) { auto damagedWId = reinterpret_cast<xcb_damage_notify_event_t *>(ev)->drawable; auto sniProx = m_proxies[damagedWId]; Q_ASSERT(sniProx); if(sniProx) { sniProx->update(); xcb_damage_subtract(QX11Info::connection(), m_damageWatches[damagedWId], XCB_NONE, XCB_NONE); } } return false; }
void DockWidget::appexit() { if(docked)undock(); mykapp->quit(); exit(0); }
int main(int argc, char *argv[]) { /*set line buffering of stdout*/ setvbuf(stdout, NULL, _IOLBF, 0); int maxloops; if(argc == 1) maxloops = 100; else maxloops = atoi(argv[1]); printf("EVaura activated for %i mining loops\n", maxloops); /*Initialize random number generator*/ point rsult; points rsults = {0, NULL}; gsl_rng_default_seed = time(NULL); r = gsl_rng_alloc (gsl_rng_default); current_time = time(NULL); int shieldson = 0; int randompulse, pulsetimer; char number_of_belts = 0; char current_belt = 0; char is_belt_toast[20] = {0}; char unable_to_lock = 0; display = XOpenDisplay(NULL); // Open first (-best) display screen = DefaultScreenOfDisplay(display); assert(display); xdodisplay = xdo_new_with_opened_display (display,":0",1); xdo_window_select_with_click(xdodisplay, &EVEwindow); update_screenshot(); //obtain display properties initialize_images(); initialize_ore_tables(); ship *s = &mackinaw; for(int i = 0; i < maxloops; i++){ undock(); //Warp to belt click_on(&menu_belts_inactive, 1, ""); mysleep(500); update_screenshot(); number_of_belts = find_multiple(&aba_menu, NULL); if(number_of_belts < 1){ printf("No belts found!!!\n Docking!"); //dock(); //break; } else printf("We found %i belts\n", number_of_belts); //choose random belt which isn't already depleted while((current_belt = random_int(1, number_of_belts)) && is_belt_toast[(int)current_belt] == 1) { printf("We chosed %i. belt, but is is empty\n", current_belt); } if (findmatch(&menu_name, &rsult) == 0){ click(rsult.X + random_int(0,30), rsult.Y + 19*current_belt, 1, "s"); printf("Warping to %i. belt\n", current_belt); } if(random_int(0,3) > 1) { start_shields(s); shieldson = 1; } else shieldson = 0; wait_for_warp(s); //arrived to belt launch_drones(s); click_on(&menu_mining_inactive, 1, ""); mysleep(1500); lock_nearest_roid(); start_mining(&pulsetimer, &randompulse); if(shieldson == 0) start_shields(s); while(1){ sleep(1); update_screenshot(); if (findmatch(&full_cargo2, NULL) == 0) break; if (findmatch(&invalid_target, NULL) == 0) click_on(&OK, 1, ""); switch (check_roid_lock()) { case 0 : unable_to_lock++; if(unable_to_lock > 6){ printf("We were repeatedly unable to lock anything, this belt is probably toast\n"); //FIXME: this could probably also happen with pirates or roids too far to lock is_belt_toast[(int)current_belt] = 1; i--;//decrease counter, sice this loop wasnt finished goto dock; } printf("we didnt found any locked roids, attempting to lock one\n"); if (lock_best_roid() == 0) { start_mining(&pulsetimer, &randompulse); unable_to_lock = 0; } continue; case 1 : if(find_multiple(&i_mining_laser_active, &rsults) == 0){ start_mining(&pulsetimer, &randompulse); } lock_best_roid(); unable_to_lock = 0; continue; } switch (find_multiple(&i_mining_laser_active, &rsults)) { case 0 : printf("we have a locked roid however lasers were not active\n"); start_mining(&pulsetimer, &randompulse); continue; case 1 : xdo_keysequence(xdodisplay, CURRENTWINDOW, "F1", 5); //pulse random laser, if we are lucky we turn on the right one //if not, we will turn on both next time break; } sleep(2); if ( (time(NULL) - pulsetimer) > randompulse ) { printf("cycling lasers\n"); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F1", 5); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F2", 5); mysleep(1000); update_screenshot(); if (check_roid_lock() == 1) { mysleep(50); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F1", 5); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F2", 5); mysleep(random_int(100,300)); } else if(check_roid_lock() > 1 ){ mouse_move(locked_roids.rsult[0].X, locked_roids.rsult[0].Y); xdo_click(xdodisplay, CURRENTWINDOW, 1); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F1", 5); mysleep(550); mouse_move(locked_roids.rsult[1].X, locked_roids.rsult[1].Y); xdo_click(xdodisplay, CURRENTWINDOW, 1); xdo_keysequence(xdodisplay, CURRENTWINDOW, "F2", 5); } pulsetimer = time(NULL); randompulse = random_int(50,150); } } dock: dock_drones(s);//we can dock while preparing to warp if (click_on(&menu_default_inactive, 1, "") == 0) { printf("defalut menu inactive, clicking on it\n"); mysleep(random_int(800,1200)); } else printf("default menu probably active, no need to click\n"); update_screenshot(); if(click_on(&aba_peace_station, 1, "d") == 0) { printf("found Aba station, attempting a warp\n"); } else printf ("Cant find Aba station, something bad is going on.\n"); wait_for_warp(s); mysleep(10000);//FIXME: new function wait for dock??? for (int i = 0; unload_ore(s) == 1; i++){ mysleep(5000); if(i > 4){ printf("Unable to unload ore\n"); goto exit; } } } exit: if(displayImage) cvReleaseImage(&displayImage); XCloseDisplay(display); return 0; }