summaryrefslogtreecommitdiff
path: root/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
blob: 06c00736ac035d272f1ea1933acf65fe14f66790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.smartdevicelink.proxy.rpc;

import androidx.annotation.NonNull;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;

import java.util.Hashtable;

/**
 * This RPC deletes the window created by the CreateWindow RPC
 * @see CreateWindow
 * @since 6.0
 */
public class DeleteWindow extends RPCRequest {
    public static final String KEY_WINDOW_ID = "windowID";

    /**
     * Constructs a new DeleteWindow object
     */
    public DeleteWindow() {
        super(FunctionID.DELETE_WINDOW.toString());
    }

    /**
     * <p>Constructs a new DeleteWindow object indicated by the Hashtable
     * parameter</p>
     *
     * @param hash The Hashtable to use
     */
    public DeleteWindow(Hashtable<String, Object> hash) {
        super(hash);
    }

    /**
     * Constructs a new DeleteWindow object
     *
     * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and cannot be deleted.
     *       See PredefinedWindows enum.
     */
    public DeleteWindow(@NonNull Integer windowID) {
        this();
        setWindowID(windowID);
    }

    /**
     * Sets the windowID. It's a unique ID to identify the window.
     * The value of '0' will always be the default main window on the main display and cannot be deleted.
     * See PredefinedWindows enum.
     *
     * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
     */
    public DeleteWindow setWindowID(@NonNull Integer windowID) {
        setParameters(KEY_WINDOW_ID, windowID);
        return this;
    }

    /**
     * Gets the windowID.
     *
     * @return int -an int value representing the windowID.
     */
    public Integer getWindowID() {
        return getInteger(KEY_WINDOW_ID);
    }
}