logon84 / pySVS

Python3 app to control SVS SB-1000 PRO subwoofer settings using bluetooth
MIT License
7 stars 1 forks source link

Support for selecting presets and PEQ #1

Closed NotReallyADeveloper closed 1 year ago

NotReallyADeveloper commented 1 year ago

This is exactly what I was looking for...thanks for engineering the solution!

Looking quickly at the code, it seems selecting presets and PEQ are not supported yet (app functionality that exists for the SB3000 and likely other models).

Is that because that isn't exposed, or rather because it's not supported when using the SB1000?

I can try to figure that out for myself, although as an unskilled / part-time coder, it will take me a while to figure out what you've done to get close to that.

Am attaching what is exposed when using a BT discovery tool with the SB3000.

FFFD2293-A03E-4976-A97C-70CB0905C61A

logon84 commented 1 year ago

This is exactly what I was looking for...thanks for engineering the solution!

Looking quickly at the code, it seems selecting presets and PEQ are not supported yet (app functionality that exists for the SB3000 and likely other models).

Is that because that isn't exposed, or rather because it's not supported when using the SB1000?

I can try to figure that out for myself, although as an unskilled / part-time coder, it will take me a while to figure out what you've done to get close to that.

Am attaching what is exposed when using a BT discovery tool with the SB3000.

FFFD2293-A03E-4976-A97C-70CB0905C61A

Hi. I'm glad you like my project. Presets and PEQ are not supported because I don't usually change them, and to port a new functionallity to the python version takes a lot of time and tests. In this case, even more because I would need to implement the filter preview on the gui. I don't discard to look into it in the future.

To discover what a function does on the svs app, you first need to enable developer settings in an android device and then enable bluetooth log. Then you use svs app to change the parameter you want to investigate to some specific values. After that, you copy the bluetooth log to a computer and import it in wireshark to see what the parameter is doing on every bluetooth frame (how the values are encoded). Once you know this, all you have to do is write a function to do the same in python.

In your screenshot you show some services of the subwoofer. 99.9% sure you don't need any of this to.implement peq and presets. Once you subscribe to the 'parameter exchange' UUID you will send to it whatever parameter you wish to change (volume, phase or peq and preset changes). Bye!

NotReallyADeveloper commented 1 year ago

Thanks for the extra info. TBH I'm more interested in the commands and protocol syntax than the GUI (I would repurpose as a bespoke gateway for IP control).

I'll also have to find an android device as that's the one platform I don't have access to - unless I can emulate.

logon84 commented 1 year ago

Thanks for the extra info. TBH I'm more interested in the commands and protocol syntax than the GUI (I would repurpose as a bespoke gateway for IP control).

I'll also have to find an android device as that's the one platform I don't have access to - unless I can emulate.

Good. Let me know if you find something interesting :)

NotReallyADeveloper commented 1 year ago

While I try to find out myself on how to do this, would it be helpful if I resubmit as two separate requests?

1) As a user who has set up different presets and EQ curves, I would like a way to select preconfigured settings through pySVS; 2) As a user with a fully automated audio system, I would like a way to read and write SW settings via the command line or API (TCP or Web-based).

logon84 commented 1 year ago

Point 1, I will look into it in a near future. Point2, as the sub doesn't contain a IP stack in it, is not a matter for this project to write one. You will need to write it yourself the way you want. Writing a command line mode will be doable tough by just opening every function on "GUI routines" section to accept parameters on the command line.

NotReallyADeveloper commented 1 year ago

This is what I've been able to capture over open air for presets (ended up getting it to work with iOS and PacketLogger):

Movie 00000000: 5B00 1600 1200 0400 120E 00AA 0704 0F00 00000010: 1800 0000 0100 0000 468B

Music 00000000: 5B00 1600 1200 0400 120E 00AA 0704 0F00 00000010: 1900 0000 0100 0000 468B Custom 00000000: 5B00 1600 1200 0400 120E 00AA 0704 0F00 00000010: 1B00 0000 0100 0000 468B Default 00000000: 5B00 1600 1200 0400 120E 00AA 0704 0F00 00000010: 1B00 0000 0100 0000 468B Response (all four) 00000000: 5B20 0500 0100 0400 13

