.. _SystemIntegration_HandlingMemory: ####### Memory ####### Get all device memory values **************************** Returns all available memory and their value. See :ref:`SupportedDevices ` to learn more about what memory is available. **URL parameters** * **hostIp**: ip address of the API host. * **deviceId**: id of the device. .. http:get:: https://{hostIp}:7081/hal/devices/{deviceId}/memory **Example request**: .. sourcecode:: http GET /hal/devices/io1/memory HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "value": 16, "name": "MEM1" }, ... { "value": 20, "name": "MEMX" } ] :statuscode 200: OK :statuscode 400: Bad Request. A descriptive error comes along with this error. :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. Something is wrong with the claims of the user. :statuscode 500: Internal Server Error :resheader Content-Type: defines the serialization format for the response body (this depends on the :mailheader:`Accept` header of the request) :>json array memory: array with memory and their values. The max value depends on the memory type. See :ref:`memory types ` for more info and check the :ref:`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 :ref:`SupportedDevices ` to learn more about what memory are available. .. http:get:: https://{hostIp}:7081/hal/devices/{deviceId}/memory?memoryName={memoryName1}&memoryName={memoryName2} **Example request**: .. sourcecode:: http GET /hal/devices/io1/memory?memoryName=MEM1&memoryName=MEM2 HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS... **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [ { "value": 16, "name": "MEM1" }, { "value": 200, "name": "MEM2" } ] :statuscode 200: OK :statuscode 400: Bad Request. A descriptive error comes along with this error. :statuscode 401: Unauthorized. Something is wrong with the :mailheader:`Authorization` header of the request :statuscode 403: Forbidden. Something is wrong with the claims of the user. :statuscode 500: Internal Server Error :resheader Content-Type: defines the serialization format for the response body (this depends on the :mailheader:`Accept` header of the request) :>json array memory: array with memory and their values. The max value depends on the memory type. See :ref:`memory types ` for more info and check the :ref:`device specifications ` to know which types are supported. .. _SystemIntegration_HandlingMemory_Types: 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 :ref:`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" } ]}