Esempio n. 1
0
Return<void> GnssMeasurement::close()  {
    if (mApi == nullptr) {
        LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
        return Void();
    }

    if (mGnssMeasurementCbIface != nullptr) {
        mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
        mGnssMeasurementCbIface = nullptr;
    }
    mApi->gnssMeasurementClose();

    return Void();
}
Return<void> PrimaryDevice::getTtyMode(getTtyMode_cb _hidl_cb) {
    int halMode;
    Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_TTY_MODE, &halMode);
    TtyMode mode = retval == Result::OK ? TtyMode(halMode) : TtyMode::OFF;
    _hidl_cb(retval, mode);
    return Void();
}
Return<void> PrimaryDevice::getBtScoWidebandEnabled(
    getBtScoWidebandEnabled_cb _hidl_cb) {
    bool enabled;
    Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_BT_SCO_WB, &enabled);
    _hidl_cb(retval, enabled);
    return Void();
}
Return<void> PreparedModelCallback::notify(ErrorStatus errorStatus,
                                           const sp<IPreparedModel>& preparedModel) {
    mErrorStatus = errorStatus;
    mPreparedModel = preparedModel;
    CallbackBase::notify();
    return Void();
}
Esempio n. 5
0
extern "C" void Java_com_lucidfusionlabs_billing_NativeProductCB_RunProductCBInMainThread(JNIEnv *e, jclass c, jlong cb, jstring id, jstring name, jstring desc, jstring price) {
  auto product = new AndroidProduct(JNI::GetJString(e, id), JNI::GetJString(e, name),
                                    JNI::GetJString(e, desc), JNI::GetJString(e, price));
  jni->app->RunCallbackInMainThread([=](){
    (*static_cast<PurchasesInterface::ProductCB*>(Void(cb)))(unique_ptr<ProductInterface>(product));
  });
}
Return<void> Device::openInputStream(int32_t ioHandle,
                                     const DeviceAddress& device,
                                     const AudioConfig& config,
                                     AudioInputFlag flags, AudioSource source,
                                     openInputStream_cb _hidl_cb) {
    audio_config_t halConfig;
    HidlUtils::audioConfigToHal(config, &halConfig);
    audio_stream_in_t* halStream;
    ALOGV(
        "open_input_stream handle: %d devices: %x flags: %#x "
        "srate: %d format %#x channels %x address %s source %d",
        ioHandle, static_cast<audio_devices_t>(device.device),
        static_cast<audio_input_flags_t>(flags), halConfig.sample_rate,
        halConfig.format, halConfig.channel_mask,
        deviceAddressToHal(device).c_str(),
        static_cast<audio_source_t>(source));
    int status = mDevice->open_input_stream(
        mDevice, ioHandle, static_cast<audio_devices_t>(device.device),
        &halConfig, &halStream, static_cast<audio_input_flags_t>(flags),
        deviceAddressToHal(device).c_str(),
        static_cast<audio_source_t>(source));
    ALOGV("open_input_stream status %d stream %p", status, halStream);
    sp<IStreamIn> streamIn;
    if (status == OK) {
        streamIn = new StreamIn(this, halStream);
    }
    AudioConfig suggestedConfig;
    HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
    _hidl_cb(analyzeStatus("open_input_stream", status), streamIn,
             suggestedConfig);
    return Void();
}
Return<void> Device::getMicMute(getMicMute_cb _hidl_cb) {
    bool mute = false;
    Result retval =
        analyzeStatus("get_mic_mute", mDevice->get_mic_mute(mDevice, &mute));
    _hidl_cb(retval, mute);
    return Void();
}
Return<void> PrimaryDevice::getBtScoNrecEnabled(
    getBtScoNrecEnabled_cb _hidl_cb) {
    bool enabled;
    Result retval = mDevice->getParam(AudioParameter::keyBtNrec, &enabled);
    _hidl_cb(retval, enabled);
    return Void();
}
Return<void> NoiseSuppressionEffect::getAllProperties(getAllProperties_cb _hidl_cb)  {
    t_ns_settings halProperties;
    Result retval = mEffect->getParam(NS_PARAM_PROPERTIES, halProperties);
    AllProperties properties;
    propertiesFromHal(halProperties, &properties);
    _hidl_cb(retval, properties);
    return Void();
}
Esempio n. 10
0
Return<void> OmxStore::listServiceAttributes(listServiceAttributes_cb _hidl_cb) {
    if (mParsingStatus == Status::NO_ERROR) {
        _hidl_cb(Status::NO_ERROR, mServiceAttributeList);
    } else {
        _hidl_cb(mParsingStatus, hidl_vec<ServiceAttribute>());
    }
    return Void();
}
Return<void> Device::getMasterVolume(getMasterVolume_cb _hidl_cb) {
    Result retval(Result::NOT_SUPPORTED);
    float volume = 0;
    if (mDevice->get_master_volume != NULL) {
        retval = analyzeStatus("get_master_volume",
                               mDevice->get_master_volume(mDevice, &volume));
    }
    _hidl_cb(retval, volume);
    return Void();
}
Return<void> Device::getMasterMute(getMasterMute_cb _hidl_cb) {
    Result retval(Result::NOT_SUPPORTED);
    bool mute = false;
    if (mDevice->get_master_mute != NULL) {
        retval = analyzeStatus("get_master_mute",
                               mDevice->get_master_mute(mDevice, &mute));
    }
    _hidl_cb(retval, mute);
    return Void();
}
    Return<void> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
            const hidl_string& /* appPackageName */, createPlugin_cb _hidl_cb) {

        for (size_t i = 0; i < loader.factoryCount(); i++) {
            if (loader.getFactory(i)->isCryptoSchemeSupported(uuid.data())) {
                android::DrmPlugin *legacyPlugin = NULL;
                status_t status = loader.getFactory(i)->createDrmPlugin(
                        uuid.data(), &legacyPlugin);
                DrmPlugin *newPlugin = NULL;
                if (legacyPlugin == NULL) {
                    ALOGE("Drm legacy HAL: failed to create drm plugin");
                } else {
                    newPlugin = new DrmPlugin(legacyPlugin);
                }
                _hidl_cb(toStatus(status), newPlugin);
                return Void();
            }
        }
        _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, NULL);
        return Void();
    }
