I recently came up with a problem and can't find a way to solve it: I need to get sensor data from time to time, but sometimes the system crashes (get a message KErrInUse when trying to read sensor data) and I need to restart the phone to be able to use the resources again. What is the best way to make the sensor usable again? Maybe using symbian c++ if it is not implemented in python..
The way I read the data is using functions (part of a class):
def collect_data(self, samples=100):
self.samples = samples
self.app_lock = e32.Ao_lock()
if self.counter < self.samples:
self.counter = self.counter+1
Most often it crashes with MagneticNorthData. It seems like sensor.stop_listening() doesn't do what it's supposed to.
The routine is actually being run as a sub-thread of a main thread, so it is possible to track whether a thread that still should be running has crashed or not, but how do I free up the resources (sensor data) to make them usable again?
What would you think is the best practice to manage such system, having in mind that I need to collect data from different sensors simultaneously?
I am using 1.9.6 version of pys60 (was previously using 1.9.4, which had the same issue).