mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
Add SSDP Library and let Print::printf to handle longer strings
This commit is contained in:
committed by
Ivan Grokhotkov
parent
7891a84e8b
commit
4fdba1b635
100
libraries/ESP8266SSDP/ESP8266SSDP.h
Normal file
100
libraries/ESP8266SSDP/ESP8266SSDP.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
ESP8266 Simple Service Discovery
|
||||
Copyright (c) 2015 Hristo Gochkov
|
||||
|
||||
Original (Arduino) version by Filippo Sallemi, July 23, 2014.
|
||||
Can be found at: https://github.com/nomadnt/uSSDP
|
||||
|
||||
License (MIT license):
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ESP8266SSDP_H
|
||||
#define ESP8266SSDP_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiUdp.h>
|
||||
|
||||
#define DEBUG_SSDP Serial
|
||||
|
||||
#define SSDP_BASE_SIZE 24
|
||||
#define SSDP_FRIENDLY_NAME_SIZE 32
|
||||
#define SSDP_SERIAL_NUMBER_SIZE 32
|
||||
#define SSDP_PRESENTATION_URL_SIZE 32
|
||||
#define SSDP_MODEL_NAME_SIZE 32
|
||||
#define SSDP_MODEL_URL_SIZE 32
|
||||
#define SSDP_MODEL_VERSION_SIZE 2
|
||||
#define SSDP_MANUFACTURER_SIZE 32
|
||||
#define SSDP_MANUFACTURER_URL_SIZE 32
|
||||
|
||||
typedef enum {
|
||||
NONE,
|
||||
SEARCH,
|
||||
NOTIFY
|
||||
} ssdp_method_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
} ssdp_version_t;
|
||||
|
||||
|
||||
class SSDPClass{
|
||||
public:
|
||||
SSDPClass();
|
||||
~SSDPClass();
|
||||
|
||||
void begin(char *base);
|
||||
uint8_t update();
|
||||
void send(ssdp_method_t method);
|
||||
void schema(WiFiClient client);
|
||||
|
||||
void setName(char *name);
|
||||
void setURL(char *url);
|
||||
void setSerialNumber(char *serialNumber);
|
||||
void setModelName(char *name);
|
||||
void setModelNumber(uint8_t major, uint8_t minor);
|
||||
void setModelURL(char *url);
|
||||
void setManufacturer(char *name);
|
||||
void setManufacturerURL(char *url);
|
||||
|
||||
private:
|
||||
WiFiUDP _server;
|
||||
bool _pending;
|
||||
unsigned short _delay;
|
||||
unsigned long _process_time;
|
||||
unsigned long _notify_time;
|
||||
|
||||
uint8_t *_mac;
|
||||
char *_base;
|
||||
char *_friendlyName;
|
||||
char *_serialNumber;
|
||||
char *_presentationURL;
|
||||
char *_manufacturer;
|
||||
char *_manufacturerURL;
|
||||
char *_modelName;
|
||||
char *_modelURL;
|
||||
ssdp_version_t *_modelNumber;
|
||||
};
|
||||
|
||||
extern SSDPClass SSDP;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user