GitHub - oatpp/oatpp-ssdp: Oat++ extension module to work with SSDP protocol. (original) (raw)

oatpp-ssdp Build Status

Oat++ extension module to work with SSDP (Simple Service Discovery Protocol) protocol.

๐Ÿ‘‰Find the complete example project using oatpp-ssdp module - Example IoT Hue๐Ÿ‘ˆ

More about Oat++:

Build And Install

Note: you need to install the main oatpp module first.

API

Declare Necessary Components

In the AppComponent.hpp file:

#include "oatpp-ssdp/SimpleSsdpUdpStreamProvider.hpp" #include "oatpp-ssdp/SsdpStreamHandler.hpp"

...

/**

/**

/**

Run SSDP Server

In the App.cpp file:

/* Get stream provider component */ OATPP_COMPONENT(std::shared_ptroatpp::ssdp::UdpStreamProvider, ssdpStreamProvider, "ssdp");

/* Get stream handler component */ OATPP_COMPONENT(std::shared_ptroatpp::ssdp::SsdpStreamHandler, ssdpStreamHandler, "ssdp");

/* Create server which takes provided streams and passes them to stream handler */ oatpp::network::server::Server server(ssdpStreamProvider, ssdpStreamHandler);

/* Priny info about server port */ OATPP_LOGD("Server", "Running SSDP on port %s...", ssdpStreamProvider->getProperty("port").getData());

/* Run server */ server.run();

Handle SSDP Messages

In the Controller.hpp file:

/**