Return<void> Device::getAudioPort(const AudioPort& port,
                                  getAudioPort_cb _hidl_cb) {
    audio_port halPort;
    HidlUtils::audioPortToHal(port, &halPort);
    Result retval = analyzeStatus("get_audio_port",
                                  mDevice->get_audio_port(mDevice, &halPort));
    AudioPort resultPort = port;
    if (retval == Result::OK) {
        HidlUtils::audioPortFromHal(halPort, &resultPort);
    }
    _hidl_cb(retval, resultPort);
    return Void();
}
Return<void> LoudnessEnhancerEffect::getTargetGain(getTargetGain_cb _hidl_cb)  {
    // AOSP Loudness Enhancer expects the size of the request to not include the
    // size of the parameter.
    uint32_t paramId = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB;
    uint32_t targetGainMb = 0;
    Result retval = mEffect->getParameterImpl(
            sizeof(paramId), &paramId,
            0, sizeof(targetGainMb),
            [&] (uint32_t, const void* valueData) {
                memcpy(&targetGainMb, valueData, sizeof(targetGainMb));
            });
    _hidl_cb(retval, targetGainMb);
    return Void();
}
Return<void> Device::getInputBufferSize(const AudioConfig& config,
                                        getInputBufferSize_cb _hidl_cb) {
    audio_config_t halConfig;
    HidlUtils::audioConfigToHal(config, &halConfig);
    size_t halBufferSize = mDevice->get_input_buffer_size(mDevice, &halConfig);
    Result retval(Result::INVALID_ARGUMENTS);
    uint64_t bufferSize = 0;
    if (halBufferSize != 0) {
        retval = Result::OK;
        bufferSize = halBufferSize;
    }
    _hidl_cb(retval, bufferSize);
    return Void();
}
Esempio n. 17
0
// 执行Tcl脚本命令
PyObject *PyTclInterp::Execute(PyObject *args)
{
	PyTclInterp* pPyTclInterp = NULL;
	char *str;
	if(PyArg_ParseTuple(args, "is", &pPyTclInterp, &str))
	{
		if(m_pTclInterp)
		{
			return Py_BuildValue("i", m_pTclInterp->RunScriptCommand(str));
		}
		return Void();
	}

	return NULL;
}
Esempio n. 18
0
MethodResponse
   Dispatcher::xml_pretty_print(const MethodCall &calldata,
                                const Dispatcher *disp)
{
  ULXR_TRACE("xml_pretty_print");
  if (calldata.numParams() > 1)
    throw ParameterException(InvalidMethodParameterError,
                             "At most 1 parameter allowed for \"system.listMethods\"");

  if (   calldata.numParams() == 1
      && calldata.getParam(0).getType() != RpcBoolean)
    throw ParameterException(InvalidMethodParameterError,
                             "Parameter 1 not of type \"Boolean\" \"ulxmlrpcpp.xml_pretty_print\"");

  bool enable = Boolean(calldata.getParam(0)).getBoolean();
  enableXmlPrettyPrint(enable);
  return MethodResponse (Void());
}
Esempio n. 19
0
Return<void> SampleDriverFloatSlow::getSupportedOperations_1_1(const V1_1::Model& model,
                                                               getSupportedOperations_1_1_cb cb) {
    VLOG(DRIVER) << "getSupportedOperations()";
    if (validateModel(model)) {
        const size_t count = model.operations.size();
        std::vector<bool> supported(count);
        for (size_t i = 0; i < count; i++) {
            const Operation& operation = model.operations[i];
            if (operation.inputs.size() > 0) {
                const Operand& firstOperand = model.operands[operation.inputs[0]];
                supported[i] = firstOperand.type == OperandType::TENSOR_FLOAT32;
            }
        }
        cb(ErrorStatus::NONE, supported);
    } else {
        std::vector<bool> supported;
        cb(ErrorStatus::INVALID_ARGUMENT, supported);
    }
    return Void();
}
Esempio n. 20
0
	Void compressImpl(const std::string& path)
	{
		std::string gzPath(path);
		gzPath.append(".gz");
		FileInputStream istr(path, std::ios::binary | std::ios::in);
		if (!istr.good()) throw OpenFileException(path);
		FileOutputStream ostr(gzPath, std::ios::binary | std::ios::out);
		if (ostr.good())
		{
			DeflatingOutputStream deflater(ostr, DeflatingStreamBuf::STREAM_GZIP);
			StreamCopier::copyStream(istr, deflater);
			deflater.close();
			ostr.close();
			istr.close();
			File f(path);
			f.remove();
		}
		else throw CreateFileException(gzPath);
		return Void();
	}
Return<void> Device::createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
                                      const hidl_vec<AudioPortConfig>& sinks,
                                      createAudioPatch_cb _hidl_cb) {
    Result retval(Result::NOT_SUPPORTED);
    AudioPatchHandle patch = 0;
    if (version() >= AUDIO_DEVICE_API_VERSION_3_0) {
        std::unique_ptr<audio_port_config[]> halSources(
            HidlUtils::audioPortConfigsToHal(sources));
        std::unique_ptr<audio_port_config[]> halSinks(
            HidlUtils::audioPortConfigsToHal(sinks));
        audio_patch_handle_t halPatch = AUDIO_PATCH_HANDLE_NONE;
        retval = analyzeStatus(
            "create_audio_patch",
            mDevice->create_audio_patch(mDevice, sources.size(), &halSources[0],
                                        sinks.size(), &halSinks[0], &halPatch));
        if (retval == Result::OK) {
            patch = static_cast<AudioPatchHandle>(halPatch);
        }
    }
    _hidl_cb(retval, patch);
    return Void();
}
Esempio n. 22
0
Return<void> OmxStore::getNodePrefix(getNodePrefix_cb _hidl_cb) {
    _hidl_cb(mPrefix);
    return Void();
}
Return<void> ExecutionCallback::notify(ErrorStatus errorStatus) {
    mErrorStatus = errorStatus;
    CallbackBase::notify();
    return Void();
}
Return<void> Device::debugDump(const hidl_handle& fd) {
    if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
        analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
    }
    return Void();
}
Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys,
                                   getParameters_cb _hidl_cb) {
    getParametersImpl(keys, _hidl_cb);
    return Void();
}
// Methods from ::android::hardware::tests::inheritance::V1_0::IParent follow.
Return<void> Child::doParent()  {
    ALOGI("SERVER(Bar) Child::doParent");
    return Void();
}
// Methods from ::android::hardware::tests::inheritance::V1_0::IChild follow.
Return<void> Child::doChild()  {
    ALOGI("SERVER(Bar) Child::doChild");
    return Void();
}
Esempio n. 28
0
File: sexpr.hpp Progetto: o11c/sexpr
 SExpr(Void = Void()) {}
