Skip to content

Add API Document OTA #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions source/amebad/API_Documents/OTA/Class OTA.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
Class OTA
=========

.. contents::
:local:
:depth: 2

**OTA Class**
-------------

**Description**
~~~~~~~~~~~~~~~

A class used for updating firmware Over the Air (OTA) in local area network.

**Syntax**
~~~~~~~~~~

.. code-block:: c++

class OTA

**Members**
~~~~~~~~~~~

+------------------------------------------+-------------------------------------------------+
| **Public Constructors** |
+==========================================+=================================================+
| A public constructor should not be used as this class is intended to be a singleton class. |
| Access member functions using the object instance named OTA. |
+------------------------------------------+-------------------------------------------------+
| **Public Methods** |
+------------------------------------------+-------------------------------------------------+
| OTA::beginOTA | Starts to connect to MDNS OTA server |
| | and receive the new firmware. |
| | |
+------------------------------------------+-------------------------------------------------+
| OTA::start_OTA_threads | Starts multithreading tasks to connect |
| | to HTTP OTA server and receive new firmware |
| | upon triggered. |
+------------------------------------------+-------------------------------------------------+

**OTA::beginOTA**
-----------------

**Description**
~~~~~~~~~~~~~~~

Starts the connect of OTA server and waiting to receive the new OTA firmware sending from the OTA client via TCP socket.

**Syntax**
~~~~~~~~~~

.. code-block:: c++

void beginOTA(int port);

**Parameters**
~~~~~~~~~~~~~~

port: port number for the OTA MDNS IP address, default port address is 8082.

**Returns**
~~~~~~~~~~~

NA

**Example Code**
~~~~~~~~~~~~~~~~

Example: `OTA_Basic <https://github.com/Ameba-AIoT/ameba-arduino-d/blob/dev/Arduino_package/hardware/libraries/OTA/examples/OTA_Basic/OTA_Basic.ino>`_

.. note :: Configures and registers the MDNS service required for the Arduino IDE to discover and recognize Ameba OTA. "OTA.h" must be included to use the class function.

**OTA::start_OTA_threads**
--------------------------

**Description**
~~~~~~~~~~~~~~~

Starts the connect of OTA server and waiting to receive the new OTA firmware sending from the OTA client via TCP socket.

**Syntax**
~~~~~~~~~~

.. code-block:: c++

void start_OTA_threads(int port, char *server);

**Parameters**
~~~~~~~~~~~~~~

port: port number for the OTA HTTP server IP address, default port address is 3000.

\*server: pointer for OTA HTTP server IP address.

**Returns**
~~~~~~~~~~~

NA

**Example Code**
~~~~~~~~~~~~~~~~

Example: `OTA_Http <https://github.com/Ameba-AIoT/ameba-arduino-d/blob/dev/Arduino_package/hardware/libraries/OTA/examples/OTA_Http/OTA_Http.ino>`_
7 changes: 7 additions & 0 deletions source/amebad/API_Documents/OTA/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OTA
===

.. toctree::
:maxdepth: 1

Class OTA
7 changes: 7 additions & 0 deletions source/amebad/API_Documents/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API Documents
=============

.. toctree::
:maxdepth: 1

OTA/index
1 change: 1 addition & 0 deletions source/amebad/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AmebaD Arduino
:maxdepth: 2

Example_Guides/index
API_Documents/index

SDK Source Code
---------------
Expand Down
Loading