From v4.4 to v4.5
=================

.. highlight:: c++

Template Streams
----------------

The :cpp:class:`TemplateStream` class has been updated to improve tag recognition (:pull-request:`2400`).
This means regular ``{varname}`` tags are sufficient for most purposes, including JSON templates.

The :cpp:class:`IFS::JsonDirectoryTemplate` previously used double-brace tags such as ``{{varname}}``.
It now uses regular tags by default, so if you use this class either:

1. Add a call to :cpp:func:`TemplateStream::setDoubleBraces` in your code, or
2. Update your templates to use single braces


Eclipse Project Files
---------------------

Starting with version 4.5.x we don't provide Eclipse meta files in our samples. 
These can be generated using the ``ide-eclipse`` makefile target.
For more information read the updated :doc:`/tools/eclipse`.


Esp8266 toolchain
-----------------

Sming now requires the :doc:`/arch/esp8266/getting-started/eqt` for building.

Support for the old legacy toolchains (ESP open SDK, UDK) have been dropped.
They may still work but are no longer tested.


user_config.h
-------------

This header file is part of the original ESP8266 SDK code and is now deprecated.
Libraries should use only the necessary headers.
Applications do not require it.

Breaking Changes
----------------

Undeprecated :cpp:func:`HttpRequest::getQueryParameter` and removed a lot of old deprecated code.

- Removed ``WebsocketClient::disconnect()``. Use :cpp:func:`WebsocketClient::close` instead.
- Removed ``TimerDelegateStdFunction``. Use :cpp:type:`TimerDelegate` instead.
- Removed class ``URL``. Use class :cpp:class:`Url` instead.
- Removed ``TemplateVariables``. Use :cpp:type:`TemplateStream::Variables` instead.
- Removed ``StreamTransformer::transformCallback``. Create inherited class and override :cpp:func:`StreamTransformer::transform` method instead.
- Removed ``StreamTransformer::StreamTransformer(IDataSourceStream* stream, const StreamTransformerCallback& callback, size_t resultSize, size_t blockSize)``.
  Instead, create inherited class, override :cpp:func:`StreamTransformer::transform` method and use alternative constructor.
- Removed ``SslValidatorCallback``. Use :cpp:type:`Ssl::ValidatorCallback` instead.
- Removed ``SslSessionId`` and ``SSLSessionId``. Use :cpp:class:`Ssl::SessionId` instead.
- Removed ``SslKeyCertPair`` and ``SSLKeyCertPair``. Use :cpp:class:`Ssl::KeyCertPair` instead.
- Removed ``SslCertificate``. Use :cpp:class:`Ssl::Certificate` instead.
- Removed ``SeekOriginFlags``. Use :cpp:enum:`SeekOrigin` instead.
- Removed ``eSO_FileStart``. Use :cpp:enumerator:`SeekOrigin::Start` instead.
- Removed ``eSO_CurrentPos``. Use :cpp:enumerator:`SeekOrigin::Current` instead.
- Removed ``eSO_FileEnd``.  Use :cpp:enumerator:`SeekOrigin::End` instead.
- Removed ``OtaUpgrade::BasicStream::errorToString()``. Use :cpp:func:`toString() <String toString(OtaUpgrade::BasicStream::Error)>` instead.
- Removed deprecated stuff in Mqtt, including ``MQTT_MAX_BUFFER_SIZE`` and ``MQTT_MSG_PUBREC``.
- Removed ``MqttClient::publishWithQoS(const String& topic, const String& message, int QoS, bool retained, MqttMessageDeliveredCallback onDelivery)``.
  Use :cpp:func:`bool MqttClient::publish(const String& topic, const String& message, uint8_t flags)` instead. 
  If you want to have a callback that should be triggered on successful delivery of messages, use :cpp:func:`MqttClient::setEventHandler`.
- Removed ``MqttClient::setCallback(MqttStringSubscriptionCallback subscriptionCallback)``.
  Use :cpp:func:`MqttClient::setEventHandler` instead.
- Removed ``MqttClient::setWill (const String& topic, const String& message, int QoS, bool retained)``.
  Use :cpp:func:`MqttClient::setWill` instead.
- Removed ``MqttMessageDeliveredCallback`` and ``MqttStringSubscriptionCallback``. Use :cpp:type:`MqttDelegate` instead.
- Removed ``IDataSourceStream::length()``. Use :cpp:func:`IDataSourceStream::available` instead.
- Removed ``HttpServer::setDefaultResource(HttpResource* resource)``. Use :cpp:func:`paths.setDefault() <HttpResourceTree::setDefault>` instead.
- Removed ``HttpServer::addPath(String path, const HttpPathDelegate& callback)``,
  ``HttpServer::addPath (const String& path, const HttpResourceDelegate& onRequestComplete)`` and
  ``HttpServer::addPath (const String& path, HttpResource* resource)``.
  Use **paths.set()** instead.
- Removed ``HttpResponse::toString(const HttpResponse& res)``.
  Use ::cpp:func:`HttpResponse::toString` method or :cpp:func:`toString() <String toString(HttpResponse)>` global function instead.
- Removed ``HttpResponse::sendTemplate(IDataSourceStream* newTemplateInstance)``.
  Use :cpp:func:`HttpResponse::sendNamedStream` instead.
