static int read_air(void *user_data, harp_array data) { ingest_info *info = (ingest_info *)user_data; if (info->model_air) { return get_profile(info, "nl_geolocation", "tangent_density", data); } return get_profile(info, "nl_local_species_density", "air", data); }
static int read_temperature(void *user_data, harp_array data) { ingest_info *info = (ingest_info *)user_data; if (info->model_temperature) { return get_profile(info, "nl_geolocation", "tangent_temp", data); } return get_profile(info, "nl_geolocation", "local_temp", data); }
TIDorb::core::iop::IOR::IOR(const char* id, const VectorTaggedProfile* profiles) throw (TIDThr::SystemException) { has_hash_code = false; hash_code = 0; _profiles = *profiles; _type_id = CORBA::string_dup(id); _ior_string = NULL; _profile_IIOP = NULL; _profile_IIOP_searched = false; _profile_IIOP_position = 0; // MIOP extensions _profile_MIOP = NULL; _profile_MIOP_searched = false; _profile_MIOP_position = 0; _ZIOP_searched = false; _has_ZIOP_policies = false; // Profile IIOP { CORBA::ULong count = member_count(); ((IOR*) this)->_profile_IIOP_searched = true; for (CORBA::ULong number = 0; number < count; number++) { if (get_profile(number)->_tag == TIDorb::core::iop::TAG_INTERNET_IOP){ ((IOR*) this)->_profile_IIOP_searched = false; ((IOR*) this)->_profile_IIOP_position = number; ((IOR*) this)->_profile_IIOP = (TIDorb::core::comm::iiop::ProfileIIOP*)(get_profile(number)); } } } // Profile MIOP { CORBA::ULong count = member_count(); ((IOR*) this)->_profile_MIOP_searched = true; for (CORBA::ULong number = 0; number < count; number++) { if (get_profile(number)->_tag == TIDorb::core::iop::TAG_UIPMC) { ((IOR*) this)->_profile_MIOP_position = number; ((IOR*) this)->_profile_MIOP = (TIDorb::core::comm::miop::ProfileMIOP*)(get_profile(number)); ((IOR*) this)->_profile_MIOP_searched = false; } } } }
CMPIStatus enum_profiles(const CMPIBroker *broker, const CMPIObjectPath *reference, const char **properties, struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) goto out; for (i = 0; profiles[i] != NULL; i++) { CMPIInstance *inst = NULL; s = get_profile(broker, reference, properties, pfx_from_conn(conn), profiles[i], &inst); if (s.rc != CMPI_RC_OK) continue; inst_list_add(list, inst); } out: virConnectClose(conn); return s; }
bool MailEditorMainWindow::onSave() { ui->messageEdit->document()->setModified(false); TPhysicalMailMessage msg; if(prepareMailMessage(&msg)) { if(!isMsgSizeOK(msg)) { ui->messageEdit->document()->setModified(true); return false; } const IMailProcessor::TIdentity& senderId = MailFields->GetSenderIdentity(); auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); if(0 == idents.size()) { QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Keyhotee"), tr("Cannot save this draft. No Identity is present.\nPlease create an Identity to save this draft"), QMessageBox::Ok); return false; } //DLN we should probably add get_pointer implementation to fc::optional to avoid code like this TStoredMailMessage* oldMessage = DraftMessage.valid() ? &(*DraftMessage) : nullptr; DraftMessage = MailProcessor.Save(senderId, msg, oldMessage); } return true; }
/** * @brief * Don't need any periodic processing. */ void end_proc() { DWORD now, delta; DWORD nrun; now = timeGetTime(); delta = now - last_time; if (delta <= SAMPLE_DELTA*1000) { return; } wait_time = SAMPLE_DELTA; if (!get_profile(&mom_prof)) { return; } nrun = mom_prof.value + num_acpus + nrun_factor; load = ((load * CEXP) + (nrun * (FSCALE - CEXP) * FSCALE)) >> PROF_FSHIFT; DBPRT(("load = %d, mom_prof=%d num_acpus=%d nrun_factor=%d", load, mom_prof.value, num_acpus, nrun_factor)) last_time = now; return; }
/** * gnutls_srtp_get_keys: * @session: is a #gnutls_session_t type. * @key_material: Space to hold the generated key material * @key_material_size: The maximum size of the key material * @client_key: The master client write key, pointing inside the key material * @server_key: The master server write key, pointing inside the key material * @client_salt: The master client write salt, pointing inside the key material * @server_salt: The master server write salt, pointing inside the key material * * This is a helper function to generate the keying material for SRTP. * It requires the space of the key material to be pre-allocated (should be at least * 2x the maximum key size and salt size). The @client_key, @client_salt, @server_key * and @server_salt are convenience datums that point inside the key material. They may * be %NULL. * * Returns: On success the size of the key material is returned, * otherwise, %GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not * sufficient, or a negative error code. * * Since 3.1.4 **/ int gnutls_srtp_get_keys(gnutls_session_t session, void *key_material, unsigned int key_material_size, gnutls_datum_t * client_key, gnutls_datum_t * client_salt, gnutls_datum_t * server_key, gnutls_datum_t * server_salt) { int ret; const srtp_profile_st *p; gnutls_srtp_profile_t profile; unsigned int msize; uint8_t *km = key_material; ret = gnutls_srtp_get_selected_profile(session, &profile); if (ret < 0) return gnutls_assert_val(ret); p = get_profile(profile); if (p == NULL) return gnutls_assert_val(GNUTLS_E_UNKNOWN_ALGORITHM); msize = 2 * (p->key_length + p->salt_length); if (msize > key_material_size) return gnutls_assert_val(GNUTLS_E_SHORT_MEMORY_BUFFER); if (msize == 0) return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); ret = gnutls_prf(session, sizeof("EXTRACTOR-dtls_srtp") - 1, "EXTRACTOR-dtls_srtp", 0, 0, NULL, msize, key_material); if (ret < 0) return gnutls_assert_val(ret); if (client_key) { client_key->data = km; client_key->size = p->key_length; } if (server_key) { server_key->data = km + p->key_length; server_key->size = p->key_length; } if (client_salt) { client_salt->data = km + 2 * p->key_length; client_salt->size = p->salt_length; } if (server_salt) { server_salt->data = km + 2 * p->key_length + p->salt_length; server_salt->size = p->salt_length; } return msize; }
SwitcherMode profile_switcher_dialog ( char **input ) { SwitcherMode retv = MODE_EXIT; // act as a launcher char **cmd_list = get_profile( ); if ( cmd_list == NULL ) { unsigned int retv_index = 0; cmd_list = add_elements( cmd_list, "No profiles found", &retv_index ); } int shift=0; int selected_line = 0; int retvm = menu( cmd_list, input, "profile:", NULL, &shift,token_match, NULL, &selected_line ); if ( retvm == MENU_NEXT ) { retv = NEXT_DIALOG; } else if ( retvm == MENU_OK && cmd_list[selected_line] != NULL ) { exec_profile( cmd_list[selected_line] ); } for ( int i=0; cmd_list[i] != NULL; i++ ) { free( cmd_list[i] ); } free( cmd_list ); return retv; }
void ContactView::checkSendMailButton() { auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); send_mail->setEnabled(idents.size() > 0); }
void convert(rs2::frameset& frameset) override { start_worker( [this, &frameset] { for (size_t i = 0; i < frameset.size(); i++) { auto frame = frameset[i].as<rs2::depth_frame>(); if (frame && (_streamType == rs2_stream::RS2_STREAM_ANY || frame.get_profile().stream_type() == _streamType)) { if (frames_map_get_and_set(frame.get_profile().stream_type(), frame.get_frame_number())) { continue; } std::stringstream filename; filename << _filePath << "_" << frame.get_profile().stream_name() << "_" << frame.get_frame_number() << ".csv"; std::string filenameS = filename.str(); add_sub_worker( [filenameS, frame] { std::ofstream fs(filenameS, std::ios::trunc); if (fs) { for (int y = 0; y < frame.get_height(); y++) { auto delim = ""; for (int x = 0; x < frame.get_width(); x++) { fs << delim << frame.get_distance(x, y); delim = ","; } fs << '\n'; } fs.flush(); } }); } } wait_sub_workers(); }); }
/** * gnutls_srtp_get_profile_name * @profile: The profile to look up a string for * * This function allows you to get the corresponding name for a * SRTP protection profile. * * Returns: On success, the name of a SRTP profile as a string, * otherwise NULL. * * Since 3.1.4 **/ const char *gnutls_srtp_get_profile_name(gnutls_srtp_profile_t profile) { const srtp_profile_st *p = get_profile(profile); if (p != NULL) return p->name; return NULL; }
void ContactView::checkSendMailButton() { auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); send_mail->setEnabled(idents.size() > 0); request_contact->setEnabled(idents.size() > 0 && !_current_contact.isOwn() && !isEditing()); }
void ribo_model::compute_transcript_abundance(rid_t t, const vector<double>& count) { vector<double> c(count); const vector<double>& p = get_profile(t); double a(0), b(0); //, c(0); for (size_t i=0; i!=p.size(); ++i) { a += std::pow(p[i], 2); b -= 2*p[i]*c[i]; //c += std::pow(count[i],2); } double tcnt = -b/(2*a); assert(tcnt>=0); set_tcnt(t,tcnt); }
CMPIStatus get_profile_by_name(const CMPIBroker *broker, const CMPIObjectPath *reference, const char *name, const char **properties, CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; int i; bool found = false; conn = connect_by_classname(broker, CLASSNAME(reference), &s); if (conn == NULL) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, "No such instance"); goto out; } for (i = 0; profiles[i] != NULL; i++) { if(STREQ(name, profiles[i]->reg_id)) { CMPIInstance *inst = NULL; s = get_profile(broker, reference, properties, pfx_from_conn(conn), profiles[i], &inst); if (s.rc != CMPI_RC_OK) goto out; *_inst = inst; found = true; break; } } if (found == false) cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, "No such instance (%s)", name); out: virConnectClose(conn); return s; }
void Profiling_Tracer::record_for_profile(Oop meth, Oop rcvr, bool is_block) { if (Logical_Core::num_cores > 1) return; static std::string lastSignature; std::map<std::string, int>* profile; #warning Stefan: warning, not threadsafe get_profile(&profile); static char buff[2024]; StringPrinter p(buff, 2023); Oop klass = rcvr.fetchClass(); Oop sel, mclass; bool have_sel_and_mclass = klass.as_object()->selector_and_class_of_method_in_me_or_ancestors(meth, &sel, &mclass); if (!have_sel_and_mclass) return; if (mclass == The_Squeak_Interpreter()->roots.nilObj) mclass = rcvr.fetchClass(); rcvr.print(&p); if (mclass != klass) { p.printf("("); bool is_meta; Oop mclassName = mclass.as_object()->name_of_class_or_metaclass(&is_meta); if (is_meta) p.printf("class "); mclassName.as_object()->print_bytes(&p); p.printf(")"); } p.printf(">>"); sel.as_object()->print_bytes(&p); if (is_block) p.printf("[]"); buff[2023] = 0; std::string signature(buff); if (lastSignature != signature) { lastSignature = signature; ++(*profile)[lastSignature]; } // STEFAN: a little hack to be able to get the printout during debugging, any better ways to do so? static bool print_profile = false; if (print_profile) { this->print_profile(debug_printer); } }
void ContactView::sendChatMessage() { auto msg = ui->chat_input->toPlainText(); if (msg.size() != 0) { auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); bts::bitchat::private_text_message text_msg(msg.toUtf8().constData() ); if (idents.size() ) { fc::ecc::private_key my_priv_key = profile->get_keychain().get_identity_key(idents[0].dac_id_string); app->send_text_message(text_msg, _current_contact.public_key, my_priv_key); appendChatMessage("me", msg); } ui->chat_input->setPlainText(QString()); } }
void Profiling_Tracer::print() { Execution_Tracer::print(); if (Logical_Core::num_cores > 1) return; std::map<std::string, int>* profile; get_profile(&profile); for(std::map<std::string, int>::const_iterator it = profile->begin(); it != profile->end(); ++it) { debug_printer->printf(it->first.c_str()); debug_printer->printf(","); debug_printer->printf("%d", it->second); debug_printer->printf("\n"); } }
void ContactsTable::onDeleteContact() { //remove selected contacts from inbox model (and database) QSortFilterProxyModel* model = dynamic_cast<QSortFilterProxyModel*>(ui->contact_table->model()); //model->setUpdatesEnabled(false); QItemSelectionModel* selection_model = ui->contact_table->selectionModel(); QModelIndexList sortFilterIndexes = selection_model->selectedRows(); if (sortFilterIndexes.count() == 0) return; if (QMessageBox::question(this, tr("Delete Contact"), tr("Are you sure you want to delete selected contact(s)?")) == QMessageBox::Button::No) return; QModelIndexList indexes; for(const QModelIndex& sortFilterIndex : sortFilterIndexes) indexes.append(model->mapToSource(sortFilterIndex)); qSort(indexes); auto sourceModel = model->sourceModel(); auto app = bts::application::instance(); auto profile = app->get_profile(); for (int i = indexes.count() - 1; i > -1; --i) { auto contact_id = ((AddressBookModel*)sourceModel)->getContact(indexes.at(i)).wallet_index; if(profile->isIdentityPresent(((AddressBookModel*)sourceModel)->getContact(indexes.at(i)).dac_id_string)) { auto priv_key = profile->get_keychain().get_identity_key(((AddressBookModel*)sourceModel)->getContact(indexes.at(i)).dac_id_string); app->remove_receive_key(priv_key); profile->removeIdentity(((AddressBookModel*)sourceModel)->getContact(indexes.at(i)).dac_id_string); /// notify identity observers IdentityObservable::getInstance().notify(); } sourceModel->removeRows(indexes.at(i).row(), 1); Q_EMIT contactDeleted(contact_id); //emit signal so that ContactGui is also deleted } //model->setUpdatesEnabled(true); //TODO Remove fullname/bitname for deleted contacts from QCompleter qSort(sortFilterIndexes); selectNextRow(sortFilterIndexes.takeLast().row(), indexes.count()); }
void NewIdentityDialog::onSave() { //store new identity in profile auto app = bts::application::instance(); auto profile = app->get_profile(); auto trim_dac_id = fc::trim(ui->username->text().toUtf8().constData()); bts::addressbook::wallet_identity ident; ident.first_name = fc::trim( ui->firstname->text().toUtf8().constData() ); ident.last_name = fc::trim( ui->lastname->text().toUtf8().constData() ); ident.mining_effort = ui->register_checkbox->isChecked(); ident.wallet_ident = trim_dac_id; ident.set_dac_id( trim_dac_id ); auto priv_key = profile->get_keychain().get_identity_key(trim_dac_id); ident.public_key = priv_key.get_public_key(); profile->store_identity( ident ); try { app->mine_name(trim_dac_id, profile->get_keychain().get_identity_key(trim_dac_id).get_public_key(), ident.mining_effort); } catch ( const fc::exception& e ) { wlog( "${e}", ("e",e.to_detail_string()) ); } //store contact for new identity bts::addressbook::wallet_contact myself; //copy common fields from new identity into contact static_cast<bts::addressbook::contact&>(myself) = ident; //fill in remaining fields for contact myself.first_name = ident.first_name; myself.last_name = ident.last_name; // profile->get_addressbook()->store_contact(Contact(myself)); TKeyhoteeApplication::getInstance()->getMainWindow()->getAddressBookModel()->storeContact( Contact(myself) ); app->add_receive_key(priv_key); }
/** AVCodecContext.get_format() implementation */ static enum PixelFormat gst_vaapi_decoder_ffmpeg_get_format(AVCodecContext *avctx, const enum PixelFormat *fmt) { GstVaapiContextFfmpeg * const vactx = avctx->hwaccel_context; GstVaapiProfile profile; GstVaapiEntrypoint entrypoint; guint i; /* XXX: only VLD entrypoint is supported at this time */ for (i = 0; fmt[i] != PIX_FMT_NONE; i++) { entrypoint = get_entrypoint(fmt[i]); if (entrypoint != GST_VAAPI_ENTRYPOINT_VLD) continue; profile = get_profile(avctx, entrypoint); if (profile) { vactx->profile = profile; vactx->entrypoint = entrypoint; return fmt[i]; } } return PIX_FMT_NONE; }
/* Gets config attribute for the supplied profile */ static gboolean get_config_attribute (GstVaapiEncoder * encoder, VAConfigAttribType type, guint * out_value_ptr) { GstVaapiProfile profile; VAProfile va_profile; VAEntrypoint va_entrypoint; const GstVaapiEncoderClassData *const cdata = GST_VAAPI_ENCODER_GET_CLASS (encoder)->class_data; profile = get_profile (encoder); if (!profile) return FALSE; va_profile = gst_vaapi_profile_get_va_profile (profile); if (cdata->codec != GST_VAAPI_CODEC_JPEG) va_entrypoint = VAEntrypointEncSlice; else va_entrypoint = VAEntrypointEncPicture; return gst_vaapi_get_config_attribute (encoder->display, va_profile, va_entrypoint, type, out_value_ptr); }
/** \brief Launch a upnp_call_delport_t * * - this is a special case used by upnp_bindport_t because the upnp_call_delport_t * is launched in the upnp_bindport_t dtor. * - so the upnp_delport_t is linked in the upnp_watch_t * - the callback is returned here too * - the disc_res_4del is used to launcht the upnp_call_delport_t * - this is important due to a kludge in upnp_getportendian_test_t * - at this point, upnp_watch_t has no upnp_disc_res_t so the upnp_getportendian_test_t * provides one */ upnp_err_t upnp_watch_t::launch_delport(uint16_t port_pview, const upnp_sockfam_t &sock_fam , const upnp_disc_res_t &disc_res_4del) throw() { upnp_call_delport_t * call_delport; upnp_err_t upnp_err; // log to debug KLOG_DBG("enter port_pview="<< port_pview << " sock_fam=" << sock_fam); // sanity check - upnp_disc_res_t MUST NOT be null DBG_ASSERT( !disc_res_4del.is_null() ); // create a upnp_call_delport_t call_delport = nipmem_new upnp_call_delport_t(); upnp_err = call_delport->set_profile(get_profile().call()) .start(disc_res_4del, port_pview, sock_fam, this, NULL); if( upnp_err.failed() ){ // delete the object nipmem_zdelete call_delport; // return the error return upnp_err; } // link it to the call_delport_db call_delport_db.push_back(call_delport); // return no error return upnp_err_t::OK; }
static int read_extinction_coefficient(void *user_data, harp_array data) { return get_profile((ingest_info *)user_data, "nl_aerosols", "local_ext", data); }
XCamReturn CL3aImageProcessor::create_handlers () { SmartPtr<CLImageHandler> image_handler; SmartPtr<CLContext> context = get_cl_context (); XCAM_ASSERT (context.ptr ()); #if 1 /* bayer pipeline */ image_handler = create_cl_bayer_pipe_image_handler (context); _bayer_pipe = image_handler.dynamic_cast_ptr<CLBayerPipeImageHandler> (); XCAM_FAIL_RETURN ( WARNING, image_handler.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create bayer pipe handler failed"); _bayer_pipe->set_stats_callback (_stats_callback); #if 0 if (get_profile () >= AdvancedPipelineProfile) { _bayer_pipe->set_output_format (V4L2_PIX_FMT_ABGR32); } #endif _bayer_pipe->enable_denoise (XCAM_DENOISE_TYPE_BNR & _snr_mode); _bayer_pipe->enable_gamma (_enable_gamma); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE * 2); add_handler (image_handler); if(_capture_stage == BasicbayerStage) return XCAM_RETURN_NO_ERROR; #else /* black leve as first */ image_handler = create_cl_blc_image_handler (context); _black_level = image_handler.dynamic_cast_ptr<CLBlcImageHandler> (); XCAM_FAIL_RETURN ( WARNING, image_handler.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create blc handler failed"); add_handler (image_handler); image_handler = create_cl_dpc_image_handler (context); _dpc = image_handler.dynamic_cast_ptr<CLDpcImageHandler> (); XCAM_FAIL_RETURN ( WARNING, image_handler.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create dpc handler failed"); _dpc->set_kernels_enable(_enable_dpc); add_handler (image_handler); image_handler = create_cl_bnr_image_handler (context); _bnr = image_handler.dynamic_cast_ptr<CLBnrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _bnr.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create bnr handler failed"); _bnr->set_kernels_enable (XCAM_DENOISE_TYPE_BNR & _snr_mode); add_handler (image_handler); image_handler = create_cl_3a_stats_image_handler (context); _x3a_stats_calculator = image_handler.dynamic_cast_ptr<CL3AStatsCalculator> (); XCAM_FAIL_RETURN ( WARNING, _x3a_stats_calculator.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create 3a stats calculator failed"); _x3a_stats_calculator->set_stats_callback (_stats_callback); add_handler (image_handler); image_handler = create_cl_wb_image_handler (context); _wb = image_handler.dynamic_cast_ptr<CLWbImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _wb.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create whitebalance handler failed"); add_handler (image_handler); /* gamma */ image_handler = create_cl_gamma_image_handler (context); _gamma = image_handler.dynamic_cast_ptr<CLGammaImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _gamma.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create gamma handler failed"); _gamma->set_kernels_enable (_enable_gamma); add_handler (image_handler); /* hdr */ image_handler = create_cl_hdr_image_handler (context, CL_HDR_DISABLE); _hdr = image_handler.dynamic_cast_ptr<CLHdrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _hdr.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create hdr handler failed"); if(_hdr_mode == CL_HDR_TYPE_RGB) _hdr->set_mode (_hdr_mode); add_handler (image_handler); /* demosaic */ image_handler = create_cl_demosaic_image_handler (context); _demosaic = image_handler.dynamic_cast_ptr<CLBayer2RGBImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _demosaic.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create demosaic handler failed"); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); #endif /* hdr-lab*/ image_handler = create_cl_hdr_image_handler (context, CL_HDR_DISABLE); _hdr = image_handler.dynamic_cast_ptr<CLHdrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _hdr.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create hdr handler failed"); if(_hdr_mode == CL_HDR_TYPE_LAB) _hdr->set_mode (_hdr_mode); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); /* bilateral noise reduction */ image_handler = create_cl_denoise_image_handler (context); _binr = image_handler.dynamic_cast_ptr<CLDenoiseImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _binr.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create denoise handler failed"); _binr->set_kernels_enable (XCAM_DENOISE_TYPE_BILATERAL & _snr_mode); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); #if 0 image_handler = create_cl_rgb_pipe_image_handler (context); _rgb_pipe = image_handler.dynamic_cast_ptr<CLRgbPipeImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _rgb_pipe.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create rgb pipe handler failed"); _rgb_pipe->set_kernels_enable (get_profile () >= AdvancedPipelineProfile); add_handler (image_handler); /* Temporal Noise Reduction (RGB domain) */ image_handler = create_cl_tnr_image_handler(context, CL_TNR_TYPE_RGB); _tnr_rgb = image_handler.dynamic_cast_ptr<CLTnrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _tnr_rgb.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create tnr handler failed"); _tnr_rgb->set_mode (CL_TNR_TYPE_RGB & _tnr_mode); add_handler (image_handler); #else /* simple noise reduction */ image_handler = create_cl_snr_image_handler (context); _snr = image_handler.dynamic_cast_ptr<CLSnrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _snr.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create snr handler failed"); _snr->set_kernels_enable (XCAM_DENOISE_TYPE_SIMPLE & _snr_mode); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); #endif /* tone mapping*/ image_handler = create_cl_tonemapping_image_handler (context); _tonemapping = image_handler.dynamic_cast_ptr<CLTonemappingImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _tonemapping.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create tonemapping handler failed"); _tonemapping->set_kernels_enable (_enable_tonemapping); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); #if 1 image_handler = create_cl_yuv_pipe_image_handler (context); _yuv_pipe = image_handler.dynamic_cast_ptr<CLYuvPipeImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _yuv_pipe.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create macc handler failed"); _yuv_pipe->set_tnr_enable (_tnr_mode & CL_TNR_TYPE_RGB, _tnr_mode & CL_TNR_TYPE_YUV); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); #else /* macc */ image_handler = create_cl_macc_image_handler (context); _macc = image_handler.dynamic_cast_ptr<CLMaccImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _macc.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create macc handler failed"); _macc->set_kernels_enable (_enable_macc); add_handler (image_handler); /* color space conversion */ image_handler = create_cl_csc_image_handler (context, CL_CSC_TYPE_RGBATONV12); _csc = image_handler.dynamic_cast_ptr<CLCscImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _csc .ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create csc handler failed"); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); add_handler (image_handler); /* Temporal Noise Reduction (YUV domain) */ image_handler = create_cl_tnr_image_handler(context, CL_TNR_TYPE_YUV); _tnr_yuv = image_handler.dynamic_cast_ptr<CLTnrImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _tnr_yuv.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create tnr handler failed"); _tnr_yuv->set_mode (CL_TNR_TYPE_YUV & _tnr_mode); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); add_handler (image_handler); #endif /* ee */ image_handler = create_cl_ee_image_handler (context); _ee = image_handler.dynamic_cast_ptr<CLEeImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _ee.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create ee handler failed"); _ee->set_kernels_enable (XCAM_DENOISE_TYPE_EE & _snr_mode); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); /* biyuv */ image_handler = create_cl_biyuv_image_handler (context); _biyuv = image_handler.dynamic_cast_ptr<CLBiyuvImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _biyuv.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create biyuv handler failed"); _biyuv->set_kernels_enable (XCAM_DENOISE_TYPE_BIYUV & _snr_mode); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); /* image scaler */ image_handler = create_cl_image_scaler_handler (context, V4L2_PIX_FMT_NV12); _scaler = image_handler.dynamic_cast_ptr<CLImageScaler> (); XCAM_FAIL_RETURN ( WARNING, _scaler.ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create scaler handler failed"); _scaler->set_scaler_factor (XCAM_CL_3A_IMAGE_SCALER_FACTOR); _scaler->set_buffer_callback (_stats_callback); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); image_handler->set_kernels_enable (false); add_handler (image_handler); if (_out_smaple_type == OutSampleRGB) { image_handler = create_cl_csc_image_handler (context, CL_CSC_TYPE_NV12TORGBA); _csc = image_handler.dynamic_cast_ptr<CLCscImageHandler> (); XCAM_FAIL_RETURN ( WARNING, _csc .ptr (), XCAM_RETURN_ERROR_CL, "CL3aImageProcessor create csc handler failed"); image_handler->set_pool_type (CLImageHandler::DrmBoPoolType); image_handler->set_pool_size (XCAM_CL_3A_IMAGE_MAX_POOL_SIZE); add_handler (image_handler); } return XCAM_RETURN_NO_ERROR; }
/** \brief callback notified by \ref upnp_disc_t on completio\n */ bool upnp_watch_t::neoip_upnp_disc_cb(void *cb_userptr, upnp_disc_t &cb_disc , const upnp_err_t &cb_upnp_err , const upnp_disc_res_t ¬ified_disc_res) throw() { upnp_err_t upnp_err = cb_upnp_err; // log to debug KLOG_DBG("enter upnp_err=" << upnp_err << " disc_res=" << notified_disc_res); // sanity check - if upnp_err.succeed() then disc_res MUST be non-null if( upnp_err.succeed() ) DBG_ASSERT( !notified_disc_res.is_null() ); // sanity check - if upnp_err.failed() then disc_res MUST be null if( upnp_err.failed() ) DBG_ASSERT( notified_disc_res.is_null() ); // sanity check - the disc_timeout MUST NOT be running during upnp_disc_t execution DBG_ASSERT( !disc_timeout.is_running() ); // determine if the upnp_disc_res_t changed or not bool res_changed; if( notified_disc_res == current_disc_res() ) res_changed = false; else res_changed = true; #if 1 // TODO to remove - only to debug assert failing in some case of UPNP_CHANGED upnp_disc_res_t old_disc_res = m_current_disc_res; #endif // copy the new upnp_disc_res_t m_current_disc_res = notified_disc_res; // delete the upnp_disc_t nipmem_zdelete upnp_disc; // if the upnp_disc_res_t changed, notify the caller if( res_changed ){ bool tokeep = notify_callback(upnp_watch_event_t::build_upnpdisc_changed()); if( !tokeep ) return false; } // relaunch the disc_timeout for the next upnp_disc_t disc_timeout.start(disc_delaygen.pre_inc(), this, NULL); #if 0 // TODO not sure about this one // if upnp_unavail() now, reset the m_extipaddr // - TODO should i notify this event ? if( upnp_unavail() ) m_extipaddr = ip_addr_t(); #endif // if the res_changed and now upnp_isavail(), start the extipaddr_timeout and portcleaner_timeout if( res_changed && upnp_isavail() ){ // sanity check: the extipaddr_timeout MUST NOT be running // - TODO this assert fails from time to time... fix this // - i dont even see how it can be right to have this as this 'if' // may be entered at anytime // - instead, would be way better to delete call_extipaddr if needed #if 1 // TODO to remove - only to debug assert failing in some case of UPNP_CHANGED // - this is due to getporttest sometime being 0 on a router in which is it 1 // - so for unknown reason sometime this is diagnosed as // - is it due to a timeout ? and using the default value as 0 ? // - apparently getportendian_test report an error on timeout... so this // cant be it... // - how it is possible to get a 0 while the upnp router is a 1 ? // - what about a race ? // - it uses a constant "upnp revendian testing" tag to identify the addport // SO if 2 getportend_test are done simultaneously, this MAY result in a conflict // - likely rare, but trivial to fix. // - TODO just put a nonce in the tag // - res_changed ISNOT upnp is avail or not, the result may change even // between isavail and isavail // - as shown in changing from getporttest false to getposttest true // - SO DO NOT assume that it is if( !(!extipaddr_timeout.is_running() && !call_extipaddr) ){ KLOG_ERR("new disc_rec=" << m_current_disc_res); KLOG_ERR("old disc_rec=" << old_disc_res); } DBG_ASSERT( !extipaddr_timeout.is_running() ); DBG_ASSERT( !call_extipaddr ); #else DBG_ASSERT( !extipaddr_timeout.is_running() && !call_extipaddr ); #endif // init the extipaddr_timeout extipaddr_delaygen = delaygen_t(profile.extipaddr_delaygen_arg()); extipaddr_timeout.start(extipaddr_delaygen.current(), this, NULL); // init the portcleaner_timeout - IIF profile has portcleaner_enabled if( get_profile().portcleaner_enabled() ){ // - sanity check: upnp_portcleaner_t MUST NOT be running DBG_ASSERT( !upnp_portcleaner ); upnp_portcleaner= nipmem_new upnp_portcleaner_t(); upnp_err = upnp_portcleaner->start(this); DBG_ASSERT( upnp_err.succeed() ); } } // if the res_changed and now upnp_unavail(), stop the extipaddr_timeout and portcleaner_timeout if( res_changed && upnp_unavail() ){ // stop the extipaddr_timeout // - sanity check: the extipaddr_timeout MUST be running DBG_ASSERT( extipaddr_timeout.is_running() || call_extipaddr ); extipaddr_timeout.stop(); nipmem_zdelete call_extipaddr; // stop the portcleaner_timeout - IIF profile has portcleaner_enabled if( get_profile().portcleaner_enabled() ){ // - sanity check: upnp_portcleaner_t MUST be running DBG_ASSERT( upnp_portcleaner ); // delete upnp_portcleaner nipmem_zdelete upnp_portcleaner; } } // return 'dontkeep' as the upnp_disc_t has been deleted return false; }
KeyhoteeMainWindow::KeyhoteeMainWindow(const TKeyhoteeApplication& mainApp) : ATopLevelWindowsContainer(), MailProcessor(*this, bts::application::instance()->get_profile()) { ui.reset(new Ui::KeyhoteeMainWindow() ); ui->setupUi(this); setWindowIcon(QIcon(":/images/shield1024.png") ); QString title = QString("%1 (%2)").arg(mainApp.getAppName().c_str()).arg(mainApp.getLoadedProfileName().c_str()); setWindowTitle(title); connect(ui->contacts_page, &ContactsTable::contactOpened, this, &KeyhoteeMainWindow::openContactGui); connect(ui->contacts_page, &ContactsTable::contactDeleted, this, &KeyhoteeMainWindow::deleteContactGui); #ifdef Q_OS_MAC //QMacNativeToolBar* native_toolbar = QtMacExtras::setNativeToolBar(ui->toolbar, true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); ui->side_bar->setAttribute(Qt::WA_MacShowFocusRect, 0); QApplication::setWindowIcon(QIcon(":/images/shield1024.icns") ); #else QApplication::setWindowIcon(QIcon(":/images/shield1024.png") ); #endif setupStatusBar(); QWidget* empty = new QWidget(); empty->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); ui->toolbar->addWidget(empty); _search_edit = new QLineEdit(ui->toolbar); ui->toolbar->addWidget(_search_edit); _search_edit->setMaximumSize(QSize(150, 22) ); _search_edit->setAttribute(Qt::WA_MacShowFocusRect, 0); const char* search_style = "QLineEdit { " \ "padding-right: 20px; " \ "padding-left: 5px; " \ "background: url(:/images/search24x16.png);" \ "background-position: right;" \ "background-repeat: no-repeat;" \ "border: 1px solid gray;" \ "border-radius: 10px;}"; _search_edit->setStyleSheet(search_style); _search_edit->setPlaceholderText(tr("Search") ); QWidget* empty2 = new QWidget(); empty->resize(QSize(10, 10) ); ui->toolbar->addWidget(empty2); ui->actionEnable_Mining->setEnabled(gMiningIsPossible); ui->actionEnable_Mining->setVisible(gMiningIsPossible); ui->side_bar->setModificationsChecker (this); // ---------------------- MenuBar // File connect(ui->actionExit, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionExit_triggered); // Edit connect(ui->actionCopy, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionCopy_triggered); connect(ui->actionCut, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionCut_triggered); connect(ui->actionPaste, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionPaste_triggered); connect(ui->actionSelect_All, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionSelectAll_triggered); connect(ui->actionDelete, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionDelete_triggered); // Identity connect(ui->actionNew_identity, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionNew_identity_triggered); connect(ui->actionEnable_Mining, &QAction::toggled, this, &KeyhoteeMainWindow::enableMining_toggled); // Mail connect(ui->actionNew_Message, &QAction::triggered, this, &KeyhoteeMainWindow::newMailMessage); connect(ui->actionReply, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionReply_triggered); connect(ui->actionReply_all, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionReply_all_triggered); connect(ui->actionForward, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionForward_triggered); connect(ui->actionSave_attachement, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionSave_attachement_triggered); // Contact connect(ui->actionNew_Contact, &QAction::triggered, this, &KeyhoteeMainWindow::addContact); connect(ui->actionSet_Icon, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionset_Icon_triggered); connect(ui->actionShow_Contacts, &QAction::triggered, this, &KeyhoteeMainWindow::showContacts); // Help connect(ui->actionDiagnostic, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionDiagnostic_triggered); connect(ui->actionAbout, &QAction::triggered, this, &KeyhoteeMainWindow::on_actionAbout_triggered); connect(ui->splitter, &QSplitter::splitterMoved, this, &KeyhoteeMainWindow::sideBarSplitterMoved); connect(ui->side_bar, &TreeWidgetCustom::itemSelectionChanged, this, &KeyhoteeMainWindow::onSidebarSelectionChanged); connect(ui->side_bar, &TreeWidgetCustom::itemDoubleClicked, this, &KeyhoteeMainWindow::onSidebarDoubleClicked); connect(ui->side_bar, &TreeWidgetCustom::itemContactRemoved, this, &KeyhoteeMainWindow::onItemContactRemoved); //connect( _search_edit, SIGNAL(textChanged(QString)), this, SLOT(searchEditChanged(QString)) ); connect(_search_edit, &QLineEdit::textChanged, this, &KeyhoteeMainWindow::searchEditChanged); auto space2 = ui->side_bar->topLevelItem(TopLevelItemIndexes::Space2); auto space3 = ui->side_bar->topLevelItem(TopLevelItemIndexes::Space3); auto space_flags = space2->flags() & (~Qt::ItemFlags(Qt::ItemIsSelectable) ); space_flags |= Qt::ItemNeverHasChildren; space2->setFlags(space_flags); space3->setFlags(space_flags); //_identities_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Identities); _mailboxes_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Mailboxes); _contacts_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Contacts); _wallets_root = ui->side_bar->topLevelItem(TopLevelItemIndexes::Wallets); _contacts_root->setExpanded(true); //_identities_root->setExpanded(true); _mailboxes_root->setExpanded(true); _inbox_root = _mailboxes_root->child(Inbox); _drafts_root = _mailboxes_root->child(Drafts); _sent_root = _mailboxes_root->child(Sent); _wallets_root->setExpanded(true); _bitcoin_root = _wallets_root->child(Bitcoin); _bitshares_root = _wallets_root->child(BitShares); _litecoin_root = _wallets_root->child(Litecoin); auto app = bts::application::instance(); app->set_application_delegate(this); auto profile = app->get_profile(); auto idents = profile->identities(); auto addressbook = profile->get_addressbook(); _addressbook_model = new AddressBookModel(this, addressbook); _inbox_model = new MailboxModel(this, profile, profile->get_inbox_db(), *_addressbook_model); _draft_model = new MailboxModel(this, profile, profile->get_draft_db(), *_addressbook_model); _pending_model = new MailboxModel(this, profile, profile->get_pending_db(), *_addressbook_model); _sent_model = new MailboxModel(this, profile, profile->get_sent_db(), *_addressbook_model); connect(_addressbook_model, &QAbstractItemModel::dataChanged, this, &KeyhoteeMainWindow::addressBookDataChanged); MailEditor::setContactCompleter(_addressbook_model->getContactCompleter() ); ui->contacts_page->setAddressBook(_addressbook_model); ui->new_contact->setAddressBook(_addressbook_model); ui->inbox_page->initial(MailProcessor, _inbox_model, Mailbox::Inbox, this); ui->draft_box_page->initial(MailProcessor, _draft_model, Mailbox::Drafts, this); ui->sent_box_page->initial(MailProcessor, _sent_model, Mailbox::Sent, this); ui->widget_stack->setCurrentWidget(ui->inbox_page); connect(ui->actionDelete, SIGNAL(triggered()), ui->inbox_page, SLOT(onDeleteMail())); connect(ui->actionShow_details, SIGNAL(toggled(bool)), ui->inbox_page, SLOT(on_actionShow_details_toggled(bool))); wlog("idents: ${idents}", ("idents", idents) ); for (size_t i = 0; i < idents.size(); ++i) { try { app->mine_name(idents[i].dac_id_string, profile->get_keychain().get_identity_key(idents[i].dac_id_string).get_public_key(), idents[i].mining_effort); } catch ( const fc::exception& e ) { wlog( "${e}", ("e",e.to_detail_string()) ); } } app->set_mining_intensity(0); ui->actionEnable_Mining->setChecked(app->get_mining_intensity() != 0); _addressbook = profile->get_addressbook(); /* auto abook = profile->get_addressbook(); auto contacts = abook->get_known_bitnames(); for( auto itr = contacts.begin(); itr != contacts.end(); ++itr ) { auto new_contact_item = new QTreeWidgetItem(_contacts_root, (QTreeWidgetItem::ItemType)ContactItem ); auto id_rec = app->lookup_name( *itr ); if( !id_rec ) { new_contact_item->setText( 0, (*itr + " [unknown]").c_str() ); } else { new_contact_item->setText( 0, (*itr + " [" + std::to_string(id_rec->repute)+"]" ).c_str() ); } } */ QString settings_file = "keyhotee_"; settings_file.append(mainApp.getLoadedProfileName().c_str()); setSettingsFile(settings_file); readSettings(); QAction* actionMenu = new QAction(tr("Keyhotee"), this); actionMenu->setCheckable(true); this->setMenuWindow(ui->menuWindow); this->registration(actionMenu); }
static int read_sensor_longitude(void *user_data, harp_array data) { return get_profile((ingest_info *)user_data, "nl_geolocation", "longit", data); }
static int read_pressure(void *user_data, harp_array data) { return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_atm_p", data); }
static int read_latitude(void *user_data, harp_array data) { return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_lat", data); }
static int read_oclo(void *user_data, harp_array data) { return get_profile((ingest_info *)user_data, "nl_local_species_density", "oclo", data); }