waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Support socket functions so that G glass can talk to android phone via Wifi or bluetooth #272

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by xiaosong...@gmail.com on 28 Nov 2013 at 8:53

GoogleCodeExporter commented 9 years ago
I haven't tried it but does the Glass version of Android not support standard 
Wifi or Bluetooth socket communication like vanilla Android does or is this a 
request to implement a simplified GDK-API version such as Chromecast 
receiver/sender?

Original comment by j.romero.1214 on 2 Dec 2013 at 11:00

GoogleCodeExporter commented 9 years ago
Could you elaborate on what you're trying to accomplish? It will help us 
understand the feature request and probably point you to some existing 
solutions.

Original comment by ala...@google.com on 2 Dec 2013 at 11:14

GoogleCodeExporter commented 9 years ago
Hey, I want to get a connection between G Glass and
my PC. G Glass doesn't get the connection and but it doesn't get an exception 
too. 
After Socket socket = new Socket(hostname, port) my program goes into the catch 
block
but exception message is null.

Original comment by bastia...@gmail.com on 17 Dec 2013 at 11:00

GoogleCodeExporter commented 9 years ago
I am hoping to have this feature as well. It is unlikely that the glass will be 
very battery efficient so it might not be feasible to run a lot of labor 
intensive services constantly. 

If google can provide an official client and server implementation of data 
transfer between glass and the phone then that will be great.  

Original comment by Platinum...@gmail.com on 21 Jan 2014 at 6:14

GoogleCodeExporter commented 9 years ago
Hello,

Sorry for the delay in getting back to you! Opening a socket should work on 
Glass as with any Android devices.
However, if your Glass is using your phone's connection (not connected to a 
WIFI network), opening a socket does not necessarily mean a successful 
connection: you should send a request to the server to verify that the 
connection has actually been made.

Best,
Alain

Original comment by ala...@google.com on 3 Feb 2014 at 11:52

GoogleCodeExporter commented 9 years ago
It appears that you are suggesting that having Glass connected to your phone 
for data, instead of being on WiFi only, could cause your Bluetooth socket 
connections to fail. This seems odd since I've seen statements that Android 
should support 6-7 simultaneous Bluetooth socket connections.

This issue hasn't been updated in a while. What is the current state of this 
feature and Bluetooth in XE 17?

I've been able to connect to socket connections with BT headsets, but all 
attempts to connect to BT keyboards give me failures to read from the socket.

Do we need to manage, read, or modify the device profile before making these 
connections? It seems like on phones Android takes care of this, but Glass 
appears to have broken this since sometime after XE 11 or 12. 

The upgrade to XE 16 and switch from Bluez to Bluedroid does not appear to have 
improved anything.

Original comment by Splak...@gmail.com on 10 May 2014 at 4:50

GoogleCodeExporter commented 9 years ago
Hello,

It seems that there were some confusions as to what was being tracked in this 
issue: my comment on #5 was a reply to #3 mentioning that an opened socket does 
not mean a successful connection when trying to reach the internet through the 
MyGlass proxy.

Regarding Bluetooth socket errors, could you provide any debugging information 
that could help us investigate? If you had a bugreport or a stacktrace, that 
would be really helpful.

Thanks!
Alain

Original comment by ala...@google.com on 15 May 2014 at 6:13

GoogleCodeExporter commented 9 years ago
There are some logcats and stack traces here: 
https://github.com/DDRBoxman/Bluetooth-Manager-for-Glass/issues/6

These are related to issue #372 and issue #495.

Here are some of the stack traces:

05-10 18:23:52.502  19696-19734/com.recursivepenguin.bluetoothmanagerforglass 
E/ConnectThread﹕ Connection failed, trying fallback...
    java.io.IOException: read failed, socket might closed or timeout, read ret: -1
            at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:510)
            at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:521)
            at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:320)
            at com.recursivepenguin.bluetoothmanagerforglass.ConnectThread.run(ConnectThread.java:57)
05-10 18:23:52.580  19696-19734/com.recursivepenguin.bluetoothmanagerforglass 
E/ConnectThread﹕ Connect to fallback socket failed
    java.io.IOException: read failed, socket might closed or timeout, read ret: -1
            at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:510)
            at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:487)
            at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:324)
            at com.recursivepenguin.bluetoothmanagerforglass.ConnectThread.run(ConnectThread.java:72)
