2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.paradoxalarm.internal.communication;
15 import java.util.ArrayList;
16 import java.util.List;
19 * The {@link MemoryMap} this keeps Paradox RAM map as cached object inside the communicator.
20 * Every record in the list is byte array which contains 64 byte RAM page.
22 * @author Konstantin Polihronov - Initial contribution
24 public class MemoryMap {
25 private List<byte[]> ramCache = new ArrayList<>();
27 public MemoryMap(List<byte[]> ramCache) {
28 this.ramCache = ramCache;
31 public List<byte[]> getRamCache() {
35 public void setRamCache(List<byte[]> ramCache) {
36 this.ramCache = ramCache;
39 public synchronized byte[] getElement(int index) {
40 return ramCache.get(index);
43 public synchronized void updateElement(int index, byte[] elementValue) {
44 ramCache.set(index - 1, elementValue);