From 78a66248018b20de191a59584da6a52398b3f89c Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Tue, 20 Oct 2020 19:10:45 +0900 Subject: [PATCH] change ip from const char* to String --- Artnet.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Artnet.h b/Artnet.h index b09f5c2..9bbcdfb 100644 --- a/Artnet.h +++ b/Artnet.h @@ -153,7 +153,7 @@ namespace arx class Sender_ { Array packet; - const char* ip; + String ip; uint16_t port {DEFAULT_PORT}; uint8_t target_net {0}; uint8_t target_subnet {0}; @@ -210,7 +210,7 @@ namespace arx void send() { packet[IDX(Index::SEQUENCE)] = seq++; - stream->beginPacket(ip, port); + stream->beginPacket(ip.c_str(), port); stream->write(packet.data(), packet.size()); stream->endPacket(); } @@ -244,7 +244,7 @@ namespace arx protected: - void attach(S& s, const char* user_ip, const uint16_t user_port = DEFAULT_PORT) + void attach(S& s, const String& user_ip, const uint16_t user_port = DEFAULT_PORT) { stream = &s; ip = user_ip; @@ -442,7 +442,7 @@ namespace arx { S stream; public: - void begin(const char* send_ip, const uint16_t send_port = DEFAULT_PORT, const uint16_t recv_port = DEFAULT_PORT) + void begin(const String& send_ip, const uint16_t send_port = DEFAULT_PORT, const uint16_t recv_port = DEFAULT_PORT) { stream.begin(recv_port); this->Sender_::attach(stream, send_ip, send_port); @@ -455,8 +455,9 @@ namespace arx { S stream; public: - void begin(const char* ip, const uint16_t port = DEFAULT_PORT) + void begin(const String& ip, const uint16_t port = DEFAULT_PORT) { + stream.begin(DEFAULT_PORT); this->Sender_::attach(stream, ip, port); } };