rtlsdr doesn't open in qt android c++ - android

I have a qt android project in c++. When I call "rtlsdr_get_device_name" function it returns the "Generic RTL2832U OEM" message. But when I call "rtlsdr_open" function it return -3. Please help me how can I solve this problem.

thank you silicontrip.
My project is a qt android project.
rtlsdr_dev_t *RtlSdrDevice;
int devicecount = rtlsdr_get_device_count();
if (devicecount != 0)
{
QString rtlname = rtlsdr_get_device_name(0);
//this function returns "Generic RTL2832U OEM "
retvalue = rtlsdr_open(&RtlSdrDevice, 0);
//this function returns "-3"
if (retvalue == 0) //if open rtl correctly
{
....
}
...
}
the rtlsdr device doesn't open successfully.

Related

Get mangled name of function when using .so shared library from Android c++ side? (libAudioFlinger.so)

i have been working on this problem for 2 weeks now, i have integrate C++ code into my Voip call recording app, the code is supposed to take care of forcefully setting Input_source of mediaRecorder to same one as from the Voip Call (in my case it is input_source=7 / Voice_Communication).
In order to achieve my goal i load shared library : libaudioflinger.so and attempt to reach SetParameters function, as can be seen from the snipet below :
handleLibAudioFlinger = dlopen("libaudioflinger.so", RTLD_LAZY | RTLD_GLOBAL);
if (handleLibAudioFlinger != NULL) {
func = dlsym(handleLibAudioFlinger, "setParameters"); // i do not know the mangled name of
SetParameters function
if (func != NULL) {
__android_log_print(ANDROID_LOG_ERROR, "TRACKERS", "%s", "Function is not null");
result = 0;
}
audioSetParameters = (lasp) func;
} else {
__android_log_print(ANDROID_LOG_ERROR, "TRACKERS", "%s", "Function is null");
result = -1;
}
dlopen does not return null, but dlsym does, reason is that i need to have the exact mangled name of the function setParameters from AudioFlinger.cpp As in Android source code.
i am new to handling android c++ code and dealing with shared libraries,etc... if someone can tell me step by step how to get correct mangled name for the function that i need?

Issue with QT and Android 8.0: Error creating SSL context ()

After the launch of Android 8.0, our QT App is not working properly on devices with this new version. The error we are seeing in our emulator is "Error creating SSL context ()". The app runs normally, but when it tries to make a HTTP call it fails.
We have this line in our AndroidManifest:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23"/>
I have tried to change this targetSdkVersion sometimes, but nothing works.
Also, we make the HTTP call using this function
void UrlLoader::load()
{
this->setProperty("loading", true);
QNetworkRequest request;
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
request.setUrl(m_url);
QUrlQuery postData;
if(params() != "") {
QStringList pieces = params().split( "&" );
foreach(QString value, pieces) {
QStringList values = value.split( "=" );
postData.addQueryItem(values[0], values[1]);
}
}
m_netMan->post(request, postData.toString(QUrl::FullyEncoded).toUtf8());
}
The error is shown when we try to read the result:
void UrlLoader::finished(QNetworkReply *reply)
{
this->setProperty("loading", false);
QJsonArray jsonArray;
QJsonObject json;
int error = reply->error();
if(error == 0){
QByteArray rawData = reply->readAll();
if(QJsonDocument::fromJson(rawData).isArray()) {
jsonArray = QJsonDocument::fromJson(rawData).array();
emit this->loadedArray(jsonArray);
} else {
json = QJsonDocument::fromJson(rawData).object();
if(json.empty()){
this->setResponse(rawData);
}
emit this->loaded(json);
}
reply->abort ();
} else {
emit this -> crashed(this -> retornaError(error)) ;
}
}
Can someone help us?
Best Regards.
Perhaps your use of private SSL native libraries are no longer compatible with the Android target API level. Check out the Qt doc, as well as the Android doc , section NDK Apps Linking to Platform Libraries.

Android Studio jumping over breakpoints

