Available soon!
PiDome API
PiDome has two and a half API's ready to be used. These are the JSON-RPC 2.0 API for talking to the server from external sources, and an internal API to develop devices, drivers, peripheral connectors and plugins.
1. JSON-RPC API
The JSON-RPC API is used to communicate with the server from external sources like the web interface, clients or other means. It implements the JSON-RPC 2.0 specification but currently without batching.
The JSON-RPC API is being used on the following server endpoints:
- The server's websocket port
- The server's plain TCP ports (SSL and Non SSL)
- Via http POST and GET at /jsonrpc.json (both endpoints require a "rpc" parameter)
All endpoints support JSON-RPC broadcasting except for the http entry point.
2. Internal API
The internal API is used to develop drivers, devices and peripheral connectors including passing data between them. The internal API is also used to develop plugins.
Device API
The device API is used to receive commands from external resources like the JSON-RPC API where data is always presented in the same way and passes this to the drivers, and vice verse. All though the device API is almost always the same used there are numerous tools present to do pre-driver manipulation. The devices API also support custom devices so users are able to create them.
Driver API
The driver API is used to receive commands from the devices and translates these to data which peripherals understand and vice verse. It is possible to handle device discovery, create and delete devices on the fly and modify them. Future implementations will be able to create device skeletons.
Peripheral connectors API
Peripheral connector API's are used to provide the communication layer between the drivers and the hardware. These are for example com port,usb-hid and Raspberry Pi specific GPIO pin drivers.
The purpose of the peripheral connectors is re-usability meaning a driver developer can choose an existing driver in the server or create their own one which someone else can choose to use.
2.5 Internal custom drivers API
The server provides a mechanism to write your own driver directly in the server's web interface with the possibility to reflect changes in real time. We already have an example provided in fresh installs (from the 10th of October 2015 and up) of the server. Installs from before this date and have been updated need to download the file pidome-example-driver-impl.zip from Pidome Hardware repository downloads to get started. This example is based on an Arduino with a LED, a custom device and an example driver.
The custom drivers API uses ECMAScript as it's intepreter. This means that if you are familiar with JavaScript you will be able to jump start into the example and start writing your own. ECMAScript compatibility is targeted to version 5.1 without browser functions.