1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

adding a few new features to the packet format

* can now specify the TTL programmatically
* can now define the device type urn (up to 64 chars)
** still defaults to `Basic:1`
* can now set the serial number using a `uint32_t`, formatted as %08X
This commit is contained in:
Wyatt Neal
2016-01-05 21:53:48 -05:00
parent dba2f92f78
commit 430331a4f8
2 changed files with 40 additions and 18 deletions

View File

@ -37,6 +37,7 @@ class UdpContext;
#define SSDP_UUID_SIZE 37
#define SSDP_SCHEMA_URL_SIZE 64
#define SSDP_DEVICE_TYPE_SIZE 64
#define SSDP_FRIENDLY_NAME_SIZE 64
#define SSDP_SERIAL_NUMBER_SIZE 32
#define SSDP_PRESENTATION_URL_SIZE 128
@ -64,6 +65,8 @@ class SSDPClass{
void schema(WiFiClient client);
void setDeviceType(const String& deviceType) { setDeviceType(deviceType.c_str()); }
void setDeviceType(const char *deviceType);
void setName(const String& name) { setName(name.c_str()); }
void setName(const char *name);
void setURL(const String& url) { setURL(url.c_str()); }
@ -72,6 +75,7 @@ class SSDPClass{
void setSchemaURL(const char *url);
void setSerialNumber(const String& serialNumber) { setSerialNumber(serialNumber.c_str()); }
void setSerialNumber(const char *serialNumber);
void setSerialNumber(const uint32_t serialNumber);
void setModelName(const String& name) { setModelName(name.c_str()); }
void setModelName(const char *name);
void setModelNumber(const String& num) { setModelNumber(num.c_str()); }
@ -83,6 +87,7 @@ class SSDPClass{
void setManufacturerURL(const String& url) { setManufacturerURL(url.c_str()); }
void setManufacturerURL(const char *url);
void setHTTPPort(uint16_t port);
void setTTL(uint8_t ttl);
protected:
void _send(ssdp_method_t method);
@ -93,6 +98,7 @@ class SSDPClass{
UdpContext* _server;
SSDPTimer* _timer;
uint16_t _port;
uint8_t _ttl;
IPAddress _respondToAddr;
uint16_t _respondToPort;
@ -101,9 +107,10 @@ class SSDPClass{
unsigned short _delay;
unsigned long _process_time;
unsigned long _notify_time;
char _schemaURL[SSDP_SCHEMA_URL_SIZE];
char _uuid[SSDP_UUID_SIZE];
char _deviceType[SSDP_DEVICE_TYPE_SIZE];
char _friendlyName[SSDP_FRIENDLY_NAME_SIZE];
char _serialNumber[SSDP_SERIAL_NUMBER_SIZE];
char _presentationURL[SSDP_PRESENTATION_URL_SIZE];