-
Notifications
You must be signed in to change notification settings - Fork 1
Semantized Services
##Principle
When a client requests a GET at root, the server responds with the EntryPoint.
The EntryPoint intends to describe all requests the Arduino is able to handle. Each request is composed by :
- ID : used to generate an URL
- Type : Always Hydra:Operation since we describe an Operation in the Hydra vocabulary
- Method : So far implemented GET, POST, PUT
- Label : Optional
- Expects : An expected input payload type
- Returns : The payload type returned by the request
The Expects and Returns fields refer to the Resources. Resources (e.g. light, and temperature) are the data to be found in payloads, both in and out. The Algorithm also stores Resource models so that it can effectively write back responses.
##Adding a Service
To edit the EntryPoint and the Resources, head to WebServer_Hackfest/Semantic.h
You can add a service by writing it as part of the EntryPoint. When a service is enabled, the Algorithm will parse the EntryPoint in search for the necessary information to make it available.
Only Enable, Reset, and the EntryPoint are available at all time. The remaining services have to be configured once, as long as Reset is not called.
##Adding a Resource
Resources have to be added as a new JSON-LD document using the following syntax:
const char[] myResource PROGMEM = "{...}"
added to the json_resources[]
variable and increment RESOURCE_COUNT
by 1.
Bear in mind the @type
field in the Resource is linked to the Expects/Returns
field in the EntryPoint.