This package provides an API interface to external applications by providing a raw byte-based API.
In order to run this, first start the main HOLEG application. This means starting the Main
class
file, either by running this file inside the IDE or creating and running the jar version. Then use the algorithm option
to load the handheld class in order to run the server.
The protocol operates on binary level. The data types are interpreted based on their expected usage. It contains no type information is always fixed in length.
Name | Size (bytes) | Encodes | Notes |
---|---|---|---|
Byte | 4 | two complement | signed |
Int | 4 | two complement | signed |
Bool | 4 | false as 0x0, true otherwise | boolean |
Float | 4 | IEEE 754 | - |
String | Variable | UTF-8 | Length is given by a two byte unsigned length prefix |
Array<Type> |
Variable | Directly concatenated | List of elements, length is given a preceding field |
Messages types are identified by their respective ID in Byte
. A message
is always prefixed by this ID. You can see an example below for SetAmount
. The documented
messages show the ID numbers in their respective titles (SetAmount(10)
- 10
is the ID).
Type (byte) | Index | Amount |
---|---|---|
10 | Int | Int |
Set amount of devices.
Field Name | Type | Notes |
---|---|---|
Index | Int | Holon element index |
Amount | Int | Target amount |
Enable or disable a holon element.
Field Name | Type | Notes |
---|---|---|
Index | Int | Holon element index |
Enabled | Bool | Target state |
Field Name | Type | Notes |
---|---|---|
Index | Int | Holon element index |
Field Name | Type | Notes |
---|---|---|
Index | Int | Holon element index |
Once sent on initial connection and then updated if there are any changes. Updates contain the complete current view.
Field Name | Type | Notes |
---|---|---|
Size | Int | Length of the following array |
Amount | Array<HolonElement> |
Current state of each Holon element |
Holon Element
Field Name | Type | Notes |
---|---|---|
Name | String | User defined name i.e. Fridge, TV |
Amount | Int | Number of devices of this type |
Energy | Float | Energy usage per device |
Enabled | Bool | If the device is enabled |