Hi all experts,
I am quite new to the Arduino coding scene and learning as i am implimenting.
I have a small project that i am working on to have an Arduino Uno+ethernet shield text overlay on to a Hikvision (1) camera and i have become stuck. There will be additional code added to this later on however i wanted to see if the text overlay could be achieved before i went and added any more code to confuse the situation. I have managed to get the board to connect to the camera via ethernet (serial monitor reads = Connecting.. Connected) but am still struggling to have the text overlay onto the actual camera view. I know that the code for the Arduino to overlay the text needs to be xml and i have found a few lines of code to see if it will work however being new to this i am unsure if it is in the correct order, right spot or even the right code. I have little coding experience so any help would be much appreciated.
Hardware -
Arduino Uno w/ ethernet shield.
Hikvision Camera
iVMS-4200 software
Code:
#include <Arduino.h>
#include <Ethernet.h>
#include <SPI.h>
#include <IPAddress.h>
byte IntMac[] = { 0xF8, 0x4D, 0xFC, 0x4B, 0x74, 0xC2 };
byte IntIP[] = { 192, 168, 1, 10 };
byte CamIP[] = { 192, 168, 1, 104 };
String big_string="<?xml version='1.0' encoding='UTF-8'?>-<TextOverlay xmlns='http://www.hikvision.com/ver10/XMLSchema' version='1.0'><id>1</id><enabled>true</enabled><posX>0</posX><posY>96</posY><message>AAAAAA</message></TextOverlay>";
EthernetClient client;
void setup()
{
Ethernet.begin(IntMac, IntIP);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
if (client.connect(CamIP, 80)) {
Serial.println("connected");
client.println("PUT /Video/inputs/channels/1/overlays/text/1 HTTP/1.0");
client.println("Host: 192.168.1.104");
client.println("Authorization: Basic YWRtaW46bWVybGluITIz");
client.print("content-length: 232");
client.println("<?xml version='1.0' encoding='UTF-8'?>-<TextOverlay xmlns='http://www.hikvision.com/ver10/XMLSchema' version='1.0'><id>1</id><enabled>true</enabled><posX>0</posX><posY>96</posY><message>iuhinjkjn</message></TextOverlay>");
// client.println("888");
client.println();
client.print(big_string);
} else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}