I am running into an issue where Android Studio is jumping over my breakpoint. I haven't run into this issue before and this recently started happening.
I am running Android Studio 2.3.1 on a MAC with no exotic plugins. Any ideas? Here is the code:
private fun getLatestZip(): File? {
var fileName = context.fileList().find { it.toUpperCase().contains("MBTA_GTFS") }
var dateTime = getGftsTimestamp()
var file: File?
if (dateTime == null) {
file = downloadLatestGfts() // skips the break on this line
if (file != null) {
printGftsTimestamp()
}
else {
Timber.e("Failed to download Gfts") // and goes straight to here
}
} else if (!fileName.isNullOrEmpty()) {....
EDIT ---
Here's a video to show you exactly what's happening. It could be a problem with kotlin. https://youtu.be/fJOIzD8ckv8
You need to place breakpoint in downloadLatestGfts() function or press F8 to go to next line (i.e file null check if statement).
Try to run the code putting a breakpoint on the line
if (dateTime == null)
and check whether the value of dateTime is null. It may be because of that null value the control goes straight to else condition.

How to check if label of view exist in MonkeyTalk automated testing

I recently started writing a detail automated test script on MonkeyTalk for my application. I am fascinated with the power of this tool, but there is a small issue i am facing.
I am writing a data driven test case using csv file which is running file. But now I want to induct some verification on view, I believe that could be done using javascript but I couldn't be able to work it around. Can anyone show me how.
Here is what i am doing :
1) my script file to run the data driven test case for csv file
Script DataDrivenLogin.mt RunWith login.csv
2) my other script file where i am using the views
load("libs/MyApp.js");
MyApp.DataDrivenLogin.prototype.run = function(email, _password) {
/**
* #type MT.Application
*/
var app = this.app;
email = (email != undefined && email != "*" ? email : "<email>");
_password = (_password != undefined && _password != "*" ? _password : "<_password>");
app.image("email").tap();
app.input("Email Address").tap({timeout:"2000"});
app.input("Email Address").enterText(email, {timeout:"2000"});
app.input("Password").tap({timeout:"2000"});
app.input("Password").enterText(_password, {timeout:"2000"});
app.button("login").tap({timeout:"2000"});
try {
app.image("Open").verify(); //if label exists
} catch(Exception) {
app.debug().print("Label not found");
}
app.image("Open").tap({timeout:"2000"});
app.table("left_drawer").selectIndex("8", {timeout:"2000"});
app.button("Yes").tap({timeout:"2000"});
app.image("Open").tap({timeout:"2000"});
};
but it is not working my script is still breaking what I want to do is that if the view doesn't exists the script won't break and start from top again for next data value.
Help is much appreciated. Thanks!!!
As far as i understood the problem here, if label does not exist then this
app.image("Open").tap({timeout:"2000"});
will also break. Try to put this as well in try block.
As
........
app.input("Password").enterText(_password, {timeout:"2000"});
app.button("login").tap({timeout:"2000"});
try {
app.image("Open").verify(); //if label exists
app.image("Open").tap({timeout:"2000"});
} catch(Exception) {
app.debug().print("Label not found");
}
app.table("left_drawer").selectIndex("8", {timeout:"2000"});
app.button("Yes").tap({timeout:"2000"});
app.image("Open").tap({timeout:"2000"});

unable to connect to JSON service in android application of Titanium studio

i am trying to do login application which takes id and password..when i click on logi button then it will connect to our local server by JSON..with the specified URL..the code is..
var loginReq = Titanium.Network.createHTTPClient();
loginReq.onload = function()
{
var json = this.responseText; alert(json);
var response = JSON.parse(json);
if (response.data.status == "success")
{ alert("Welcome ");
}
else
{ alert(response.data.status);
}
};
loginReq.onerror = function(event)
{
alert(event.toSource());
//alert("Network error");
};
loginBtn.addEventListener('click',function(e)
{ if (username.value != '' && password.value != '')
{
var url = 'our local url action=login&id='+username.value+'&pwd='+password.value;
loginReq.open("POST",url);
loginReq.send();
}
else
{
alert("Username/Password are required");
}
});
Here it is not connecting our URl..so it is entering into loginReq.onerror function...instead of loginReq.onload function..why it is throwing run time error.. The same code working fine with Iphone..
The Run Time Error is..
TypeError:Cannot call property toSource in object{'source':[Ti.Network.HttpClient],specified url} is not a function,it is a object.
This is wat the error..please let me Know...
Apparently the toSource() function does not exist in android, as it is an object. Try debugging and see what the object event contains.
You could do that by adding a line above the alert line, and adding a debug line to it.
Look in debug mode and see all variables
"toSource()" is not a documented function for either platform, and I also do not see it in the source for Titanium Mobile. If you aren't getting the error on iOS, I'm guessing it is because the error handler isn't getting called. Perhaps your emulator or device does not have internet access, whereas your iOS simulator or device does?
Regardless, error handling in the HTTPClient normally looks something like this:
loginReq.onerror = function(e)
{
Ti.API.info("ERROR " + e.error);
alert(e.error);
};

Categories

Resources