I can otherwise start testing your app later today on a different model sub...first, where would one find the MAC address of the sub(s) for the script to work? It's not visible on iOS, Windows or Mac standard functions, and it's not even on the sub itself (which I find odd).

NotReallyADeveloper commented 1 year ago

Got the MAC address via another method and gave the app a whirl...perhaps more than the MAC address needs to be changed as the interface didn't show any preset values, nor did the sub accept what I set.

Here's the bleak debug w/ MAC Address redacted:

2023-02-07 19:01:01,583 bleak.backends.winrt.scanner DEBUG: Received xx:xx:xx:xx:xx:xx: SW1. 2023-02-07 19:01:01,584 bleak.backends.winrt.scanner DEBUG: 19 devices found. Watcher status: 3. 2023-02-07 19:01:01,584 bleak.backends.winrt.client DEBUG: Connecting to BLE device @ xx:xx:xx:xx:xx:xx 2023-02-07 19:01:01,609 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=None, cache_mode=None)... 2023-02-07 19:01:01,709 bleak.backends.winrt.client DEBUG: session_status_changed_event_handler: id: <_bleak_winrt_Windows_Devices_Bluetooth.BluetoothDeviceId object at 0x000001E12D6E2710>, error: BluetoothError.SUCCESS, status: GattSessionStatus.ACTIVE 2023-02-07 19:01:03,927 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: services changed 2023-02-07 19:01:03,927 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: restarting get services due to services changed event 2023-02-07 19:01:03,928 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=<BluetoothCacheMode.CACHED: 0>, cache_mode=None)... 2023-02-07 19:01:04,839 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: services changed 2023-02-07 19:01:04,840 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: restarting get services due to services changed event 2023-02-07 19:01:04,844 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=<BluetoothCacheMode.CACHED: 0>, cache_mode=None)... Connected: True C:\Users\ljr\Desktop\pySVS.py:155: FutureWarning: This method will be removed future version, use the services property instead. svcs = await client.get_services() SERVICE: 00001800-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Access Profile CHARACTERISTIC: 00002a00-0000-1000-8000-00805f9b34fb (Handle: 2): Device Name CHARACTERISTIC: 00002a01-0000-1000-8000-00805f9b34fb (Handle: 4): Appearance

SERVICE: 00001801-0000-1000-8000-00805f9b34fb (Handle: 6): Generic Attribute Profile

SERVICE: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 7): Device Information CHARACTERISTIC: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 8): Serial Number String CHARACTERISTIC: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 10): Manufacturer Name String

SERVICE: 1fee6acf-a826-4e37-9635-4d8a01642c5d (Handle: 12): Unknown CHARACTERISTIC: 6409d79d-cd28-479c-a639-92f9e1948b43 (Handle: 13): Unknown CHARACTERISTIC: 7691b78a-9015-4367-9b95-fc631c412cc6 (Handle: 16): Unknown

-> ASK VOLUME b'00' -> ASK PHASE b'00' -> ASK LOW_PASS_FILTER_ALL_SETTINGS b'00' -> ASK ROOM_GAIN_ALL_SETTINGS b'00' -> SET VOLUME b'00c4ff' 2023-02-07 19:01:26,123 bleak.backends.winrt.client DEBUG: session_status_changed_event_handler: id: <_bleak_winrt_Windows_Devices_Bluetooth.BluetoothDeviceId object at 0x000001E12D6E2250>, error: BluetoothError.SUCCESS, status: GattSessionStatus.CLOSED 2023-02-07 19:01:26,123 bleak.backends.winrt.client DEBUG: closing requester 2023-02-07 19:01:26,126 bleak.backends.winrt.client DEBUG: closing session

logon84 commented 1 year ago

Got the MAC address via another method and gave the app a whirl...perhaps more than the MAC address needs to be changed as the interface didn't show any preset values, nor did the sub accept what I set.

Here's the bleak debug w/ MAC Address redacted:

