I’ve been testing my phone’s bluetooth connection to my PC.
Here’s my config: Nokia N70 phone programmed in PyS60, PC with Ubuntu Linux kernel 8.04, Bluez, PyBluez and programmed in Python. And my phone and PC are sending data almost every half second, so there’s no chance of a timeout due to idle connection.
Feb 9:
Connection lasts only for 20-30 minutes. After that the phone’s bluetooth isn’t detectable by the PC and the phone’s bluetooth has to be restarted.
Feb 10:
Conditions worsens after a workaround. The script on phone works fine only for around 10 minutes. Then a broken pipe error is returned. Bluetooth doesn’t require a restart as before but the script needs to be restarted. My battery is drained out quickly. No idea why. The same happens again during midnight.
Feb 11:
Phone fully charged up. Started phone and PC scripts at 7:45am. Connection surprisingly withstands until 10am. Received broken pipe error. Bluetooth needs restart again. Called up Nokia customer care. Reset the phone’s settings. Connection started again at 10:15am. Connection is again surpassing previous active connection time. It’s 1:30pm and connection is still on. It’s been around 3 hours. Battery usage is fine. Just 30% of the battery has been drained out since morning.
update: I shutdown the phone’s script manually at 2pm to recharge the phone’s battery. The script working for 4hrs approx is proof that it can manage the load. Looking forward for an error-free launch today evening.
It isn’t possible to send SMS in an iteration in PyS60 since the messaging.sms_send() will raise an error if the previous SMS isn’t sent (or failed to send). The PyS60 docs say that the state of the previous SMS can be determined by using the callback function as an argument in messaging.sms_send() and then checking the state of the SMS by testing with messaging.ESent, messaging.ESendFailed and other messaging.E* states.
When you want to send SMSes repeatedly in an iteration you’re stuck when it comes to determining whether the previous has been sent. So here’s a quick and easy workaround.
Use the try-except to detect errors and loop until the previous SMS has been sent.
I executed all the insert statements for SQLite in Python and was wondering why my database was empty when I queried it. This I did from my Python script.
I was scratching my head as to what’s wrong and then found out that the isolation_level must be set to None while connecting to the database like below
from pysqlite2 import dbapi2 as sqlite
connection = sqlite.connect(‘jaxfu.db’,isolation_level=None)
cursor = connection.cursor()
bla bla bla… here goes your code… :)
Now it should work fine!
I have been tinkering with my bluetooth dongle and Nokia N70 phone trying to make a connection between them in Python. N70 is a S60 phone and supports PyS60 a limited version of python (but cool).
I tried to setup Bluetooth stack on Windows XP, but my bluetooth dongle driver is BlueSoliel and the latest version is being sold at a price. The BlueSoleil SDK has C++ and C examples which I don’t understand much. Python modules for bluetooth on Windows is PyBluez. But it supports only the Microsoft Bluetooth stack and the Widcomm stack. So I booted my Kubuntu and used the PyBluez on it. It worked fine and detected my bluetooth dongle. I am now also able to discover devices. I also tried lightblue, which depends on PyBluez, OBEXopen and Bluez. But lightblue seems to have a problem with the lightblue.advertise() function which enables to advertise devices on the open network.
Just noted that the kbluetooth tool must not be running to get the connections working. I just tried to make connections and it used to fail. Even now I’ve not got a connection right, but I just moved a step forward. I now get the usual password box on my phone. I’m using the Nokia N70 phone as a server(listening to a port) and my computer as a client to push data.