ESP32 AsyncWebServer combined with WifiClient communicating with same IP address - esp32

My setup is as follows. An ESP32 devkit and a Sonos music player. The idea is to control the Sonos box, using a WiFiClient. With the ESP32 and its connected buttons, I send commands to the Sonos, to play a certain music file, set the volume and many other things. Works well.
The music files are just urls that direct the Sonos to fetch the music file from.
The next step was to add an SD card to my ESP32 and store musicfiles on the SD. I used ESPAsyncWebser, and I can retrieve the music files from my ESP32. Sonos plays them perfectly.
It's the combination that fails sometimes. While the asyncwebserver does it's job and sends out the music data, and the ESP talking to the same Sonos to change volume or add a song to the playlist/queue, it sometimes hangs just there, and the WifiClient is not able to connect or reconnect anymore, and no more music data is sent out. The ESP32 does not really crash, it still functions, the buttons keep working etcetera.
My WifiClient only connects to port 1400 on the Sonos. The Sonos gets the music from the webserver at port 80.
The bare question is, is it even possible to use WiFiClient objects together with the ESPAsyncWebServer when both are connected to the same IP address (the Sonos box) ?
Thanks in advance for any pointers ;-)

Related

using joystick on one raspberry pi to control input on second raspberry pi

I have a raspberry pi 4(let's call it server) that's operating servos and motors on a boat. I've managed to control the boat using another raspberry pi 4( let's call it client) and connect via SSH. First remote control was via touchscreen and gui that ended up pretty useless. I wanna try control by joystick which I've placed on client side. My problem is how do I implement the signal from joystick that I get from script on client as input signal on server side? Is there a way to do that via SSH or something else? In longterm there will be a camera, radar and sensors placed on the boat. Is the websocket best solution for that type of remote control?
Personally, I think I'd set up MQTT for this which is ideal for transferring short messages and doesn't require absolute "lock-step" communication back and forth. That means you can start in any order and the second half doesn't need to necessarily be present.
I'd install mosquitto on either RasPi, and then:
let RasPi with devices attached subscribe to a "joystick" topic so it gets all joystick movements, and
let RasPi with joystick attached publish each movement on that topic.
Enter [mqtt] in the StackOverflow search box for examples.
Alternatively, you could use Redis "pub/sub" just the same.
Enter [redis] in the StackOverflow search box for examples.

Route websocket data through USB link to PC client (Android)

I have an issue where WiFi is not available on an Android device. We want to stream image data from the device using a websocket server (written using WebSocket++) through to the PC. However, I'm not sure if this is possible without operational WiFi. So, the position we are in is that we may only have the USB link available.
Someone today suggested we might be able to get Websockets working using adb port forwarding (see https://developer.android.com/studio/command-line/adb#forwardports), but I'm not sure if that's correct. Could this work, and what would that solution look like?
Are there any other reasonable options. I'm not certain if tethering is available on the device and if that could be another solution?

From WiFi to Cellular 3/4G on ESP32

I am building a project utilizing Wifi on the ESP32 module. Using RTOS, I am running a web server on 1 core and a web client on another core. This works very well and I can access the web server remotely via my browser and the WiFi provided IP address. The Web client reads some sensors and sends the data via WiFi to my database. All good and everything works as desired.
Now I need to do the next step and move beyond the reach of the WiFi and reproduce the same result via 3/4G cellular. I looked at the "easy" solution to use an industrial 3/4G WiFi router and simply keep what I have. Cost of these "industrial" type routers are on the high side, where as 3/4G module which also include a GPS chip are around half or less. Problem is that I cannot get my head around how I will "replace" my current WiFi functionality with one of these modules. The modules seems to expect you to connect via serial (rs232) and using modem AT commands establish a connection to the internet. Question is, after connecting to the internet, how do you continue to have "network functionality" same as with the built-in WiFi? Is there some library that will do ethernet over the serial port? Can I still have the WiFi and the "serial ethernet" running at the same time or switch between the two?
Thanks!

Using Sony Camera API on AndroidWear

I want to create an app that can start and stop recording from a Sony AS100VR camera using camera remote API.
I can get the same working from my nexus using a direct Wifi connection, but when I establish a direct wifi connection from my Sony smartwatch, it fails at the SSDP detection stage.
It's definitely connected to the camera, SSID over Wifi, but it can't detect it.
I have tried playing with retries and timeout values, but I have sort of run out of ideas.
it's falling into the catch catch (InterruptedIOException e) with a java.net.SocketTimeoutException
Any suggestions gratefully appreciated!
UDP Mulitcast is not available on smartwatch, so SSDP discovery fails.
There is a fail-safe choice for any UPnP based application, that is:
As in most case, the resource URL structure keeps unchanged except IP Address, so when SSDP discovery failed, let user directly input the IP Address (maybe in form of UI Picker) and get "DeviceDescription.xml" or something else then setup services.
Have you taken a look at the CameraRemoteSampleApp that comes with the Camera Remote API SDK? I assume when you say Smartwatch you mean you are using a Sony SmartWatch 3 that supports a direct WiFi connection? If so, you should be able to modify the sample app with minimal changes and run it on the SW3.

A confusion about chromecast discover

When I click google cast icon in my chrome browser, it will try to discover whether there is an available chromecast around my pc.
If yes, then it will recognize it (assume that chromecast has already been set and connect to the same router which my pc is connected to).
My first confusion is, during this course, does my pc ever connect to chromecast's own wifi signal? Or they ONLY talk via my router?
My second confusion comes from a test:
I set 2 routers: router_A on top;router_B connects to LAN port of router_A;
My pc also connects to router_A;
chromecast dongle connects to router_B;
multicast/upnp of router B is enabled, firewall on router_B is disabled.
My pc cannot find chromecast in this situation. I'm confused and I think it should work since router_B obtains ip/gateway from router_A.
The third confusion is when I swapped my pc and chromcast, to let my pc connect to router_B, and chromecast connect to router_A, my pc found the chormcast......
After Chormecast is set up with a wifi network, it is discovered through mDNS. For (2) and (3), since discovery is done through multicast/mDNS, you need to read on that topic and look at the configuration settings of your routers to see how you can set things up to get what you want.

Resources