Esempio n. 29
0
wxSizer *AboutDlgFunc( wxWindow *parent, bool call_fit, bool set_sizer )
{
    wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );

    wxBoxSizer *item2 = new wxBoxSizer( wxVERTICAL );

    wxStaticBitmap *item3 = new wxStaticBitmap( parent, ID0_LOGO, Void( 0 ), wxDefaultPosition, wxSize(128,128) );
    item2->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item4 = new wxButton( parent, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
    item4->SetDefault();
    item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );

    item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );

    wxFlexGridSizer *item5 = new wxFlexGridSizer( 1, 0, 0 );

    wxBoxSizer *item6 = new wxBoxSizer( wxHORIZONTAL );

    wxStaticText *item7 = new wxStaticText( parent, ID0_TEXT, _("ARUSPIX"), wxDefaultPosition, wxDefaultSize, 0 );
    item6->Add( item7, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 );

    wxStaticText *item8 = new wxStaticText( parent, TX_APP_VERSION, wxT(""), wxDefaultPosition, wxSize(100,-1), 0 );
    item6->Add( item8, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxTOP, 5 );

    item5->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );

    wxStaticLine *item9 = new wxStaticLine( parent, ID0_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
    item5->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );

    wxStaticText *item11 = new wxStaticText( parent, ID0_TEXT, _("Build"), wxDefaultPosition, wxDefaultSize, 0 );
    item10->Add( item11, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 );

    wxStaticText *item12 = new wxStaticText( parent, TX_APP_BUILD, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
    item10->Add( item12, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxTOP, 5 );

    item5->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );

    wxStaticLine *item13 = new wxStaticLine( parent, ID0_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
    item5->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxStaticText *item14 = new wxStaticText( parent, ID0_TEXT, _("Credits"), wxDefaultPosition, wxDefaultSize, 0 );
    item5->Add( item14, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 );

    wxWindow *item15 = parent->FindWindow( ID0_WXWIDGETS );
    wxASSERT( item15 );
    item5->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxWindow *item16 = parent->FindWindow( ID0_TORCH );
    wxASSERT( item16 );
    item5->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxWindow *item17 = parent->FindWindow( ID0_IM );
    wxASSERT( item17 );
    item5->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxWindow *item18 = parent->FindWindow( ID0_WG );
    wxASSERT( item18 );
    item5->Add( item18, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxWindow *item19 = parent->FindWindow( ID0_LIBMEI );
    wxASSERT( item19 );
    item5->Add( item19, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    item5->Add( 350, 5, 0, wxALIGN_CENTER|wxALL, 5 );

    wxStaticText *item20 = new wxStaticText( parent, TX_APP_COPYRIGHT, _("Copyright"), wxDefaultPosition, wxDefaultSize, 0 );
    item5->Add( item20, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );

    wxStaticText *item21 = new wxStaticText( parent, TX_APP_LICENSE, _("License"), wxDefaultPosition, wxDefaultSize, 0 );
    item5->Add( item21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxBoxSizer *item22 = new wxBoxSizer( wxHORIZONTAL );

    item5->Add( item22, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );

    item1->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );

    item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );

    wxStaticLine *item23 = new wxStaticLine( parent, ID0_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
    item0->Add( item23, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxBoxSizer *item24 = new wxBoxSizer( wxVERTICAL );

    wxStaticText *item25 = new wxStaticText( parent, TX_APP_CONTRIBUTORS, _("Contributors:"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE );
    item24->Add( item25, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 10 );

    wxTextCtrl *item26 = new wxTextCtrl( parent, ID0_CONTRIBUTORS, wxT(""), wxDefaultPosition, wxSize(80,100), wxTE_MULTILINE|wxTE_READONLY );
    item24->Add( item26, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 10 );

    item0->Add( item24, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );

    if (set_sizer)
    {
        parent->SetSizer( item0 );
        if (call_fit)
            item0->SetSizeHints( parent );
    }
    
    return item0;
}
Esempio n. 30
0
Return<void> OmxStore::listRoles(listRoles_cb _hidl_cb) {
    _hidl_cb(mRoleList);
    return Void();
}