fix const

master
Hideaki Tai 4 years ago
parent 795905b01f
commit 4bfc750a6a

@ -192,17 +192,17 @@ namespace arduino
virtual ~Sender_() {}
void net(uint8_t n) { target_net = n & 0x7F; }
void subnet(uint8_t s) { target_subnet = s & 0x0F; }
void universe(uint8_t u) { target_universe = u & 0x0F; }
void universe15bit(uint8_t u)
void net(const uint8_t n) { target_net = n & 0x7F; }
void subnet(const uint8_t s) { target_subnet = s & 0x0F; }
void universe(const uint8_t u) { target_universe = u & 0x0F; }
void universe15bit(const uint8_t u)
{
net((u >> 8) & 0xFF);
subnet((u >> 4) & 0x0F);
universe((u >> 0) & 0x0F);
}
void set(const uint8_t* const data, uint16_t size = 512)
void set(const uint8_t* const data, const uint16_t size = 512)
{
packet[IDX(Index::PHYSICAL)] = phy;
packet[IDX(Index::NET)] = target_net;
@ -212,13 +212,13 @@ namespace arduino
memcpy((&packet[IDX(Index::DATA)]), data, size);
}
void set(const uint32_t universe_, const uint8_t* const data, uint16_t size = 512)
void set(const uint32_t universe_, const uint8_t* const data, const uint16_t size = 512)
{
universe15bit(universe_);
set(data, size);
}
void set(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, uint16_t size = 512)
void set(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, const uint16_t size = 512)
{
net(net_);
subnet(subnet_);
@ -238,17 +238,17 @@ namespace arduino
stream->write(packet.data(), packet.size());
stream->endPacket();
}
void send(const uint8_t* const data, uint16_t size = 512)
void send(const uint8_t* const data, const uint16_t size = 512)
{
set(data, size);
send();
}
void send(const uint32_t universe_, const uint8_t* const data, uint16_t size = 512)
void send(const uint32_t universe_, const uint8_t* const data, const uint16_t size = 512)
{
set(universe_, data, size);
send();
}
void send(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, uint16_t size = 512)
void send(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, const uint16_t size = 512)
{
set(net_, subnet_, universe_, data, size);
send();
@ -263,12 +263,12 @@ namespace arduino
}
}
void physical(uint8_t i) { phy = constrain(i, 0, 3); }
void physical(const uint8_t i) const { phy = constrain(i, 0, 3); }
uint8_t sequence() const { return seq; }
protected:
void attach(S& s, const char* user_ip, uint16_t user_port = DEFAULT_PORT)
void attach(S& s, const char* user_ip, const uint16_t user_port = DEFAULT_PORT)
{
stream = &s;
ip = user_ip;
@ -420,7 +420,7 @@ namespace arduino
{
S stream;
public:
void begin(const char* send_ip, uint32_t send_port = DEFAULT_PORT, uint32_t recv_port = DEFAULT_PORT)
void begin(const char* send_ip, const uint16_t send_port = DEFAULT_PORT, const uint16_t recv_port = DEFAULT_PORT)
{
stream.begin(recv_port);
this->Sender_<S>::attach(stream, send_ip, send_port);
@ -433,7 +433,7 @@ namespace arduino
{
S stream;
public:
void begin(const char* ip, uint32_t port = DEFAULT_PORT)
void begin(const char* ip, const uint16_t port = DEFAULT_PORT)
{
this->Sender_<S>::attach(stream, ip, port);
}
@ -444,7 +444,7 @@ namespace arduino
{
S stream;
public:
void begin(uint32_t port = DEFAULT_PORT)
void begin(const uint16_t port = DEFAULT_PORT)
{
stream.begin(port);
this->Receiver_<S>::attach(stream);

@ -7,7 +7,7 @@ Art-Net Sender/Receiver for Arduino (Ethernet, WiFi)
- support Art-Net with both Ethernet and WiFi
- register multiple callbacks depending on universe
- flexible net/subnet/universe setting
- etc.
## Usage
@ -174,45 +174,45 @@ artnet.begin(ip, send_port, recv_port); // set your own
### ArtnetSender
```C++
void net(uint8_t n)
void subnet(uint8_t s)
void universe(uint8_t u)
void universe15bit(uint8_t u)
void set(const uint8_t* const data, uint16_t size = 512)
void set(const uint32_t universe_, const uint8_t* const data, uint16_t size = 512)
void set(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, uint16_t size = 512)
void send()
void send(const uint8_t* const data, uint16_t size = 512)
void send(const uint32_t universe_, const uint8_t* const data, uint16_t size = 512)
void send(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, uint16_t size = 512)
void streaming()
void physical(uint8_t i)
uint8_t sequence() const
void net(const uint8_t n);
void subnet(const uint8_t s);
void universe(const uint8_t u);
void universe15bit(const uint8_t u);
void set(const uint8_t* const data, const uint16_t size = 512);
void set(const uint32_t universe_, const uint8_t* const data, const uint16_t size = 512);
void set(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, const uint16_t size = 512);
void send();
void send(const uint8_t* const data, const uint16_t size = 512);
void send(const uint32_t universe_, const uint8_t* const data, const uint16_t size = 512);
void send(const uint8_t net_, const uint8_t subnet_, const uint8_t universe_, const uint8_t* const data, const uint16_t size = 512);
void streaming();
void physical(const uint8_t i) const;
uint8_t sequence() const;
```
### ArtnetReceiver
```C++
bool parse()
inline const IPAddress& ip() const { return remote_ip; }
uint16_t port() const { return remote_port; }
String id() const
uint16_t opcode() const
uint16_t opcode(const uint8_t* p) const
uint16_t version() const
uint8_t sequence() const
uint8_t physical() const
uint8_t net() const
uint8_t subnet() const
uint8_t universe() const
uint16_t universe15bit() const
uint16_t length() const
uint16_t size() const
uint8_t* data()
uint8_t data(const uint16_t i) const
void subscribe(const uint32_t universe, const CallbackType& func)
void subscribe(const CallbackType& func)
void subscribe(const uint8_t net, const uint8_t subnet, const uint8_t universe, const CallbackType& func)
bool parse();
inline const IPAddress& ip() const;
uint16_t port() const;
String id() const;
uint16_t opcode() const;
uint16_t opcode(const uint8_t* p) const;
uint16_t version() const;
uint8_t sequence() const;
uint8_t physical() const;
uint8_t net() const;
uint8_t subnet() const;
uint8_t universe() const;
uint16_t universe15bit() const;
uint16_t length() const;
uint16_t size() const;
uint8_t* data();
uint8_t data(const uint16_t i) const;
void subscribe(const uint32_t universe, const CallbackType& func);
void subscribe(const CallbackType& func);
void subscribe(const uint8_t net, const uint8_t subnet, const uint8_t universe, const CallbackType& func);
```
## Supported Platform

Loading…
Cancel
Save