Skip to content

sistechai/mobius-ota

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mobius-ota

Mobius OTA - description

Getting Started

# clone it
git clone https://github.com/sistechai/mobius-ota.git
cd mobius-ota

Install dependencies:

npm install or yarn

Set environment variables:

cp .env.example .env

Run

# start server
npm run dev or yarn dev

Server listening on http://127.0.0.1:7580, in development mode

img

Build for production

npm run build or yarn build

Routes

1. @route GET /fw/:aeid/version
2. @route GET /fw/:aeid/:version/size
3. @route GET /fw/:aeid/:version/download
4. @route GET /fw/:aeid/:version/data/block?seq=:k
5. @route POST /fw/:aeid/rawfile

1. Get Last Firmware Version:

/**
 * This function responding with the firmware version as character string
 * @route GET /fw/:aeid/version
 * @param { string } aeid.required - Application Entity ID
 */
curl -X GET http://127.0.0.1:7580/fw/:aeid/version -i

It will return something like:

HTTP/1.1 200 OK
...
version

2. Get Last Firmware Size:

/**
 * This function responding with the firmware file size
 * @route GET /fw/:aeid/:version/size
 * @param { string } aeid.required - Application Entity ID
 * @param { string } version.required - Firmware version
 */
curl -X GET http://127.0.0.1:7580/fw/:aeid/:version/size -i

It will return something like:

HTTP/1.1 200 OK
...
size

3. Download Last Firmware:

/**
 * This function responding with the firmware file
 * @route GET /fw/:aeid/:version/download
 * @param { string } aeid.required - Application Entity ID
 * @param { string } version.required - Firmware version
 */
curl -X GET http://127.0.0.1:7580/fw/:aeid/:version/download -i

It will return something like:

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: Size
...
file

4. Get k-th Block of The Firmware File:

/**
 * This function responding with the file contents of the k-th block of the firmware file
 * @route GET /fw/:aeid/:version/data/block
 * @param { string } aeid.required - Application Entity ID
 * @param { string } version.required - Firmware version
 * @param { string } seq.query.required - k-th block
 */
curl -X GET "http://127.0.0.1:7580/fw/:aeid/:version/data/block?seq=:k" -i

It will return something like:

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=fragment:k
Access-Control-Expose-Headers: Is-Next, Seq
Content-Length: BufferSize
Seq: k
...
buffer

5. Upload Firmware Raw Data:

/**
 * This function saving the uploaded file into a data folder with the filename provided
 * @route POST /fw/:aeid/rawfile
 * @param { string } aeid.required - Application Entity ID
 * @property { file } file.required - Raw data file
 */
curl -X POST http://127.0.0.1:7580/fw/:aeid/rawfile -F "file=@data.log" -i

It will return something like:

HTTP/1.1 200 OK
...
{"message":"Successfully uploaded!"}

About

Mobius OTA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published