05-10 18:23:52.588  19696-19734/com.recursivepenguin.bluetoothmanagerforglass 
E/ConnectThread﹕ Unable to connect device Microsoft Bluetooth Mobile Keyboard 
6000.
05-10 18:23:53.455  19696-19696/com.recursivepenguin.bluetoothmanagerforglass 
D/PairDevicesActivity﹕ Device paired.

05-10 19:29:01.510     890-1284/? W/bt-sdp﹕ process_service_search_attr_rsp
05-10 19:29:01.518     890-1284/? E/bt-btif﹕ DISCOVERY_COMP_EVT slot id:1310, 
failed to find channle,                                       status:1, scn:0
05-10 19:29:01.518     890-1335/? W/bt-btif﹕ invalid rfc slot id: 1310
05-10 19:29:01.791     890-1284/? W/bt-sdp﹕ process_service_search_attr_rsp
05-10 19:29:01.791     890-1284/? W/bt-rfcomm﹕ PORT_StartCnf failed result:2
05-10 19:29:01.791     890-1335/? W/bt-btif﹕ invalid rfc slot id: 1312
05-10 19:29:03.776     890-1284/? W/bt-sdp﹕ process_service_search_attr_rsp
05-10 19:29:06.346      516-821/? W/InputMethodManagerService﹕ Focus gain on 
non-focused client 
com.android.internal.view.IInputMethodClient$Stub$Proxy@210818f0 (uid=1000 
pid=702)
05-10 19:29:06.635     890-1284/? W/bt-sdp﹕ SDP - Rcvd conn cnf with error: 
0x4  CID 0x42
05-10 19:29:06.635     890-1284/? E/bt-btif﹕ DISCOVERY_COMP_EVT slot id:1311, 
failed to find channle,                                       status:1, scn:0
05-10 19:29:06.643     890-1335/? W/bt-btif﹕ invalid rfc slot id: 1311
05-10 19:29:07.916     890-1284/? E/bt-btm﹕ btm_sec_disconnected - Clearing 
Pending flag
05-10 19:29:07.916     890-1284/? E/bt-btm﹕ btm_sec_disconnected() 
sec_req:0x0  State: 0   reason:0x16 bda:7c1e52a87f0f RName:Microsoft Bluetooth 
Mobile Keyboard 6000
05-10 19:31:21.823      516-554/? E/ConnectivityService﹕ Exception trying to 
remove a route: java.lang.IllegalStateException: command '505 interface route 
remove wlan0 default 192.168.1.0 24 0.0.0.0' failed with '400 505 Failed to 
remove route from default table (No such process)'
05-10 19:31:21.823      516-554/? E/ConnectivityService﹕ Exception trying to 
remove a route: java.lang.IllegalStateException: command '506 interface route 
remove wlan0 default 192.168.1.1 32 0.0.0.0' failed with '400 506 Failed to 
remove route from default table (No such process)'
05-10 19:31:21.823      516-554/? E/ConnectivityService﹕ Exception trying to 
remove a route: java.lang.IllegalStateException: command '507 interface route 
remove wlan0 default 0.0.0.0 0 192.168.1.1' failed with '400 507 Failed to 
remove route from default table (No such process)'
05-10 19:31:25.143    702-16652/? E/NetworkSocketThread﹕ failed to listen for 
network client socket connect
    java.net.SocketException: Socket closed
            at libcore.io.Posix.accept(Native Method)
            at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55)
            at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98)
            at java.net.ServerSocket.implAccept(ServerSocket.java:203)
            at java.net.ServerSocket.accept(ServerSocket.java:128)
            at com.google.glass.bluetooth.companion.NetworkSocketThread.runServer(NetworkSocketThread.java:167)
            at com.google.glass.bluetooth.companion.NetworkSocketThread.runInternally(NetworkSocketThread.java:232)
            at com.google.glass.bluetooth.companion.CompanionServerThread.run(CompanionServerThread.java:86)

Please let me know if there is any other data that could be helpful. I've tried 
to explain a lot of what I've tried in the above GitHub issue. The originally 
working code (in XE 11) can be seen there in the repo. Pairing is working fine, 
but Android is not properly connecting to the device when it is on and in range 
after it is paired.

Original comment by Splak...@gmail.com on 16 May 2014 at 5:30

GoogleCodeExporter commented 9 years ago

Original comment by ala...@google.com on 16 May 2014 at 6:16

GoogleCodeExporter commented 9 years ago
What is the status on this issue?
With the latest update, is it possible to open up a RFCOMM channel on the glass 
to connect to a PC?

Original comment by GeorgeY....@gmail.com on 6 Aug 2014 at 10:12