Audio recording in Nokia symbian OS - audio-recording

I am trying to record voice in symbian S60 5th edition OS. I Am trying to use following code to record the voice as specified in the NOKIA developer's site.
//Create an instance of CMdaAudioRecorderUtility class
CMdaAudioRecorderUtility iRecorder = CMdaAudioRecorderUtility::NewL(*this);
//Open file either by using a filename with full path infor or a descriptor
iRecorder->OpenFileL( aFilename );
//iRecorder->OpenDesL( aDescriptor );
//Recording is started
iRecorder->RecordL();
....
....
//Stop Recording
iRecorder->Stop();
//Close the recording session
iRecorder->Close();
Any other suggestions would be helpful.

Basically, the this pointer in CMdaAudioRecorderUtility::NewL(*this), is pointing to an interface, which you need to implement. And as it has fucntions which are informing you on when the file is opened, closed or other possible states. You would actually need to wait untill you get an event before you start any other operations.
Also see whether the interface functions are giving you any errors.

Related

How to add support for screen timeout while running a qt5.9 app on linuxfb platform?

I'm using a qt5.9 app on imx6slevk board with yocto bsp,
Before running the app I see a virtual terminal on the display and this screen blanks after 10 minutes as specified in the driver file found at Kernel_source > drivers/tty/vt/vt.c
static int blankinterval = 10*60;
Just as this file is used for virtual terminal the file qlinuxfbscreen.cpp is used by qt applications running on linuxfb.
I didn't find any option of do_screen_blank or do_screen_unblank in this file
All I found was this function:
static void blankScreen(int fd, bool on)
{
ioctl(fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING);
}
on passing on = 1 the screen goes off completely with no display at all
I tried setting Idleaction in systemd/logind.conf
IdleAction=suspend
IdleActionSec=30Sec
after this the app turns off after 30 sec but it does so even if I press keys on the matrix keypad, systemd doesn't seem to register key press as active events and the screen turns off.
Is there any patch that I can apply to enable screen timeout? Or could I at least register key press as active event in systemd?
You'd need to modify your qt app.
The algorithm would be something like
Start timer
If key pressed reset timer to max value
If no key pressed go to suspend mode, you may use:
system("echo mem > /sys/power/state")
Wakeup on power key press.

NSTextView freezing my app when adding a lot of data asyncronously

I'm building a simple talker/listener app that receives OSC data through UDP. I'm using OSCKit pod which itself uses CocoaAsyncSocket library for the internal UDP communication.

When I'm listening to a particular port to receive data from another OSC capable software, I log the received commands to a NSTextView. The problem is that sometimes, I receive thousands of messages in a very short period of time (EDIT: I just added a counter to see how many messages I'm receiving. I got over 14000 in just a few seconds and that is only a single moving object in my software). There is no way to predict when this is gonna happen so I cannot lock the textStorage object of the NSTextView to keep it from sending all its notifications to update the UI. The data is processed through a delegate callback function.

So how would you go around that limitation?
///Handle incoming OSC messages
func handle(_ message: OSCMessage!) {
print("OSC Message: \(message)")
let targetPath = message.address
let args = message.arguments
let msgAsString = "Path: \"\(targetPath)\"\nArguments: \n\(args)\n\n"
print(msgAsString)
oscLogView.string?.append(msgAsString)
oscLogView.scrollToEndOfDocument(self)
}
As you can see here (this is the callback function) I'm updating the TextView directly from the callback (both adding data and scrolling to the end), every time a message is received. This is where Instruments tell me the slow down happens and the append is the slowest one. I didn't go further than that in the analysis, but it certainly is due to the fact that it tries to do a visual update, which takes a lot more time than parsing 32bits of data, and when it's finished it receives another update right away from the server's buffer.
Could I send that call to the background thread? I don't feel like filling up the background thread with visual updates is such a great idea. Maybe growing my own string buffer and flushing it to the TextView every now and then with a timer?
I want to give this a console feel, but a console that freezes is not a console.
Here is a link to the project on github. the pods are all there and configured with cocoapods, so just open the workspace. You guys might not have anything to generate that much OSC traffic, but if you really feel like digging in, you can get IanniX, which is an open-source sequencer/trajectory automator that can generate OSC and a lot of it. I've just downloaded it and I'll build a quick project that should send enough data to freeze the app and I'll add it to the repo if anybody want to give it a shot.
I append the incoming data to a buffer variable and I use a timer that flushes that buffer to the textview every 0.2 seconds. The update cycle of the textview is way too slow to handle the amount of incoming data so unloding the network callback to a timer let the server process the data instead of being stopped every 32bits.
If anybody come up with a more elegant method, I'm open minded.

