Created
January 26, 2021 10:21
-
-
Save sandikodev/32d22b9e09176b331e0dfcb43ab86abe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Ethernet.h> | |
| #include <SPI.h> | |
| byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; | |
| byte ip[] = { 192, 168, 0, 177 }; | |
| byte server[] = { 192,168, 0, 64}; // Google | |
| 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(ip); | |
| Serial.begin(9600); | |
| delay(1000); | |
| Serial.println("connecting..."); | |
| if (client.connect(server, 80)) { | |
| Serial.println("connected"); | |
| client.println("PUT /Video/inputs/channels/1/overlays/text/1 HTTP/1.0"); | |
| client.println("Host: 192.168.0.64"); | |
| client.println("Authorization: Basic YWRtaW46MTIzNDVxd2VydHk="); | |
| 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(;;) | |
| ; | |
| } | |
| } | |
| /* | |
| client.println("POST /Video/inputs/channels/1/overlays/text/1 HTTP/1.0"); | |
| client.println("Host: 192.168.0.64"); | |
| client.println("Authorization: Basic YWRtaW46MTIzNDVxd2VydHk="); | |
| client.print("Content-lenght: "); | |
| client.println(big_string.length()); // size of the request body (after the empty line) | |
| client.println(); // mandatory empty line to end headers | |
| client.println(big_string); | |
| */ | |
| //sumber | |
| //https://arduino.stackexchange.com/questions/58050/from-arduino-ethernet-shiled-to-camera-stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment