1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Use direct member initialization instead of ctr initialisation (#7558)

* Use direct member initialization instead of ctr initialisation

This removes a bit of code repetition.

* Add symbolic names for member initializers
This commit is contained in:
Dirk Mueller
2020-10-05 22:56:08 +02:00
committed by GitHub
parent 8b8639e833
commit 4aeb0f5cca
12 changed files with 58 additions and 131 deletions

View File

@ -47,12 +47,10 @@ extern "C" {
#include "include/UdpContext.h"
//#define DEBUG_SSDP Serial
#define SSDP_INTERVAL 1200
#define SSDP_PORT 1900
#define SSDP_METHOD_SIZE 10
#define SSDP_URI_SIZE 2
#define SSDP_BUFFER_SIZE 64
#define SSDP_MULTICAST_TTL 2
// ssdp ipv6 is FF05::C
// lwip-v2's igmp_joingroup only supports IPv4
@ -125,19 +123,8 @@ struct SSDPTimer {
ETSTimer timer;
};
SSDPClass::SSDPClass() :
_server(0),
_timer(0),
_port(80),
_ttl(SSDP_MULTICAST_TTL),
_interval(SSDP_INTERVAL),
_respondToAddr(0,0,0,0),
_respondToPort(0),
_pending(false),
_st_is_uuid(false),
_delay(0),
_process_time(0),
_notify_time(0)
SSDPClass::SSDPClass()
: _respondToAddr(0,0,0,0)
{
_uuid[0] = '\0';
_modelNumber[0] = '\0';

View File

@ -46,6 +46,9 @@ class UdpContext;
#define SSDP_MODEL_VERSION_SIZE 32
#define SSDP_MANUFACTURER_SIZE 64
#define SSDP_MANUFACTURER_URL_SIZE 128
#define SSDP_INTERVAL_SECONDS 1200
#define SSDP_MULTICAST_TTL 2
#define SSDP_HTTP_PORT 80
typedef enum {
NONE,
@ -101,20 +104,20 @@ class SSDPClass{
void _stopTimer();
static void _onTimerStatic(SSDPClass* self);
UdpContext* _server;
SSDPTimer* _timer;
uint16_t _port;
uint8_t _ttl;
uint32_t _interval;
UdpContext* _server = nullptr;
SSDPTimer* _timer = nullptr;
uint16_t _port = SSDP_HTTP_PORT;
uint8_t _ttl = SSDP_MULTICAST_TTL;
uint32_t _interval = SSDP_INTERVAL_SECONDS;
IPAddress _respondToAddr;
uint16_t _respondToPort;
uint16_t _respondToPort = 0;
bool _pending;
bool _st_is_uuid;
unsigned short _delay;
unsigned long _process_time;
unsigned long _notify_time;
bool _pending = false;
bool _st_is_uuid = false;
unsigned short _delay = 0;
unsigned long _process_time = 0;
unsigned long _notify_time = 0;
char _schemaURL[SSDP_SCHEMA_URL_SIZE];
char _uuid[SSDP_UUID_SIZE];