vieuxcarre44 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

Bluetooth Crash #418

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following program will reportedly cause the Terminal to seize up after 
calling droid.bluetoothWrite(result + '\n').

import android
import time

print 'print works at this point'
droid = android.Android()
droid.toggleBluetoothState(True)
droid.dialogCreateAlert('Be a server?')
droid.dialogSetPositiveButtonText('Yes')
droid.dialogSetNegativeButtonText('No')
droid.dialogShow()
result = droid.dialogGetResponse()
is_server = result.result['which'] == 'positive'
if is_server:
 droid.bluetoothMakeDiscoverable()
 droid.bluetoothAccept()
else:
 droid.bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB')

if is_server:
 result = droid.getInput('Chat', 'Enter a message').result
 if result is None:
   droid.exit()
 droid.bluetoothWrite(result + '\n')

print 'print stops working at this point, printing one character then
nothing ever again'

while True:
 droid.makeToast("attempting read")
 if droid.bluetoothReadReady():
   print droid.bluetoothRead()

 result = droid.getInput('Chat', 'Enter a message').result
 if result is None:
   break
 droid.bluetoothWrite(result + '\r' + '\n')

droid.exit()

Original issue reported on code.google.com by damonkoh...@gmail.com on 6 Sep 2010 at 7:42