Memory

Get all device memory values

Returns all available memory and their value. See SupportedDevices to learn more about what memory is available.

URL parameters

  • hostIp: ip address of the API host.

  • deviceId: id of the device.

GET https://{hostIp}:7081/hal/devices/{deviceId}/memory

Example request:

GET /hal/devices/io1/memory HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJS...

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
      "value": 16,
      "name": "MEM1"
  },

  ...

  {
      "value": 20,
      "name": "MEMX"
  }
]
Status Codes:
Response Headers:
  • Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)

Response JSON Object:
  • memory (array) – array with memory and their values. The max value depends on the memory type. See memory types for more info and check the device specifications to know which types are supported.

Get one or more memory values

Returns all desired memory values.

URL parameters

  • hostIp: ip address of the API host.

  • deviceId: id of the device.

  • memoryName1 / memoryName2: See SupportedDevices to learn more about what memory are available.

GET https://{hostIp}:7081/hal/devices/{deviceId}/memory?memoryName={memoryName1}&memoryName={memoryName2}

Example request:

GET /hal/devices/io1/memory?memoryName=MEM1&memoryName=MEM2 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJS...

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
      "value": 16,
      "name": "MEM1"
  },
  {
      "value": 200,
      "name": "MEM2"
  }
]
Status Codes:
Response Headers:
  • Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)

Response JSON Object:
  • memory (array) – array with memory and their values. The max value depends on the memory type. See memory types for more info and check the device specifications to know which types are supported.

Memory Types

3 main types of memory are available:

RAM

ROM

NVRAM

Memory state after power up

Non known Data

Same data as befor power fail

Same data as befor power fail

Set Value in Preparation mode?

Yes

Yes

Yes

Set Value in Action mode?

Yes

NO

Yes

Writing cycles

1 Milion

1000

1 Milion

Remarks:

  • Preparation and Action mode mentioned in the table above refer to specific terminology used for Alphatronics generation2 devices:

    • preparation mode: configuration mode for the device

    • action mode: normal operational mode for the device

  • The max memory value depends on the data size. These data size can sometimes be pre-configured depending on the type of device. Supported data length values are:

    • 1bit: [0,1]

    • 1Byte: [0,15]

    • 2Byte (word): [0,256]

    • 4Byte (long word): [0,65535]

Events

Memory Events

The websocket server will send memory value change updates to a registered websocket client. The websocket - method name will be “receiveMemory”.

See SupportedDevices to learn more about what memory is available.

Example of an event after an memory value change:

"messageType": 1,
"data":
{
    "methodName": "receiveMemory",
    "arguments": [
    {
        "memory": [
        {
            "name": "MEM1",
            "value": 20
        }],
        "deviceId": "io1",
        "version": "1.0"
    }
]}