kostyll / android-scripting

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

In remote server mode bluetoothActiveConnections() lies after script reconnect #653

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
SL4A r6

How to reproduce:
1. Start SL4A in remote public server
2. Connect to remote public server (e.g. run script)
3. Connect to BT device - 
bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', BT_MAC)
4. bluetoothActiveConnections() returns actual info - All ok:
<<client: sent: "{"params":[],"method":"bluetoothActiveConnections","id":4}">>
<<client: rcvd: 
"{"error":null,"id":4,"result":{"39c68254-9507-481c-8e4f-1cb04e8111a0":"00:12:02
:10:03:65"}}">>
$result = {
            'error' => undef,
            'id' => 4,
            'result' => {
                          '39c68254-9507-481c-8e4f-1cb04e8111a0' => '00:12:02:10:03:65'
                        }
          };
5. Disconnect to remote public server (e.g. terminate script)
6. Reconnect to remote public server (e.g. run script again)
7. bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', BT_MAC) will fail 
with "bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', BT_MAC)" - It's 
OK, since we already do this at step #3
8. If run bluetoothActiveConnections() - it will tell me "NO active 
connections" - WRONG:
<<client: sent: "{"params":[],"method":"bluetoothActiveConnections","id":1}">>
<<client: rcvd: "{"error":null,"id":1,"result":{}}">>
$result = {
            'error' => undef,
            'id' => 1,
            'result' => {}
          };

Perl script:
===========================
use strict;
use warnings;

use Android;
local $| = 1;

my  $droid   = Android->new();

my  $res = $droid->bluetoothActiveConnections();

    $res = $droid->bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', '00:12:02:10:03:65');
    exit if (defined($res->{error}));

my  $bt_id = $res->{result};

    $res = $droid->bluetoothActiveConnections();

    $droid->bluetoothWrite("Hello!\n\r", $bt_id);

    exit;

Original issue reported on code.google.com by amurch...@gmail.com on 26 Aug 2012 at 6:54