Unverified Commit c6b850b1 authored by Sanket Wadekar's avatar Sanket Wadekar Committed by GitHub

Rainmaker: Added enableSystemService API (#7875)

* Rainmaker: Added enableSystemService API

* Fixed broken links in espnow docs
parent 77e7fa58
......@@ -13,13 +13,13 @@ Examples
ESP-NOW Master
**************
.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/Basic/Master/Master.ino
.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/ESPNow_Basic_Master/ESPNow_Basic_Master.ino
:language: arduino
ESP-NOW Slave
*************
.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino
.. literalinclude:: ../../../libraries/ESP32/examples/ESPNow/ESPNow_Basic_Slave/ESPNow_Basic_Slave.ino
:language: arduino
Resources
......
......@@ -139,6 +139,26 @@ This function will return
1. `ESP_OK` : On success
2. Error in case of failure
RMaker.enableSystemService
**************************
This API enables the System service for the node. It should be called after `RMaker.initNode()` and before `RMaker.start()`.
For more information, check `here <https://rainmaker.espressif.com/docs/sys-service.html>`__.
.. code-block:: arduino
esp_err_t enableSystemService(uint16_t flags, int8_t reboot_seconds, int8_t reset_seconds, int8_t reset_reboot_seconds)
* ``flags`` : Logical OR of system service flags (SYSTEM_SERV_FLAG_REBOOT, SYSTEM_SERV_FLAG_FACTORY_RESET, SYSTEM_SERV_FLAG_WIFI_RESET) as required or SYSTEM_SERV_FLAGS_ALL.
* ``reboot_seconds`` Time in seconds after which the device should reboot. Recommended value: 2
* ``reset_seconds`` Time in seconds after which the device should reset(Wi-Fi or Factory). Recommended value: 2
* ``reset_reboot_seconds`` Time in seconds after which the device should reboot after it has been reset. Zero as a value would mean there won't be any reboot after the reset. Recommended value: 2
This function will return
1. `ESP_OK` : On success
2. Error in case of failure
RMaker.setTimeZone
******************
......
......@@ -99,6 +99,8 @@ void setup()
RMaker.enableScenes();
RMaker.enableSystemService(SYSTEM_SERV_FLAGS_ALL, 2, 2, 2);
RMaker.start();
WiFi.onEvent(sysProvEvent);
......
......@@ -155,5 +155,18 @@ esp_err_t RMakerClass::enableScenes()
}
return err;
}
esp_err_t RMakerClass::enableSystemService(uint16_t flags, int8_t reboot_seconds, int8_t reset_seconds, int8_t reset_reboot_seconds)
{
esp_rmaker_system_serv_config_t config = {
.flags = flags,
.reboot_seconds = reboot_seconds,
.reset_seconds = reset_seconds,
.reset_reboot_seconds = reset_reboot_seconds
};
err = esp_rmaker_system_service_enable(&config);
return err;
}
RMakerClass RMaker;
#endif
......@@ -36,6 +36,7 @@ class RMakerClass
esp_err_t enableTZService();
esp_err_t enableOTA(ota_type_t type, const char *cert = ESP_RMAKER_OTA_DEFAULT_SERVER_CERT);
esp_err_t enableScenes();
esp_err_t enableSystemService(uint16_t flags, int8_t reboot_seconds = 2, int8_t reset_seconds = 2, int8_t reset_reboot_seconds = 2);
esp_err_t start();
esp_err_t stop();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment