I have a project creating a PTZ Joystick to control a PTZOptics camera.
Wifi is working fine using wifi.h, control HTTP-CGI commands work, camera moves.
However.....
In order to enquire where on the zoom scale the camera currently is, I can't use HTTP-CGI, I have to use VISCA over IP.
I need to send a hex packet 81 09 04 47 FF over TCP or UDP which will return a position packet of 90 50 0p 0q 0r 0s FF. For example 90 50 04 00 00 00 FF is fully zoomed in.
I've gone through the Wifi example code and examples on the net but I think I need pointing in the right direction as there are so many paths to do this and I'm getting confused...
how this is done depends on the type of micro-controller that you are using.
So please post the exact name of microcontroller / your microcontroller-board.
Yes, I've seen a number of those before. That's the issue, that they are using the Arduino has a converter between serial PTZ connections and UDP, as a converter for their non IP enabled cameras.
I don't need that step as our camera is IP enabled. I can write a function and pass the hex values / command needed. It's the sending and listening for TCP / UDP hex that I'm stuck on.
True, given the joystick would be sending a request to move 1 unit at a time, if one request was delivered out of order, or not delivered, the camera would only move if it received a good packet and not move if it didn't. I can also listen for a success VISCA over IP packet (if it receives a valid UDP packet) from the camera before sending another UDP packet.
He's creating a proxy for UDP to RS232 though. I don't need one.
There is a WifiUdp.h library that has written for ESP32 boards.
github com espressif arduino-esp32 blob master libraries WiFi src WiFiUdp.h
(I can't send more than two URLs.)
as you can see for using the udp.write-function the string has to be type-casted into uint8_t anyway. So sending a few bytes with hexadecimal values should be pretty straight forward