2023-02-07 19:01:01,583 bleak.backends.winrt.scanner DEBUG: Received xx:xx:xx:xx:xx:xx: SW1. 2023-02-07 19:01:01,584 bleak.backends.winrt.scanner DEBUG: 19 devices found. Watcher status: 3. 2023-02-07 19:01:01,584 bleak.backends.winrt.client DEBUG: Connecting to BLE device @ xx:xx:xx:xx:xx:xx 2023-02-07 19:01:01,609 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=None, cache_mode=None)... 2023-02-07 19:01:01,709 bleak.backends.winrt.client DEBUG: session_status_changed_event_handler: id: <_bleak_winrt_Windows_Devices_Bluetooth.BluetoothDeviceId object at 0x000001E12D6E2710>, error: BluetoothError.SUCCESS, status: GattSessionStatus.ACTIVE 2023-02-07 19:01:03,927 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: services changed 2023-02-07 19:01:03,927 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: restarting get services due to services changed event 2023-02-07 19:01:03,928 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=<BluetoothCacheMode.CACHED: 0>, cache_mode=None)... 2023-02-07 19:01:04,839 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: services changed 2023-02-07 19:01:04,840 bleak.backends.winrt.client DEBUG: xx:xx:xx:xx:xx:xx: restarting get services due to services changed event 2023-02-07 19:01:04,844 bleak.backends.winrt.client DEBUG: getting services (service_cache_mode=<BluetoothCacheMode.CACHED: 0>, cache_mode=None)... Connected: True C:\Users\ljr\Desktop\pySVS.py:155: FutureWarning: This method will be removed future version, use the services property instead. svcs = await client.get_services() SERVICE: 00001800-0000-1000-8000-00805f9b34fb (Handle: 1): Generic Access Profile CHARACTERISTIC: 00002a00-0000-1000-8000-00805f9b34fb (Handle: 2): Device Name CHARACTERISTIC: 00002a01-0000-1000-8000-00805f9b34fb (Handle: 4): Appearance

SERVICE: 00001801-0000-1000-8000-00805f9b34fb (Handle: 6): Generic Attribute Profile

SERVICE: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 7): Device Information CHARACTERISTIC: 00002a25-0000-1000-8000-00805f9b34fb (Handle: 8): Serial Number String CHARACTERISTIC: 00002a29-0000-1000-8000-00805f9b34fb (Handle: 10): Manufacturer Name String

SERVICE: 1fee6acf-a826-4e37-9635-4d8a01642c5d (Handle: 12): Unknown CHARACTERISTIC: 6409d79d-cd28-479c-a639-92f9e1948b43 (Handle: 13): Unknown CHARACTERISTIC: 7691b78a-9015-4367-9b95-fc631c412cc6 (Handle: 16): Unknown

-> ASK VOLUME b'00' -> ASK PHASE b'00' -> ASK LOW_PASS_FILTER_ALL_SETTINGS b'00' -> ASK ROOM_GAIN_ALL_SETTINGS b'00' -> SET VOLUME b'00c4ff' 2023-02-07 19:01:26,123 bleak.backends.winrt.client DEBUG: session_status_changed_event_handler: id: <_bleak_winrt_Windows_Devices_Bluetooth.BluetoothDeviceId object at 0x000001E12D6E2250>, error: BluetoothError.SUCCESS, status: GattSessionStatus.CLOSED 2023-02-07 19:01:26,123 bleak.backends.winrt.client DEBUG: closing requester 2023-02-07 19:01:26,126 bleak.backends.winrt.client DEBUG: closing session

It seems to me that there is a problem with bleak module. I cannot do any test right now because my sub is on svs technical service. Try downgrading module to version 0.14.2, because it is the version I have installed on windows and pysvs was working ok with that version. Bye

NotReallyADeveloper commented 1 year ago

Try downgrading module to version 0.14.2, because it is the version I have installed on windows and pysvs was working ok with that version.

Downgraded. Same behaviour (connects, but seemingly gets no response to ASK commands as debug shows nothing and GUI doesn't change).

logon84 commented 1 year ago

Try downgrading module to version 0.14.2, because it is the version I have installed on windows and pysvs was working ok with that version.

Downgraded. Same behaviour (connects, but seemingly gets no response to ASK commands as debug shows nothing and GUI doesn't change).

I don't know what is happening....Until I have my device back, there is not much I can test. Try maybe with a live linux to see if it works.

NotReallyADeveloper commented 1 year ago

I'll try again with my mac, but as I recall, it was the same behaviour.

(Sorry about your sub, too :( )

logon84 commented 1 year ago

Did you try again with your mac? If still not working, can you try with version 2.6? (I still don't have my subwoofer) Also, I am interested in windows version visible on "msinfo32", python version and output of "pip list". Thanks