Staacks / alpharemote

Bluetooth remote for Sony cameras
GNU General Public License v3.0
21 stars 1 forks source link

Turning camera off and on breaks the connection with the app #4

Open anotherlab opened 5 days ago

anotherlab commented 5 days ago

Issue App does not always recognize the camera as connected

Steps to reproduce

  1. If I pair my A6400 to the app, the controls in the app work as expected.
  2. If I turn the camera off and on again, the app reports the camera as offline.
    1. Camera reports Bluetooth Function as on, Bluetooth Rmt Ctrl as on
    2. Camera shows up as a paired device on the phone.
    3. Restarting the app does not resolve the problem
  3. The only way to establish a connection is to remove the camera from app and add it back again.
  4. When "enough" time has passed, the app will pick up when the camera is restarted.
    1. The amount of time is unknown, at least a few minutes
    2. If you restart the camera again, the app does not see it.

Alpha Remote Version 0.16

Camera Sony A6400 (ILCE 6400), Ver 2.00

Lens Sigma 56mm F1.4 DC

Phone Samsung Galaxy S22 Ultra

Android Version 14

Staacks commented 3 days ago

I just found a comment on Reddit from another Samsung user with similar symptoms. He reports that updating to oneUI 6.1 fixed it for him. Can you tell me which version you currently have?

I am not sure if it is really because of oneUI. In fact, I suspect that the update included a common component or triggered something else, but at least it might be a starting point...

anotherlab commented 3 days ago

My phone is running One UI 6.1

Staacks commented 17 hours ago

This sounds very similar to what has just been reported in #1 : https://github.com/Staacks/alpharemote/issues/1#issuecomment-2474101746

So, I will repost what came to my mind:

I had something similar once when I tested the app on an Android 12 device. In that case I had my regular phone in my pocket and I learned the hard way that the camera actually remembers multiple paired devices. When I paired it with the Android 12 device, the camera was in pairing mode and therefore advertising, so I could pair and subsequently connect. But when I turned it off and on again, it simply connected to the phone in my pocket so fast that the Android 12 device did not even notice that the camera was there. (I will not mention how long it took me to realize that.)

So: Do you have another phone nearby to which the camera has already been paired (for my app or maybe for geotagging) or do you own the original Bluetooth remote that might be taking the connection immediately?

anotherlab commented 14 hours ago

I don't own the original Bluetooth remote, and the only device my camera is paired to is my phone.

When I go to Bluetooth Settings and then Pairing, the only paired device listed is my phone. The camera does report that it is paired to my phone, even when the app is reporting my camera as bing offlne.

I have used the Imaging Edge app for geotagging. Could there be a conflict with having two apps trying to connect to the camera? I was not running the Imaging Edge app when I tried to use your app.

Confirmed the same behavior with version 0.17. Works the first time, the app fails to reconnect after turning the camera off and on again

Staacks commented 8 hours ago

I think the camera always shows the name of the device it has been connected with last. At least I am not aware of any way to get a list of paired devices from it. But if there is no other device nearby, that theory is not going anywhere.

I also just tested what Imaging Edge would do to the Bluetooth connection and... oh boy... That app just keeps a foreground service open to actively scan for Bluetooth devices and now I remember why I never used it. But it only connects if "Location info. Link" is enabled, which cannot be enabled while "Bluetooth Remote Control" is enabled (I also have an a6400). So, I don't think that Imaging Endge would interfere and even if it did, you would notice its notification.

If you don't mind, I would like to check if the camera is sending advertisement packets and what they look like. If you have not yet dealt with Bluetooth before, I recommend installing the app "nRF connect" by Nordic Semiconductor for that. Open its "Scanner" tab, turn on the camera and see if it appears in the list. It should show up with a "connect" button next to it - if instead it immediately jumps to a tab where it is already connected to the camera, some app might be stealing it after all, but I would not expect that at this point. If you press the name of the camera on the Scanner tab, the entry will expand and show the information from the advertisement packet. If you tap "raw" below the data, you get an option to copy the raw data. That's what I would like to see.