Developing with ZentriOS
To get started with the ZentriOS SDK, see Getting Started.
For details of writing ZentriOS apps in the C programming language using the ZentriOS API, see Application Development.
ZentriOS is a highly-optimized yet feature-packed IoT operating system designed specifically to power secure wirelessly connected products. Using the ZentriOS SDK, developers can create native applications that run on ZentriOS, or alternately interface with ZentriOS using the extensive Command API over serial, HTTP REST, WebSockets or a remote terminal. Some of the powerful features provided by ZentriOS include flexible serial communications, sensor and peripheral interfaces, a read/write file system, and robust secure OTA wireless updates from the Zentri Device Management Service (DMS).
There are two options for development of applications with ZentriOS. Either your application runs on a standalone microcontroller, mobile device or desktop and accesses the ZentriOS Command API. Alternately, your app runs directly on board a ZentriOS powered connectivity device and has direct programmatic access to the ZentriOS Command API and an additional Native API.
Native API & Software Development Kit
The ZentriOS Native API enables applications to leverage all of the features available with the Command API, PLUS a vast array of additional ZentriOS services and libraries offered by the Native API. Applications that run on-board ZentriOS-powered hardware avoid the need for an additional microcontroller, and also enable design customization including the ability to extend the ZentriOS Command API and create customized callbacks for use with the ZentriOS HTTP webserver.
Want to write apps that talk to ZentriOS from an MCU, Mobile or Desktop? See ZentriOS Command API.
The ZentriOS SDK includes everything needed to develop and deploy connected product applications on hardware running ZentriOS. Integration with the Zentri Device Management Service ensures developers are authenticated and applications are secured. Once development is complete, applications can be pushed to the cloud for beta-testing or marked ready for deployment to products in the field.
In addition to the extensive features available with the Command API, the Native API provides applications with programmatic access to additional features, libraries and utilities.
- Support for extending the ZentriOS Command API with custom commands and variables
- Customized callbacks and headers for the ZentriOS HTTP webserver and REST API / Websockets
- Register custom event handlers for most network events
- Event handler with periodic, timed or single shot events
- Create custom one-time, asynchronous or periodic events to drive any peripheral or manipulate network connections
- Create and/or customize UART log & debug messages
- UART with Rx character interrupt
For a full list see ZentriOS API features.
System & Core Libraries
- RTOS functions including delay, semaphores, mutexes, queues, events and timers
- Event handlers incl. client connect/disconnect and received packet
- Hardware Interrupt Handlers
- Battery backed register API
- System monitor API
- Crypto functions including AES, CRC, MD5, SHA1, SHA2, SHA4, random number generator
- Base64 encode/decode
- JSON parser
- CSV file reader
- Fixed Point Integer
- Bubble & List sort
- String utilities
- Table lookup functions
The ZentriOS API is contained entirely within the ZentriOS_SDK/api directory and is split into functional groups. See ZentriOS API.
The API version MUST match the version of ZentriOS running on your hardware since ZentriOS Apps are compiled to work with a particular version of ZentriOS. The ZentriOS SDK automatically keeps track of the version of ZentriOS running on your hardware and updates the API to match.
Access to Command APIs
ZentriOS Apps have programmatic access to both the Command API and Native API. ZentriOS Native API functions are prefixed with
zn_ and are of the form
zn_function_name(). There are native API functions to issue ZentriOS commands. See Commands. Details of command APIs are provided in the Command API documentation.
Customizing the Command API
A ZentriOS App can extend the ZentriOS Command API to create custom commands and variables that can be accessed just like any other Command API function.
An example app that demonstrates how to create and use custom commands is the UART Blaster
A custom command cannot call a ZentriOS Command API function.
Dynamic HTTP URLs
Using the HTTP_SERVER_REGISTER_DYNAMIC_PAGES macro, the ZentriOS webserver can serve dynamic web pages and execute custom functions on requests to specified URLs.
The HTTP server app example application demonstrates how to create Custom URLs for the HTTP server.
See HTTP Server, in particular Macros
ZentriOS apps may run from RAM or Flash, depending on the hardware platform. If the app runs from RAM, available RAM on the hardware platform imposes a hard limit on the size of the ZentriOS app.
The implementation of ZentriOS APIs is included in ZentriOS. API calls only reference the ZentriOS implementations. This greatly reduces the required size of a ZentriOS app. The ZentriOS SDK also optimizes apps by placing read-only text and strings into flash memory to avoid wasting RAM.
To optimize the size of a ZentriOS app, wherever possible use the functions compiled into ZentriOS and read-only arrays, variables and text as
File Size Limit
There is no limit to the size of an individual file other than the size of the extended or bulk serial flash connected to the ZentriOS hardware. Bulk serial flash up to 128MBytes may be used.
Files are typically opened and written to completion with the size known a-priori, however the file log API provides the option to append to an existing file which is useful for data logging. The minimum size of a file is 4KByte.
See the File System description and the File System API for additional information.