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 org.openhab.binding.paradoxalarm.internal.communication.messages.IPPacket;
18 * The {@link Request}. Abstract request class. Used to be derived for the particular types of requests to Paradox.
20 * @author Konstantin Polihronov - Initial contribution
22 public abstract class Request implements IRequest {
24 private IPPacket packet;
25 private long timestamp;
26 private RequestType type;
27 private IResponseReceiver receiver;
29 public Request(RequestType type, IPPacket packet, IResponseReceiver receiver) {
32 this.receiver = receiver;
36 public IPPacket getRequestPacket() {
41 public void setTimeStamp() {
42 timestamp = System.currentTimeMillis();
46 public boolean isTimeStampExpired(long tresholdInMillis) {
47 return System.currentTimeMillis() - timestamp >= tresholdInMillis;
51 public RequestType getType() {
56 public String toString() {
57 return "Request [packet=" + packet + ", timestamp=" + timestamp + ", type=" + type + "]";
61 public IResponseReceiver getResponseReceiver() {