// --------------------------------------------------------------------------- // Constructor // Default constructor for class Inventory Inventory::Inventory() { initStorage(); storage[hash('C')] =new BinTree; storage[hash('D')] =new BinTree; storage[hash('F')] = new BinTree; }
CoreInterface::CoreInterface() { EngineInitializer i = makeInit(); core = new EngineCore(i); initVideo(); initStorage(); }
void Core::init() { CoreSettings cs; // legacy QVariantMap dbsettings = cs.storageSettings().toMap(); _configured = initStorage(dbsettings.value("Backend").toString(), dbsettings.value("ConnectionProperties").toMap()); if (Quassel::isOptionSet("select-backend")) { selectBackend(Quassel::optionValue("select-backend")); exit(0); } if (!_configured) { if (!_storageBackends.count()) { qWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting...")); qWarning() << qPrintable(tr("Currently, Quassel supports SQLite3 and PostgreSQL. You need to build your\n" "Qt library with the sqlite or postgres plugin enabled in order for quasselcore\n" "to work.")); exit(1); // TODO make this less brutal (especially for mono client -> popup) } qWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup."; } if (Quassel::isOptionSet("add-user")) { createUser(); exit(0); } if (Quassel::isOptionSet("change-userpass")) { changeUserPass(Quassel::optionValue("change-userpass")); exit(0); } connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); if (!startListening()) exit(1); // TODO make this less brutal if (Quassel::isOptionSet("oidentd")) _oidentdConfigGenerator = new OidentdConfigGenerator(this); }
int initLuaToPython(lua_State* L) { initNumpy(L); initStorage(L); return 0; }
void event_handler( event_type_t event_type, unidata_t unidata ) { char str[32]; unsigned char ch; static int err; switch(event_type) { case KBRD_EVT: // ltoa((int32_t)unidata, str, 10); // OLED_puts(0, 41, 0xff, font6x9, str); if(kbrd_pressed) { kbrd_pressed = 0; //display_node(kbrd_getch()); ch = kbrd_getch(); /* itoa((int16_t)ch, str, 16); OLED_clr(0, 41, 3 * 6, 9); OLED_puts(0, 41, 0xff, font6x9, str); */ if(!(ch & 0x80)) { ch = active.menu->action(ch); active.menu->display(ch); update_statusbar(); } /* switch((ch = kbrd_getch())) { case 1: case 129: display(0, 0); break; case 16: case 144: display(1, 0); break; case 14: if((scroll_pos < (MSG_TABLE_SIZE - MSG_VIEW_SIZE)) && (scroll_pos < msg_count - 1)) { scroll_pos ++; event_emit(LOW_PRIORITY, DISPLAY_EVT, 2); } case 142: break; case 13: if(scroll_pos) { scroll_pos--; event_emit(LOW_PRIORITY, DISPLAY_EVT, 2); } case 141: break; case 11: OLED_cls(); err = initConfig(); //sprintf(str, "initConfig res: %d", err); //OLED_puts(0, 0, 0xff, font6x9, str); OLED_puts(0, 0, 0xff, font6x9, (err ? "initConfig failed" : "initConfig success")); break; case 134: { struct LogEntry entry; err = STRG_SUCCESS; entry.timestamp = 0; err += logAddEntry(&entry, "Msg 0"); entry.timestamp = 1000; err += logAddEntry(&entry, "Msg 1"); entry.timestamp = 2000; err += logAddEntry(&entry, "Msg 2"); sprintf(str, "Error code: %d", err); OLED_puts(0, 2*9, 0xff, font6x9, str); } break; default: display(2, ch); break; // display(0, 0); } */ /* OLED_puts(64 + 12, 41, 0xff, font6x9, "Key pressed "); itoa(kbrd_getch(), str, 10); OLED_puts(64 + 12 + sizeof("Key pressed ") * 6, 41, 0xff, font6x9, str); OLED_puts(64 + 12 + sizeof("Key pressed ") * 6 + strlen(str) * 6, 41, 0xff, font6x9, " "); */ } /* else OLED_puts(0, 41, 0xff, font6x9, "Key not pressed"); */ break; case INIT_EVT: //OLED_init(); //init_kbrd(); SPI_init(); event_emit(LOW_PRIORITY, INIT_MMC_EVT, 0); break; case INIT_MMC_EVT: initMMC(); err = initStorage(); event_emit(LOW_PRIORITY, INIT_OLED_EVT, 0); break; case INIT_OLED_EVT: OLED_init(); OLED_puts(0, 0 , 0xff, font6x9, "System initialization..."); OLED_puts(0, 1 * 9 , 0xff, font6x9, "SPI init'ed."); OLED_puts(0, 2 * 9 , 0xff, font6x9, "MMC init'ed."); OLED_puts(0, 3 * 9 , 0xff, font6x9, "OLED init'ed."); event_emit(LOW_PRIORITY, INIT_STORAGE_EVT, 0); break; case INIT_STORAGE_EVT: //err = initStorage(); //OLED_puts(0, 4 * 9 , 0xff, font6x9, err ? "Storage init failed!" : "Storage init'ed."); format_str(str, 32, "Storage err: %d", err); OLED_puts(0, 4 * 9 , 0xff, font6x9, err ? str : "Storage init'ed."); /* format_str(str, 32, "ZoneCfg pos: %u", syscfg.zone_cfg_addr); OLED_puts(0, 5 * 9 , 0xff, font6x9, str); err = 1; */ event_emit(LOW_PRIORITY, INIT_USER_IO_EVT, 0); break; case INIT_USER_IO_EVT: init_kbrd(); menu_init(err ? MNU_INIT | MNU_DO_NOT_SHOW : MNU_INIT); //set_sys_time((uint64_t)20000); stimer_set(1, 1000); break; } /* else if(event_type == INIT_SEND_MSGS_EVT) { msg_t msg; struct msginfo minfo; uint16_t addr_attr = 0x0000; uint8_t port_attr = PORT; //attr_write(0x02, &addr_attr); //attr_write(0x07, &port_attr); // This must be the code for us to say ZigZag (Node Dispatcher) // that we are interested in listening for messages and events msg = msg_new(0x00, 0x00, 0x01, 3, MFLAG_DEFAULT); if(msg < 0) OLED_puts(0, 0, 0xff, font6x9, "Error: msg_new"); if(msg_info(msg, &minfo) != ENOERR) OLED_puts(0, 9, 0xff, font6x9, "Error: msg_info"); ((unsigned char *)minfo.body_ptr)[0] = 0x02; ((unsigned char *)minfo.body_ptr)[1] = 0x00; ((unsigned char *)minfo.body_ptr)[2] = 0x00; if(msg_send(msg) != ENOERR) OLED_puts(0, 18, 0xff, font6x9, "Error: msg_send (1)"); msg = msg_new(0x00, 0x00, 0x01, 2, MFLAG_DEFAULT); if(msg < 0) OLED_puts(0, 0, 0xff, font6x9, "Error: msg_new"); if(msg_info(msg, &minfo) != ENOERR) OLED_puts(0, 9, 0xff, font6x9, "Error: msg_info"); ((unsigned char *)minfo.body_ptr)[0] = 0x07; ((unsigned char *)minfo.body_ptr)[1] = (uint8_t)PORT; // ((unsigned char *)minfo.body_ptr)[2] = (uint8_t)(PORT >> 8); if(msg_send(msg) != ENOERR) OLED_puts(0, 18, 0xff, font6x9, "Error: msg_send (2)"); } */ /* else { //sprintf(str, "Evt: %u", (uint16_t)event_type); //OLED_puts(0, 0, 0xff, font6x9, str); } */ }