- Renamed ``commandFunctionDelegate`` to :cpp:type:`CommandFunctionDelegate`.
- Removed ``DateTime::convertFromUnixTime(time_t timep, int8_t* psec, int8_t* pmin, int8_t* phour, int8_t* pday, int8_t* pwday, int8_t* pmonth, int16_t* pyear)``.
  Use :cpp:func:`DateTime::fromUnixTime` instead.
- Removed ``DateTime::convertToUnixTime (uint8_t sec, uint8_t min, uint8_t hour, uint8_t day, uint8_t month, uint16_t year)``.
  Use :cpp:func:`DateTime::toUnixTime` instead.
- Removed ``DateTime::fromUnixTime(time_t timep, int8_t* psec, int8_t* pmin, int8_t* phour, int8_t* pday, int8_t* pwday, int8_t* pmonth, int16_t* pyear)``.
  Use **unsigned** version instead :cpp:func:`void DateTime::fromUnixTime(time_t, uint8_t\*, uint8_t\*, uint8_t\*, uint8_t\*, uint8_t\*, uint8_t\*, uint16_t\*)`.
- Removed ``DateTime::parseHttpDate(const String& httpDate)``. Use :cpp:func:`DateTime::fromHttpDate` instead.
- Renamed ``DNSServer`` class to :cpp:class:`DnsServer`.
- Removed ``eFO_Append``. Use :cpp:var:`File::Append <IFS::File::Append>` instead.
- Removed ``eFO_CreateIfNotExist``. Use :cpp:any:`File::Create` instead.
- Removed ``eFO_CreateNewAlways``. Use :cpp:member:`File::CreateNewAlways` instead.
- Removed ``eFO_ReadOnly``. Use :cpp:member:`File::ReadOnly` instead.
- Removed ``eFO_ReadWrite``. Use :cpp:member:`File::ReadWrite` instead.
- Removed ``eFO_Truncate``. Use :cpp:member:`File::Truncate` instead.
- Removed ``eFO_WriteOnly``. Use :cpp:member:`File::WriteOnly` instead.
- Removed ``eSO_FileStart``. Use :cpp:enumerator:`SeekOrigin::Start` instead.
- Removed ``eSO_CurrentPos``. Use :cpp:enumerator:`SeekOrigin::Current` instead.
- Removed ``eSO_FileEnd``. Use :cpp:enumerator:`SeekOrigin::End` instead.
- Removed ``fileList()`` function. Use :cpp:class:`Directory` object, or :cpp:func:`fileOpenDir` / :cpp:func:`fileReadDir` / :cpp:func:`fileCloseDir` functions.
- Removed ``FileStream::attach(const String& fileName, FileOpenFlags openFlags=File::ReadOnly)``. Use :cpp:func:`FileStream::open` instead.
- Removed ``FTPServer``. Use :cpp:class:`FtpServer` instead.
- Removed ``FtpServer::checkUser(const String& login, const String& pass)``. Use :cpp:func:`FtpServer::validateUser` instead
- Renamed ``Hardware_Timer`` to :cpp:type:`HardwareTimer`.
- Renamed ``HardwareSerial::setCallback(StreamDataReceivedDelegate dataReceivedDelegate)`` to :cpp:func:`HardwareSerial::onDataReceived`.
- Removed ``HttpClient::request(const String& url)``. Use :cpp:func:`HttpClient::createRequest` instead.
- Removed ``HttpConnection::getLastModifiedDate()``. Use ``getResponse()->headers.getLastModifiedDate()`` instead.
- Removed ``HttpConnection::getResponseCode()``. Use ``getResponse()->code`` instead.
- Removed ``HttpConnection::getResponseHeader(const String& headerName, const String& defaultValue)``. Use ``getResponse()->headers[]`` instead.
- Removed ``HttpConnection::getResponseHeaders()``. Use ``getResponse()->headers`` instead. 
- Removed ``HttpConnection::getResponseString (). Use ``getResponse()->getBody()`` instead.
- Removed ``HttpConnection::getServerDate (). Use ``getResponse()->headers.getServerDate()`` instead.
- Removed ``httpGetErrorName (HttpError err)``. Use :cpp:func:`toString() <String toString(HttpError)>` instead.
- Renamed ``HttpPartProducerDelegate`` type to :cpp:type:`MultipartStream::Producer`.
- Renamed ``HttpPartResult`` type to :cpp:class:`MultipartStream::BodyPart`.
- Removed ``HttpRequest::getPath()``. Use :cpp:var:`request.uri.Path <Url::Path>` instead.
- Removed ``HttpRequest::operator=(const HttpRequest& rhs)``. Use :cpp:func:`HttpRequest::clone` instead.
- Removed ``HttpRequest::setPostParameters(const HttpParams& params)``. Use :cpp:var:`request.postParams = params <HttpRequest::postParams>` instead.
- Removed ``HttpResponse::hasHeader(const String& name)``. Use :cpp:func:`headers.contains() <HttpHeaders::contains>` instead.
- Removed ``HttpResponse::forbidden()``. Use :cpp:var:`response.code = HTTP_STATUS_FORBIDDEN <HttpResponse::code>` instead.
- Removed ``HttpResponse::notFound()``. Use :cpp:var:`response.code = HTTP_STATUS_NOT_FOUND <HttpResponse::code>` instead.
- Removed ``HttpResponse::redirect(const String& location)``. Use :cpp:var:`headers[HTTP_HEADER_LOCATION] <HttpResponse::headers>` instead.