QLowEnergyService never transitions to ServiceDiscovered state on custom bluetooth service

I have created a Bluetooth communicator in Qt 5.5.1 following the Qt documentation. I have gotten to the point where I am able to view a list of services offered by a Bluetooth device. The services are generated by:
QLowEnergyService *service = controller->createServiceObject(serviceUuid);
Where controller is a QLowEnergyController and serviceUuid is a QBluetoothUuid. The service is created successfully but since it is a custom service offered by the device I am trying to connect to, the name is unknown. At this point I call:
service->discoverDetails();
which transitions the service to the QLowEnergyService::DiscoveringServices state from the QLowEnergyService::DiscoveryRequired state. Once this happens, the state never changes again and no error is ever thrown. Is there a way to pull the characteristics of an "unknown service"? I have checked the Uuid against what I expected for the service and it is correct. I also have the Uuid of the expected characteristics.
Note: I am using a pyqt (Python binding library of QT C++).
I stumbled upon issue while trying to connect to some device which offers two services. One is the standard battery service and another is private custom non-standard service.
I noticed that I was able to discover the batter service successfully, but I was not able to discover that custom service. However, for some reason, when I subscribed to service_error signal, the discovery works fine, and whenever i comment it out, it does not work.
void QLowEnergyService::error(QLowEnergyService::ServiceError newError)
I know it is funny and I do not have an explanation, but it could be related and i felt it is worth sharing.
QMetaObject::invokeMethod(this, "discoverCharacteristics", Qt::QueuedConnection);
void discoverCharacteristics() {
service->discoverDetails();
}

Qt DBus registerService function call returns false on an embedded Linux device

I’m new to DBus, but I’m trying to use it in two Qt applications on an embedded device. I have a very simple interface that consists of one slot:
QString SendMessage(const QString &cmd);
The server application is then using the following code to start the connection:
DbusService* dBus = new DbusService;
new interfaceIfAdaptor(dBus);
QDBusConnection connection = QDBusConnection::sessionBus();
bool ret = connection.registerService("com.domain.project.interface");
qDebug() << "returns" << ret;
ret = connection.registerObject("/", dBus);
qDebug() << "returns" << ret;
This works fine on the desktop. In the embedded system, the connection.registerService function returns false. As a result, any messages to the server fail. I’m not sure why. Running ‘ps’ tells me that [dbus-daemon —system] and [dbus-daemon —sesson] are both running.
Finally, I have noticed that Qt Creator complains when I debug the application. I see the following warning messages:
Could not load shared library symbols for 10 libraries, e.g. /opt/arm/lib/libQtDBus.so.4.
Use the “info sharedlibrary” command to see the complete listing.
Do you need “set solib-search-path” or “set sysroot”?
Could not load shared library symbols for /usr/lib/libdbus-1.so.3.
Do you need “set solib-search-path” or “set sysroot”?
If additional information is required to debug this problem, please let me know. Or if there are useful dbus commands I could run to help figure this out. Thanks!
It turns out the session bus was not getting started on the device. I enabled it, but then I ran into the problem of the address not getting propagated to the environment variables. I can manually set it in a terminal, but I'm not sure how to do the same in Qt Creator.
Anyway, rather than spend more time figuring out the issues with the session bus, I switched to using the system bus. I just had to change the /etc/dbus-1/system.conf file to allow anyone to talk to the system bus and my applications work on the embedded device. I know that's probably not the long term solution, but it works for now.

Blackberry wifi http connection

I am building a blackberry application takes input from user then send input to a server and displays the xml returned from server.
The problem is, while application works fine on simulator it doesn't show results all the time on real device. Sometimes it is working but usually it's not. I am using wifi connection on device. The code is:
Connector.open(url + ";interface=wifi");
I am not using wifi on simulator. I just delete the 'interface=wifi' part and it runs using mds.
When input taken, a class extending Thread starts. It opens the connection and initializes variables. I take the inputstream from class and parse the xml. The device is a Blackberry 9700.I read something about connection timeout but i am not sure where problem is.
Edit: Found a simple way to connect. Here is the code for a GET request:
ConnectionFactory cf = new ConnectionFactory();
ConnectionDescriptor cd = cf.getConnection("YourUrl");
httpConnector = (HttpConnection) cd.getConnection();
httpConnector.setRequestMethod(HttpConnection.GET);
Maybe this might help: http://www.localytics.com/blog/2009/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/
The idea in that blog post is to check if WiFi is enabled, and in that case use that for connection string, and so on for various connection types.

Resources